summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2010-03-14 18:07:24 +0000
committerAlbrecht Schlosser <albrechts.fltk@online.de>2010-03-14 18:07:24 +0000
commit998cc6df521a115454727d1ecf6bc7d4fee96f68 (patch)
tree70a1c9afffb294a75bd38484c2e6e4a042ac3426 /test
parent5bc66fafc348c547870bbf51c9c4a7215ad4ff25 (diff)
Merge of branch-1.3-Fl_Printer, with the following main changes:
(1) adding Fl_Device class (and more) for device abstraction (2) adding Fl_Pinter class (and more) for printing support. Todo: Code cleanup, update dependencies, remove/replace test print window. I'm looking into converting the test window popup in a global shortcut that would pop up the print dialog now... git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7263 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'test')
-rw-r--r--test/Makefile10
-rw-r--r--test/cube.cxx33
-rw-r--r--test/device.cxx735
-rw-r--r--test/glpuzzle.cxx29
-rw-r--r--test/image.cxx1
-rw-r--r--test/makedepend81
-rw-r--r--test/mandelbrot.cxx24
-rw-r--r--test/mandelbrot_ui.fl2
-rw-r--r--test/print.cxx189
-rw-r--r--test/unittest_images.cxx4
10 files changed, 1088 insertions, 20 deletions
diff --git a/test/Makefile b/test/Makefile
index ae70b4389..ce8297c17 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -49,6 +49,7 @@ CPPFILES =\
cursor.cxx \
curve.cxx \
demo.cxx \
+ device.cxx \
doublebuffer.cxx \
editor.cxx \
fast_slow.cxx \
@@ -82,6 +83,7 @@ CPPFILES =\
pixmap_browser.cxx \
pixmap.cxx \
preferences.cxx \
+ device.cxx \
radio.cxx \
resizebox.cxx \
resize.cxx \
@@ -119,6 +121,7 @@ ALL = \
cursor$(EXEEXT) \
curve$(EXEEXT) \
demo$(EXEEXT) \
+ device$(EXEEXT) \
doublebuffer$(EXEEXT) \
editor$(EXEEXT) \
fast_slow$(EXEEXT) \
@@ -148,6 +151,7 @@ ALL = \
pixmap$(EXEEXT) \
pixmap_browser$(EXEEXT) \
preferences$(EXEEXT) \
+ device$(EXEEXT) \
radio$(EXEEXT) \
resize$(EXEEXT) \
resizebox$(EXEEXT) \
@@ -317,6 +321,10 @@ demo$(EXEEXT): demo.o
echo Linking $@...
$(CXX) $(ARCHFLAGS) $(LDFLAGS) -o $@ demo.o $(LINKFLTKFORMS) $(LDLIBS)
+device$(EXEEXT): device.o $(IMGLIBNAME)
+ echo Linking $@...
+ $(CXX) $(ARCHFLAGS) $(LDFLAGS) device.o -o $@ $(LINKFLTKIMG) $(LDLIBS)
+
doublebuffer$(EXEEXT): doublebuffer.o
editor$(EXEEXT): editor.o
@@ -404,6 +412,8 @@ pixmap_browser$(EXEEXT): pixmap_browser.o $(IMGLIBNAME)
preferences$(EXEEXT): preferences.o
preferences.cxx: preferences.fl ../fluid/fluid$(EXEEXT)
+device$(EXEEXT): device.o
+
radio$(EXEEXT): radio.o
radio.cxx: radio.fl ../fluid/fluid$(EXEEXT)
diff --git a/test/cube.cxx b/test/cube.cxx
index 4598921a9..b7bf82614 100644
--- a/test/cube.cxx
+++ b/test/cube.cxx
@@ -157,8 +157,41 @@ void makeform(const char *name) {
form->end();
}
+// added to demo printing
+#include <FL/Fl_Sys_Menu_Bar.H>
+#include <FL/Fl_Gl_Printer.H>
+
+void print_cb(Fl_Widget *w, void *data)
+{
+ Fl_Gl_Printer printer;
+ Fl_Window *win = Fl::first_window();
+ if(!win) return;
+ if( printer.start_job(1) ) return;
+ if( printer.start_page() ) return;
+ printer.scale(0.68,0.68);
+ printer.print_widget( win );
+ printer.print_gl_window( cube, cube->x(), cube->y() );
+ printer.print_gl_window( cube2, cube2->x(), cube2->y() );
+ printer.end_page();
+ printer.end_job();
+}
+// end of printing demo
+
int main(int argc, char **argv) {
makeform(argv[0]);
+ // added to demo printing
+ form->begin();
+ static Fl_Menu_Item items[] = {
+ { "Menu", 0, 0, 0, FL_SUBMENU },
+ { "Print", 0, print_cb, 0, 0 },
+ { 0 },
+ { 0 }
+ };
+ Fl_Sys_Menu_Bar *menubar_;
+ menubar_ = new Fl_Sys_Menu_Bar(0, 0, 40, 25);
+ menubar_->menu(items);
+ form->end();
+ // end of printing demo
speed->bounds(4,0);
speed->value(cube->speed = cube2->speed = 1.0);
size->bounds(4,0.01);
diff --git a/test/device.cxx b/test/device.cxx
new file mode 100644
index 000000000..77a688bf8
--- /dev/null
+++ b/test/device.cxx
@@ -0,0 +1,735 @@
+// Cartesian.H,v 0.9
+//
+// Copyright 2000 by Roman Kantor.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public License
+// version 2 as published by the Free Software Foundation.
+//
+
+// This library is distributed WITHOUT ANY WARRANTY;
+// WITHOUT even the implied warranty of MERCHANTABILITY
+// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Library General Public License for more details.
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+
+
+#include <math.h>
+#include <FL/Fl.H>
+
+#include <FL/Fl_Overlay_Window.H>
+#include <FL/Fl_Light_Button.H>
+#include <FL/fl_draw.H>
+#include <FL/Fl_Clock.H>
+#include <test/pixmaps/porsche.xpm>
+#include <FL/Fl_Pixmap.H>
+#include <FL/Fl_Bitmap.H>
+#include <FL/Fl_Round_Button.H>
+
+
+#include <FL/Fl_Printer.H>
+
+//#include "fl_printer_chooser.H"
+
+#include <FL/Fl_File_Chooser.H>
+#include <FL/fl_draw.H>
+
+
+#define sorceress_width 75
+#define sorceress_height 75
+
+
+// shameles copy from bitmap...
+static uchar sorceress_bits[] = {
+ 0xfc, 0x7e, 0x40, 0x20, 0x90, 0x00, 0x07, 0x80, 0x23, 0x00, 0x00, 0xc6,
+ 0xc1, 0x41, 0x98, 0xb8, 0x01, 0x07, 0x66, 0x00, 0x15, 0x9f, 0x03, 0x47,
+ 0x8c, 0xc6, 0xdc, 0x7b, 0xcc, 0x00, 0xb0, 0x71, 0x0e, 0x4d, 0x06, 0x66,
+ 0x73, 0x8e, 0x8f, 0x01, 0x18, 0xc4, 0x39, 0x4b, 0x02, 0x23, 0x0c, 0x04,
+ 0x1e, 0x03, 0x0c, 0x08, 0xc7, 0xef, 0x08, 0x30, 0x06, 0x07, 0x1c, 0x02,
+ 0x06, 0x30, 0x18, 0xae, 0xc8, 0x98, 0x3f, 0x78, 0x20, 0x06, 0x02, 0x20,
+ 0x60, 0xa0, 0xc4, 0x1d, 0xc0, 0xff, 0x41, 0x04, 0xfa, 0x63, 0x80, 0xa1,
+ 0xa4, 0x3d, 0x00, 0x84, 0xbf, 0x04, 0x0f, 0x06, 0xfc, 0xa1, 0x34, 0x6b,
+ 0x01, 0x1c, 0xc9, 0x05, 0x06, 0xc7, 0x06, 0xbe, 0x11, 0x1e, 0x43, 0x30,
+ 0x91, 0x05, 0xc3, 0x61, 0x02, 0x30, 0x1b, 0x30, 0xcc, 0x20, 0x11, 0x00,
+ 0xc1, 0x3c, 0x03, 0x20, 0x0a, 0x00, 0xe8, 0x60, 0x21, 0x00, 0x61, 0x1b,
+ 0xc1, 0x63, 0x08, 0xf0, 0xc6, 0xc7, 0x21, 0x03, 0xf8, 0x08, 0xe1, 0xcf,
+ 0x0a, 0xfc, 0x4d, 0x99, 0x43, 0x07, 0x3c, 0x0c, 0xf1, 0x9f, 0x0b, 0xfc,
+ 0x5b, 0x81, 0x47, 0x02, 0x16, 0x04, 0x31, 0x1c, 0x0b, 0x1f, 0x17, 0x89,
+ 0x4d, 0x06, 0x1a, 0x04, 0x31, 0x38, 0x02, 0x07, 0x56, 0x89, 0x49, 0x04,
+ 0x0b, 0x04, 0xb1, 0x72, 0x82, 0xa1, 0x54, 0x9a, 0x49, 0x04, 0x1d, 0x66,
+ 0x50, 0xe7, 0xc2, 0xf0, 0x54, 0x9a, 0x58, 0x04, 0x0d, 0x62, 0xc1, 0x1f,
+ 0x44, 0xfc, 0x51, 0x90, 0x90, 0x04, 0x86, 0x63, 0xe0, 0x74, 0x04, 0xef,
+ 0x31, 0x1a, 0x91, 0x00, 0x02, 0xe2, 0xc1, 0xfd, 0x84, 0xf9, 0x30, 0x0a,
+ 0x91, 0x00, 0x82, 0xa9, 0xc0, 0xb9, 0x84, 0xf9, 0x31, 0x16, 0x81, 0x00,
+ 0x42, 0xa9, 0xdb, 0x7f, 0x0c, 0xff, 0x1c, 0x16, 0x11, 0x00, 0x02, 0x28,
+ 0x0b, 0x07, 0x08, 0x60, 0x1c, 0x02, 0x91, 0x00, 0x46, 0x29, 0x0e, 0x00,
+ 0x00, 0x00, 0x10, 0x16, 0x11, 0x02, 0x06, 0x29, 0x04, 0x00, 0x00, 0x00,
+ 0x10, 0x16, 0x91, 0x06, 0xa6, 0x2a, 0x04, 0x00, 0x00, 0x00, 0x18, 0x24,
+ 0x91, 0x04, 0x86, 0x2a, 0x04, 0x00, 0x00, 0x00, 0x18, 0x27, 0x93, 0x04,
+ 0x96, 0x4a, 0x04, 0x00, 0x00, 0x00, 0x04, 0x02, 0x91, 0x04, 0x86, 0x4a,
+ 0x0c, 0x00, 0x00, 0x00, 0x1e, 0x23, 0x93, 0x04, 0x56, 0x88, 0x08, 0x00,
+ 0x00, 0x00, 0x90, 0x21, 0x93, 0x04, 0x52, 0x0a, 0x09, 0x80, 0x01, 0x00,
+ 0xd0, 0x21, 0x95, 0x04, 0x57, 0x0a, 0x0f, 0x80, 0x27, 0x00, 0xd8, 0x20,
+ 0x9d, 0x04, 0x5d, 0x08, 0x1c, 0x80, 0x67, 0x00, 0xe4, 0x01, 0x85, 0x04,
+ 0x79, 0x8a, 0x3f, 0x00, 0x00, 0x00, 0xf4, 0x11, 0x85, 0x06, 0x39, 0x08,
+ 0x7d, 0x00, 0x00, 0x18, 0xb7, 0x10, 0x81, 0x03, 0x29, 0x12, 0xcb, 0x00,
+ 0x7e, 0x30, 0x28, 0x00, 0x85, 0x03, 0x29, 0x10, 0xbe, 0x81, 0xff, 0x27,
+ 0x0c, 0x10, 0x85, 0x03, 0x29, 0x32, 0xfa, 0xc1, 0xff, 0x27, 0x94, 0x11,
+ 0x85, 0x03, 0x28, 0x20, 0x6c, 0xe1, 0xff, 0x07, 0x0c, 0x01, 0x85, 0x01,
+ 0x28, 0x62, 0x5c, 0xe3, 0x8f, 0x03, 0x4e, 0x91, 0x80, 0x05, 0x39, 0x40,
+ 0xf4, 0xc2, 0xff, 0x00, 0x9f, 0x91, 0x84, 0x05, 0x31, 0xc6, 0xe8, 0x07,
+ 0x7f, 0x80, 0xcd, 0x00, 0xc4, 0x04, 0x31, 0x06, 0xc9, 0x0e, 0x00, 0xc0,
+ 0x48, 0x88, 0xe0, 0x04, 0x79, 0x04, 0xdb, 0x12, 0x00, 0x30, 0x0c, 0xc8,
+ 0xe4, 0x04, 0x6d, 0x06, 0xb6, 0x23, 0x00, 0x18, 0x1c, 0xc0, 0x84, 0x04,
+ 0x25, 0x0c, 0xff, 0xc2, 0x00, 0x4e, 0x06, 0xb0, 0x80, 0x04, 0x3f, 0x8a,
+ 0xb3, 0x83, 0xff, 0xc3, 0x03, 0x91, 0x84, 0x04, 0x2e, 0xd8, 0x0f, 0x3f,
+ 0x00, 0x00, 0x5f, 0x83, 0x84, 0x04, 0x2a, 0x70, 0xfd, 0x7f, 0x00, 0x00,
+ 0xc8, 0xc0, 0x84, 0x04, 0x4b, 0xe2, 0x2f, 0x01, 0x00, 0x08, 0x58, 0x60,
+ 0x80, 0x04, 0x5b, 0x82, 0xff, 0x01, 0x00, 0x08, 0xd0, 0xa0, 0x84, 0x04,
+ 0x72, 0x80, 0xe5, 0x00, 0x00, 0x08, 0xd2, 0x20, 0x44, 0x04, 0xca, 0x02,
+ 0xff, 0x00, 0x00, 0x08, 0xde, 0xa0, 0x44, 0x04, 0x82, 0x02, 0x6d, 0x00,
+ 0x00, 0x08, 0xf6, 0xb0, 0x40, 0x02, 0x82, 0x07, 0x3f, 0x00, 0x00, 0x08,
+ 0x44, 0x58, 0x44, 0x02, 0x93, 0x3f, 0x1f, 0x00, 0x00, 0x30, 0x88, 0x4f,
+ 0x44, 0x03, 0x83, 0x23, 0x3e, 0x00, 0x00, 0x00, 0x18, 0x60, 0xe0, 0x07,
+ 0xe3, 0x0f, 0xfe, 0x00, 0x00, 0x00, 0x70, 0x70, 0xe4, 0x07, 0xc7, 0x1b,
+ 0xfe, 0x01, 0x00, 0x00, 0xe0, 0x3c, 0xe4, 0x07, 0xc7, 0xe3, 0xfe, 0x1f,
+ 0x00, 0x00, 0xff, 0x1f, 0xfc, 0x07, 0xc7, 0x03, 0xf8, 0x33, 0x00, 0xc0,
+ 0xf0, 0x07, 0xff, 0x07, 0x87, 0x02, 0xfc, 0x43, 0x00, 0x60, 0xf0, 0xff,
+ 0xff, 0x07, 0x8f, 0x06, 0xbe, 0x87, 0x00, 0x30, 0xf8, 0xff, 0xff, 0x07,
+ 0x8f, 0x14, 0x9c, 0x8f, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x07, 0x9f, 0x8d,
+ 0x8a, 0x0f, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x07, 0xbf, 0x0b, 0x80, 0x1f,
+ 0x00, 0x00, 0xff, 0xff, 0xff, 0x07, 0x7f, 0x3a, 0x80, 0x3f, 0x00, 0x80,
+ 0xff, 0xff, 0xff, 0x07, 0xff, 0x20, 0xc0, 0x3f, 0x00, 0x80, 0xff, 0xff,
+ 0xff, 0x07, 0xff, 0x01, 0xe0, 0x7f, 0x00, 0xc0, 0xff, 0xff, 0xff, 0x07,
+ 0xff, 0x0f, 0xf8, 0xff, 0x40, 0xe0, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff,
+ 0xff, 0xff, 0x40, 0xf0, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff,
+ 0x41, 0xf0, 0xff, 0xff, 0xff, 0x07};
+
+class MyWidget: public Fl_Box{
+protected:
+ void draw(){
+ Fl_Box::draw();
+ fl_color(FL_RED);
+ fl_rectf(x()+5,y()+5,w()-10,h()-10);
+ fl_push_clip(x()+6,y()+6,w()-12,h()-12);
+ fl_color(FL_DARK_GREEN);
+ fl_rectf(x()+5,y()+5,w()-10,h()-10);
+ fl_pop_clip();
+ fl_color(FL_YELLOW);
+ fl_rectf(x()+7,y()+7,w()-14,h()-14);
+ fl_color(FL_BLUE);
+
+ fl_rect(x()+8,y()+8,w()-16,h()-16);
+ fl_push_clip(x()+25,y()+25,w()-50, h()-50);
+ fl_color(FL_BLACK);
+ fl_rect(x()+24,y()+24,w()-48,h()-48);
+ fl_line(x()+27,y()+27,x()+w()-27,y()+h()-27);
+ fl_line(x()+27,y()+h()-27,x()+w()-27,y()+27);
+ //fl_rect(x()+30,y()+30,w()-60,h()-60);
+ fl_pop_clip();
+
+ }
+public:
+ MyWidget(int x, int y):Fl_Box(x,y,100,100, "Clipping and rect(f):\nYellow rect.framed\nby B-Y-G-R rect. 1 p.\nthick. Your printer may \nrender very thin lines\nsurrounding \"X\""){
+ align(FL_ALIGN_TOP);
+ labelsize(10);
+ };
+};
+
+
+class MyWidget2: public Fl_Box{
+protected:
+ void draw(){
+ Fl_Box::draw();
+ int d;
+// fl_line_style(0);
+ for(d=y()+5;d<48+y();d+=2){
+ fl_xyline(x()+5,d,x()+48);
+ }
+
+
+
+ fl_push_clip(x()+52,y()+5,45,43);
+ for(d=y()+5;d<150+y();d+=3){
+ fl_line(x()+52,d,x()+92,d-40);
+ }
+ fl_pop_clip();
+
+
+
+
+
+
+
+
+ fl_line_style(FL_DASH);
+ fl_xyline(x()+5,y()+55,x()+48);
+ fl_line_style(FL_DOT);
+ fl_xyline(x()+5,y()+58,x()+48);
+ fl_line_style(FL_DASHDOT);
+ fl_xyline(x()+5,y()+61,x()+48);
+ fl_line_style(FL_DASHDOTDOT);
+ fl_xyline(x()+5,y()+64,x()+48);
+ fl_line_style(0,0,"\7\3\7\2");
+ fl_xyline(x()+5,y()+67,x()+48);
+
+
+
+
+
+
+ fl_line_style(0);
+
+
+
+
+ fl_line(x()+5,y()+72,x()+25,y()+95);
+ fl_line(x()+8,y()+72,x()+28,y()+95,x()+31,y()+72);
+
+ fl_color(FL_YELLOW);
+ fl_polygon(x()+11, y()+72,x()+27,y()+91,x()+29,y()+72);
+ fl_color(FL_RED);
+ fl_loop(x()+11, y()+72,x()+27,y()+91,x()+29,y()+72);
+
+ fl_color(FL_BLUE); ////
+ fl_line_style(FL_SOLID, 6);
+ fl_loop(x()+31, y()+12,x()+47,y()+31,x()+49,y()+12);
+ fl_line_style(0);
+
+
+ fl_color(200,0,200);
+ fl_polygon(x()+35,y()+72,x()+33,y()+95,x()+48,y()+95,x()+43,y()+72);
+ fl_color(FL_GREEN);
+ fl_loop(x()+35,y()+72,x()+33,y()+95,x()+48,y()+95,x()+43,y()+72);
+
+
+
+ fl_color(FL_BLUE);
+ fl_yxline(x()+65,y()+63,y()+66);
+ fl_color(FL_GREEN);
+ fl_yxline(x()+66,y()+66,y()+63);
+
+ fl_color(FL_BLUE);
+ fl_rect(x()+80,y()+55,5,5);
+ fl_color(FL_YELLOW);
+ fl_rectf(x()+81,y()+56,3,3);
+ fl_color(FL_BLACK);
+ fl_point(x()+82,y()+57);
+
+ fl_color(FL_BLUE);
+ fl_rect(x()+56, y()+79, 24, 17);
+ fl_color(FL_CYAN);
+ fl_rectf(x()+57, y()+80, 22 , 15 );
+ fl_color(FL_RED);
+ fl_arc(x()+57, y()+80, 22 ,15 ,40, 270);
+ fl_color(FL_YELLOW);
+ fl_pie(x()+58, y()+81, 20 ,13 ,40, 270);
+
+
+
+
+ fl_line_style(0);
+
+
+ fl_color(FL_BLACK);
+ fl_point(x()+58,y()+58);
+ fl_color(FL_RED);
+ fl_yxline(x()+59,y()+58,y()+59);
+ fl_color(FL_GREEN);
+ fl_yxline(x()+60,y()+59,y()+58);
+ fl_color(FL_BLACK);
+ fl_xyline(x()+61,y()+58,x()+62);
+ fl_color(FL_RED);
+ fl_xyline(x()+62,y()+59,x()+61);
+
+ fl_color(FL_GREEN);
+ fl_yxline(x()+57,y()+58,y()+59,x()+58);
+ fl_color(FL_BLUE);
+ fl_xyline(x()+58,y()+60,x()+56,y()+58);
+ fl_color(FL_RED);
+ fl_xyline(x()+58,y()+61,x()+56,y()+63);
+ fl_color(FL_GREEN);
+ fl_yxline(x()+57,y()+63,y()+62,x()+58);
+
+ fl_color(FL_BLUE);
+ fl_line(x()+58,y()+63, x()+60, y()+65);
+ fl_color(FL_BLACK);
+ fl_line(x()+61,y()+65, x()+59, y()+63);
+
+
+
+
+
+
+
+
+
+ fl_color(FL_BLACK);
+ };
+
+public:
+ MyWidget2(int x, int y):Fl_Box(x,y,100,100, "Integer primitives"){
+ labelsize(10);
+ align(FL_ALIGN_TOP);
+ };
+};
+
+
+class MyWidget3: public Fl_Box{
+protected:
+ void draw(){
+ Fl_Box::draw();
+ double d;
+// fl_line_style(0);
+ fl_push_clip(x()+5,y()+5,45,43);
+ for(d=y()+5;d<95+y();d+=1.63){
+ fl_begin_line();
+ fl_vertex(x()+5,d);
+ fl_vertex(x()+48,d);
+ fl_end_line();
+ }
+ fl_pop_clip();
+
+ fl_push_clip(x()+52,y()+5,45,43);
+ for(d=y()+5;d<150+y();d+=2.3052){
+ fl_begin_line();
+ fl_vertex(x()+52,d);
+ fl_vertex(x()+92,d-43);
+ fl_end_line();
+ }
+ fl_pop_clip();
+
+ };
+public:
+ MyWidget3(int x, int y):Fl_Box(x,y,100,100, "Sub-pixel drawing of\nlines 1.63 points apart\nOn the screen you\ncan see aliasing, the\nprinter should render\nthem properly"){
+ labelsize(10);
+ align(FL_ALIGN_TOP);
+ };
+};
+
+
+
+class MyWidget4: public Fl_Box{
+protected:
+ void draw(){
+ Fl_Box::draw();
+ fl_push_matrix();
+ fl_translate(x(),y());
+ fl_scale(.75,.75);
+
+
+
+ fl_line_style(FL_SOLID , 5);
+ fl_begin_line();
+ fl_vertex(10, 160);
+ fl_vertex(40, 160);
+ fl_vertex(40, 190);
+ fl_end_line();
+ fl_line_style(0);
+
+
+ fl_color(FL_RED);
+ fl_line_style(FL_SOLID | FL_CAP_FLAT |FL_JOIN_MITER , 5);
+ fl_begin_line();
+ fl_vertex(10, 150);
+ fl_vertex(50, 150);
+ fl_vertex(50, 190);
+ fl_end_line();
+ fl_line_style(0);
+
+ fl_color(FL_GREEN);
+ fl_line_style(FL_SOLID | FL_CAP_ROUND |FL_JOIN_ROUND , 5);
+ fl_begin_line();
+ fl_vertex(10, 140);
+ fl_vertex(60, 140);
+ fl_vertex(60, 190);
+ fl_end_line();
+ fl_line_style(0);
+
+ fl_color(FL_BLUE);
+ fl_line_style(FL_SOLID | FL_CAP_SQUARE |FL_JOIN_BEVEL , 5);
+ fl_begin_line();
+ fl_vertex(10, 130);
+ fl_vertex(70, 130);
+ fl_vertex(70, 190);
+ fl_end_line();
+ fl_line_style(0);
+
+ fl_color(FL_BLACK);
+ fl_line_style(FL_DASH , 5);
+ fl_begin_line();
+ fl_vertex(10, 120);
+ fl_vertex(80, 120);
+ fl_vertex(80, 190);
+ fl_end_line();
+ fl_line_style(0);
+
+ fl_color(FL_RED);
+ fl_line_style(FL_DASH |FL_CAP_FLAT , 5);
+ fl_begin_line();
+ fl_vertex(10, 110);
+ fl_vertex(90, 110);
+ fl_vertex(90, 190);
+ fl_end_line();
+ fl_line_style(0);
+
+ fl_color(FL_GREEN);
+ fl_line_style(FL_DASH |FL_CAP_ROUND , 5);
+ fl_begin_line();
+ fl_vertex(10, 100);
+ fl_vertex(100, 100);
+ fl_vertex(100, 190);
+ fl_end_line();
+ fl_line_style(0);
+
+
+ fl_color(FL_BLUE);
+ fl_line_style(FL_DASH |FL_CAP_SQUARE , 5);
+ fl_begin_line();
+ fl_vertex(10, 90);
+ fl_vertex(110, 90);
+ fl_vertex(110, 190);
+ fl_end_line();
+ fl_line_style(0);
+
+ fl_color(FL_BLACK);
+ fl_line_style(FL_DOT, 5);
+ fl_begin_line();
+ fl_vertex(10, 80);
+ fl_vertex(120, 80);
+ fl_vertex(120, 190);
+ fl_end_line();
+ fl_line_style(0);
+
+ fl_color(FL_RED);
+ fl_line_style(FL_DOT | FL_CAP_FLAT, 5);
+ fl_begin_line();
+ fl_vertex(10, 70);
+ fl_vertex(130, 70);
+ fl_vertex(130, 190);
+ fl_end_line();
+ fl_line_style(0);
+
+ fl_color(FL_GREEN);
+ fl_line_style(FL_DOT | FL_CAP_ROUND, 5);
+ fl_begin_line();
+ fl_vertex(10, 60);
+ fl_vertex(140, 60);
+ fl_vertex(140, 190);
+ fl_end_line();
+ fl_line_style(0);
+
+ fl_color(FL_BLUE);
+ fl_line_style(FL_DOT | FL_CAP_SQUARE, 5);
+ fl_begin_line();
+ fl_vertex(10, 50);
+ fl_vertex(150, 50);
+ fl_vertex(150, 190);
+ fl_end_line();
+ fl_line_style(0);
+
+ fl_color(FL_BLACK);
+ fl_line_style(FL_DASHDOT |FL_CAP_ROUND |FL_JOIN_ROUND , 5);
+ fl_begin_line();
+ fl_vertex(10, 40);
+ fl_vertex(160, 40);
+ fl_vertex(160, 190);
+ fl_end_line();
+ fl_line_style(0);
+
+ fl_color(FL_RED);
+ fl_line_style(FL_DASHDOTDOT |FL_CAP_SQUARE |FL_JOIN_BEVEL , 5);
+ fl_begin_line();
+ fl_vertex(10, 30);
+ fl_vertex(170, 30);
+ fl_vertex(170, 190);
+ fl_end_line();
+ fl_line_style(0);
+
+
+ fl_color(FL_GREEN);
+ fl_line_style(FL_DASHDOTDOT |FL_CAP_ROUND |FL_JOIN_ROUND , 5);
+ fl_begin_line();
+ fl_vertex(10, 20);
+ fl_vertex(180, 20);
+ fl_vertex(180, 190);
+ fl_end_line();
+ fl_line_style(0);
+
+
+ fl_color(FL_BLUE);
+ fl_line_style(0, 5, "\12\3\4\2\2\1");
+ fl_begin_line();
+ fl_vertex(10, 10);
+ fl_vertex(190, 10);
+ fl_vertex(190, 190);
+
+ fl_end_line();
+ fl_line_style(0);
+ fl_pop_matrix();
+
+ fl_color(FL_BLACK);
+
+
+
+
+ };
+public:
+ MyWidget4(int x, int y):Fl_Box(x,y,150,150, "Line styles"){
+ labelsize(10);
+ align(FL_ALIGN_TOP);
+ };
+};
+
+
+class MyWidget5: public Fl_Box{
+protected:
+ void draw(){
+ Fl_Box::draw();
+ //fl_push_clip(x(),y(),w(),h());
+ fl_push_matrix();
+
+
+ fl_translate(x(),y());
+ fl_push_matrix();
+ fl_mult_matrix(1,3,0,1,0,-20);
+ fl_color(FL_GREEN);
+ fl_begin_polygon();
+ fl_vertex(10,10);
+ fl_vertex(100,-80);
+ fl_vertex(100,-190);
+ fl_end_polygon();
+
+ fl_color(FL_RED);
+ fl_line_style(FL_DASHDOT, 7);
+ fl_begin_loop();
+
+
+ fl_vertex(10,10);
+ fl_vertex(100,-80);
+ fl_vertex(100,-190);
+ fl_end_loop();
+ fl_line_style(0);
+
+ fl_color(FL_BLUE);
+ fl_line_style(FL_SOLID, 3);
+ fl_begin_loop();
+ fl_circle(60,-50,30);
+ fl_end_loop();
+ fl_line_style(0);
+
+ fl_pop_matrix();
+ fl_scale(1.8,1);
+
+ fl_color(FL_YELLOW);
+ fl_begin_polygon();
+ fl_arc(30,90,20,-45,200);
+ fl_end_polygon();
+
+ fl_color(FL_BLACK);
+ fl_line_style(FL_DASH, 3);
+ fl_begin_line();
+ fl_arc(30,90,20,-45,200);
+ fl_end_line();
+ fl_line_style(0);
+
+ fl_translate(15,0);
+ fl_scale(1.5,3);
+ fl_begin_complex_polygon();
+ fl_vertex(30,70);
+ fl_arc(45,55,10,200,90);
+ fl_arc(55,45,8,-170,20);
+ fl_vertex(60,40);
+ fl_vertex(30,20);
+ fl_vertex(40,5);
+ fl_vertex(60,25);
+ //fl_vertex(50,50);
+ fl_curve(35,30,30,53,0,35,65,65);
+ fl_gap();
+ fl_vertex(50,25);
+ fl_vertex(40,10);
+ fl_vertex(35,20);
+ fl_end_complex_polygon();
+
+ fl_pop_matrix();
+
+// fl_color(FL_BLACK);
+// fl_line_style(0);
+ //fl_pop_clip();
+
+
+
+ };
+public:
+ MyWidget5(int x, int y):Fl_Box(x,y,230,250, "Complex (double) drawings:\nBlue ellipse may not be\ncorrectly transformed\ndue to non-orthogonal\ntransformation"){
+ labelsize(10);
+ align(FL_ALIGN_TOP);
+ };
+};
+
+
+uchar *image;
+int width = 80;
+int height = 80;
+
+void make_image() {
+ image = new uchar[4*width*height];
+ uchar *p = image;
+ for (int y = 0; y < height; y++) {
+ double Y = double(y)/(height-1);
+ for (int x = 0; x < width; x++) {
+ double X = double(x)/(width-1);
+ *p++ = uchar(255*((1-X)*(1-Y))); // red in upper-left
+ *p++ = uchar(255*((1-X)*Y)); // green in lower-left
+ *p++ = uchar(255*(X*Y)); // blue in lower-right
+ X -= 0.5;
+ Y -= 0.5;
+ int alpha = (int)(350 * sqrt(X * X + Y * Y));
+ if (alpha < 255) *p++ = uchar(alpha); // alpha transparency
+ else *p++ = 255;
+ Y += 0.5;
+ }
+ }
+}
+
+
+void print(Fl_Widget *, void *w) {
+ Fl_Widget * g = (Fl_Widget *)w;
+
+ //Fl_Printer * p = new Fl_PS_Printer(f, 3);
+ Fl_Printer * p = new Fl_Printer();
+ //p->page(Fl_Printer::A4);
+ //p->place(g, 70, 70, p->page_width() - 140, p->page_height() - 140, FL_ALIGN_CENTER);
+ if (!p->start_job(1)) {
+ p->start_page();
+ p->print_widget(g);
+ p->end_page();
+ p->end_job();
+ }
+ delete p;
+};
+
+/*void print2(Fl_Widget *, void *w) {
+ Fl_Widget * g = (Fl_Widget *)w;
+ Fl_Printer * p = fl_printer_chooser();
+ if(!p) return;
+ p->page(Fl_Printer::A4);
+ // fitting inside margins 1 inch wide
+ p->place(g, FL_INCH, FL_INCH, p->page_width() - 2 * FL_INCH, p->page_height() - 2 * FL_INCH, FL_ALIGN_CENTER);
+ Fl_Device * c = p->set_current();
+ fl_draw(g);
+ c->set_current();
+ delete p;
+};*/
+
+
+class My_Button:public Fl_Button{
+protected:
+ void draw(){
+ // Fl_Button::draw();
+ if (type() == FL_HIDDEN_BUTTON) return;
+ Fl_Color col = value() ? selection_color() : color();
+ draw_box(value() ? (down_box()?down_box():fl_down(box())) : box(), col);
+ fl_color(FL_WHITE);
+ fl_line_style(FL_SOLID,5);
+ fl_line(x()+15,y()+10,x()+w()-15,y()+h()-23);
+ fl_line(x()+w()-15,y()+10,x()+15,y()+h()-23);
+ fl_line_style(0);
+ draw_label();
+
+ };
+public:
+ My_Button(int x, int y, int w, int h, const char * label = 0):Fl_Button(x,y,w,h,label){}
+};
+
+
+int main(int argc, char ** argv) {
+
+ //Fl::scheme("plastic");
+
+
+
+ Fl_Window * w2 = new Fl_Window(500,560,"Graphics test");
+
+
+ Fl_Group *c2 =new Fl_Group(3, 43, 494, 514 );
+
+ new MyWidget(10,140);
+ new MyWidget2(110,80);
+ new MyWidget3(220,140);
+ new MyWidget4(330,70);
+ new MyWidget5(140,270);
+
+ make_image();
+ Fl_RGB_Image *rgb = new Fl_RGB_Image(image, width, height, 4);
+ My_Button b_rgb(10,245,100,100,"RGB with alpha");
+ b_rgb.image(rgb);
+
+ My_Button b_pixmap(10,345,100,100,"Pixmap");
+ Fl_Pixmap *pixmap = new Fl_Pixmap(porsche_xpm);
+ b_pixmap.image(pixmap);
+
+ My_Button b_bitmap(10,445,100,100,"Bitmap");
+b_bitmap.labelcolor(FL_GREEN);
+ b_bitmap.image(new Fl_Bitmap(sorceress_bits,sorceress_width,sorceress_height));
+
+ new Fl_Clock(360,230,120,120);
+ Fl_Return_Button * ret = new Fl_Return_Button (360, 360, 120,30, "Return");
+ ret->deactivate();
+ Fl_Button but1(360, 390, 30, 30, "@->|");
+ but1.labelcolor(FL_DARK3);
+ Fl_Button but2(390, 390, 30, 30, "@UpArrow");
+ but2.labelcolor(FL_DARK3);
+ Fl_Button but3(420, 390, 30, 30, "@DnArrow");
+ but3.labelcolor(FL_DARK3);
+ Fl_Button but4(450, 390, 30, 30, "@+");
+ but4.labelcolor(FL_DARK3);
+ Fl_Button but5(360, 425, 120, 30, "Hello, World");
+ but5.labelfont(FL_BOLD|FL_ITALIC);
+ but5.labeltype(FL_SHADOW_LABEL);
+ but5.box(FL_ROUND_UP_BOX);
+// but5.selection_color(FL_WHITE);
+
+ Fl_Button but6(360, 460, 120, 30, "Plastic");
+ but6.box(FL_PLASTIC_UP_BOX);
+
+ //Fl_Button but7(, 480, 120, 30, "Engraved box");
+ //but7.box(FL_ENGRAVED_BOX);
+ { Fl_Group* o = new Fl_Group(360, 495, 120, 40);
+ o->box(FL_UP_BOX);
+ { Fl_Group* o = new Fl_Group(365, 500, 110, 30);
+ o->box(FL_THIN_UP_FRAME);
+ { Fl_Round_Button* o = new Fl_Round_Button(365, 500, 40, 30, "rad");
+ o->value(1);
+ }
+ { Fl_Check_Button* o = new Fl_Check_Button(410, 500, 60, 30, "check");
+ o->value(1);
+
+ }
+ o->end();
+ }
+ o->end();
+ o->deactivate();
+ }
+ Fl_Box tx(120,492,230,50,"Background is not printed because\nencapsulating group, which we are\n printing, has not set the box type");
+ tx.box(FL_SHADOW_BOX);
+ tx.labelsize(12);
+
+
+
+ c2->end();
+ Fl_Button *b4 = new Fl_Button(10,5, 150, 25, "Print");
+ b4->callback(print,c2);
+ /*Fl_Button *b5 = new Fl_Button(165,5, 90, 25, "Print");
+ b5->tooltip("This is a tooltip");
+ b5->callback(print2,c2);*/
+
+ w2->end();
+ w2->show(argc, argv);
+
+
+ Fl::run();
+ return 0;
+};
diff --git a/test/glpuzzle.cxx b/test/glpuzzle.cxx
index 8a4d57b20..7b8a64d1a 100644
--- a/test/glpuzzle.cxx
+++ b/test/glpuzzle.cxx
@@ -1420,9 +1420,38 @@ menu(int choice)
}
}
+// added to demo printing
+#include <FL/Fl_Sys_Menu_Bar.H>
+#include <FL/Fl_Gl_Printer.H>
+
+void print_cb(Fl_Widget *w, void *data)
+{
+ Fl_Gl_Printer printer;
+ Fl_Window *win = Fl::first_window();
+ if(!win) return;
+ if( printer.start_job(1) ) return;
+ if( printer.start_page() ) return;
+ printer.scale(0.68,0.68);
+ printer.print_gl_window( (Fl_Gl_Window*)win );
+ printer.end_page();
+ printer.end_job();
+}
+// end of printing demo
+
int
main(int argc, char **argv)
{
+ // added to demo printing
+ static Fl_Menu_Item items[] = {
+ { "Menu", 0, 0, 0, FL_SUBMENU },
+ { "Print", 0, print_cb, 0, 0 },
+ { 0 },
+ { 0 }
+ };
+ Fl_Sys_Menu_Bar *menubar_;
+ menubar_ = new Fl_Sys_Menu_Bar(0, 0, 1, 25);
+ menubar_->menu(items);
+ // end of printing demo
long i;
glutInit(&argc, argv);
diff --git a/test/image.cxx b/test/image.cxx
index 64f339c8c..48d4284b5 100644
--- a/test/image.cxx
+++ b/test/image.cxx
@@ -124,6 +124,7 @@ int main(int argc, char **argv) {
Fl_Double_Window window(400,400); ::w = &window;
window.color(FL_WHITE);
Fl_Button b(140,160,120,120,"Image w/Alpha"); ::b = &b;
+ b.color(FL_YELLOW);
Fl_RGB_Image *rgb;
Fl_Image *dergb;
diff --git a/test/makedepend b/test/makedepend
index 3120d1d39..700d654a3 100644
--- a/test/makedepend
+++ b/test/makedepend
@@ -7,10 +7,11 @@ unittests.o: ../FL/Fl_Group.H ../FL/Fl_Widget.H ../FL/Fl_Hold_Browser.H
unittests.o: ../FL/Fl_Browser.H ../FL/Fl_Browser_.H ../FL/Fl_Scrollbar.H
unittests.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H ../FL/Fl_Image.H
unittests.o: ../FL/Fl_Help_View.H ../FL/Fl.H ../FL/fl_draw.H
-unittests.o: ../FL/Fl_Shared_Image.H ../FL/Fl_Group.H ../FL/Fl_Box.H
-unittests.o: ../FL/fl_draw.H unittest_about.cxx unittest_points.cxx
-unittests.o: unittest_lines.cxx unittest_rects.cxx unittest_circles.cxx
-unittests.o: unittest_text.cxx unittest_images.cxx unittest_viewport.cxx
+unittests.o: ../FL/Fl_Device.H ../FL/x.H ../FL/Fl_Shared_Image.H
+unittests.o: ../FL/Fl_Group.H ../FL/Fl_Box.H ../FL/fl_draw.H
+unittests.o: unittest_about.cxx unittest_points.cxx unittest_lines.cxx
+unittests.o: unittest_rects.cxx unittest_circles.cxx unittest_text.cxx
+unittests.o: unittest_images.cxx unittest_viewport.cxx
unittests.o: unittest_scrollbarsize.cxx ../FL/Fl_Browser.H
unittests.o: ../FL/Fl_Value_Slider.H
adjuster.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
@@ -116,6 +117,10 @@ cube.o: ../FL/fl_types.h ../FL/Fl_Window.H ../FL/Fl_Group.H ../FL/Fl_Widget.H
cube.o: ../FL/Fl_Box.H ../FL/Fl_Button.H ../FL/Fl_Radio_Light_Button.H
cube.o: ../FL/Fl_Light_Button.H ../FL/Fl_Button.H ../FL/Fl_Slider.H
cube.o: ../FL/Fl_Valuator.H ../FL/Fl_Gl_Window.H ../FL/Fl_Window.H ../FL/gl.h
+cube.o: ../FL/Fl_Sys_Menu_Bar.H ../FL/Fl_Menu_Bar.H ../FL/Fl_Menu_.H
+cube.o: ../FL/Fl_Menu_Item.H ../FL/Fl_Image.H ../FL/x.H ../FL/Fl_Gl_Printer.H
+cube.o: ../FL/Fl_Printer.H ../FL/Fl_Device.H ../FL/x.H ../FL/fl_draw.H
+cube.o: ../FL/Fl_Pixmap.H ../FL/Fl_RGB_Image.H ../FL/Fl_Bitmap.H
CubeMain.o: ../config.h ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
CubeMain.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
CubeMain.o: ../FL/Fl_Export.H ../FL/fl_types.h CubeViewUI.h
@@ -148,6 +153,23 @@ demo.o: ../FL/Fl_Double_Window.H ../FL/Fl_Window.H ../FL/Fl_Group.H
demo.o: ../FL/Fl_Widget.H ../FL/Fl_Box.H ../FL/Fl_Button.H ../FL/Fl_Choice.H
demo.o: ../FL/Fl_Menu_.H ../FL/Fl_Menu_Item.H ../FL/Fl_Image.H
demo.o: ../FL/filename.H ../FL/x.H
+device.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
+device.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
+device.o: ../FL/fl_types.h ../FL/Fl_Overlay_Window.H ../FL/Fl_Double_Window.H
+device.o: ../FL/Fl_Window.H ../FL/Fl_Group.H ../FL/Fl_Widget.H
+device.o: ../FL/Fl_Light_Button.H ../FL/fl_draw.H ../FL/Fl_Clock.H
+device.o: ../test/pixmaps/porsche.xpm ../FL/Fl_Pixmap.H ../FL/Fl_Image.H
+device.o: ../FL/Fl_Bitmap.H ../FL/Fl_Round_Button.H ../FL/Fl_Light_Button.H
+device.o: ../FL/Fl_Button.H ../FL/Fl_Printer.H ../FL/Fl_Device.H ../FL/x.H
+device.o: ../FL/Fl_RGB_Image.H ../FL/Fl_File_Chooser.H
+device.o: ../FL/Fl_Double_Window.H ../FL/Fl_Group.H ../FL/Fl_Choice.H
+device.o: ../FL/Fl_Menu_.H ../FL/Fl_Menu_Item.H ../FL/Fl_Menu_Button.H
+device.o: ../FL/Fl_Button.H ../FL/Fl_Preferences.H ../FL/Fl_Tile.H
+device.o: ../FL/Fl_File_Browser.H ../FL/Fl_Browser.H ../FL/Fl_Browser_.H
+device.o: ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H ../FL/Fl_Valuator.H
+device.o: ../FL/Fl_File_Icon.H ../FL/Fl.H ../FL/filename.H ../FL/Fl_Box.H
+device.o: ../FL/Fl_Check_Button.H ../FL/Fl_File_Input.H ../FL/Fl_Input.H
+device.o: ../FL/Fl_Input_.H ../FL/Fl_Return_Button.H ../FL/fl_ask.H
doublebuffer.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
doublebuffer.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
doublebuffer.o: ../FL/fl_types.h ../FL/Fl_Single_Window.H ../FL/Fl_Window.H
@@ -168,7 +190,7 @@ editor.o: ../FL/Fl_Check_Button.H ../FL/Fl_Light_Button.H ../FL/Fl_Button.H
editor.o: ../FL/Fl_File_Input.H ../FL/Fl_Input.H ../FL/Fl_Input_.H
editor.o: ../FL/Fl_Return_Button.H ../FL/Fl_Menu_Bar.H ../FL/Fl_Text_Buffer.H
editor.o: ../FL/Fl_Text_Editor.H ../FL/Fl_Text_Display.H ../FL/fl_draw.H
-editor.o: ../FL/Fl_Text_Buffer.H
+editor.o: ../FL/Fl_Device.H ../FL/x.H ../FL/Fl_Text_Buffer.H
fast_slow.o: fast_slow.h ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
fast_slow.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
fast_slow.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Fl_Double_Window.H
@@ -200,13 +222,13 @@ fonts.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H ../FL/Fl_Image.H
fonts.o: ../FL/fl_draw.H ../FL/Fl_Box.H ../FL/fl_ask.H
forms.o: ../FL/forms.H ../FL/Fl.H ../FL/Fl_Group.H ../FL/Fl_Widget.H
forms.o: ../FL/Enumerations.H ../FL/Fl_Export.H ../FL/fl_types.h
-forms.o: ../FL/Fl_Window.H ../FL/fl_draw.H ../FL/Fl_FormsBitmap.H
-forms.o: ../FL/Fl_Bitmap.H ../FL/Fl_Image.H ../FL/Fl_FormsPixmap.H
-forms.o: ../FL/Fl_Pixmap.H ../FL/Fl_Box.H ../FL/Fl_Browser.H
-forms.o: ../FL/Fl_Browser_.H ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H
-forms.o: ../FL/Fl_Valuator.H ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
-forms.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Fl_Button.H
-forms.o: ../FL/Fl_Light_Button.H ../FL/Fl_Round_Button.H
+forms.o: ../FL/Fl_Window.H ../FL/fl_draw.H ../FL/Fl_Device.H ../FL/x.H
+forms.o: ../FL/Xutf8.h ../FL/Fl_FormsBitmap.H ../FL/Fl_Bitmap.H
+forms.o: ../FL/Fl_Image.H ../FL/Fl_FormsPixmap.H ../FL/Fl_Pixmap.H
+forms.o: ../FL/Fl_Box.H ../FL/Fl_Browser.H ../FL/Fl_Browser_.H
+forms.o: ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H ../FL/Fl_Valuator.H
+forms.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
+forms.o: ../FL/Fl_Button.H ../FL/Fl_Light_Button.H ../FL/Fl_Round_Button.H
forms.o: ../FL/Fl_Check_Button.H ../FL/Fl_Chart.H ../FL/Fl_Choice.H
forms.o: ../FL/Fl_Menu_.H ../FL/Fl_Menu_Item.H ../FL/Fl_Clock.H
forms.o: ../FL/Fl_Counter.H ../FL/Fl_Dial.H ../FL/Fl_Free.H ../FL/fl_ask.H
@@ -242,6 +264,11 @@ glpuzzle.o: ../config.h ../FL/glut.H ../FL/gl.h ../FL/Enumerations.H
glpuzzle.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Fl.H
glpuzzle.o: ../FL/Fl_Gl_Window.H ../FL/Fl_Window.H ../FL/Fl_Group.H
glpuzzle.o: ../FL/Fl_Widget.H ../FL/glu.h trackball.c trackball.h
+glpuzzle.o: ../FL/Fl_Sys_Menu_Bar.H ../FL/Fl_Menu_Bar.H ../FL/Fl_Menu_.H
+glpuzzle.o: ../FL/Fl_Menu_Item.H ../FL/Fl_Image.H ../FL/x.H ../FL/Xutf8.h
+glpuzzle.o: ../FL/Fl_Gl_Printer.H ../FL/Fl_Printer.H ../FL/Fl_Device.H
+glpuzzle.o: ../FL/x.H ../FL/fl_draw.H ../FL/Fl_Pixmap.H ../FL/Fl_RGB_Image.H
+glpuzzle.o: ../FL/Fl_Bitmap.H ../FL/Fl_Gl_Window.H
hello.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
hello.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
hello.o: ../FL/fl_types.h ../FL/Fl_Window.H ../FL/Fl_Group.H
@@ -253,7 +280,7 @@ help.o: ../FL/Fl_Group.H ../FL/Fl_Widget.H ../FL/Fl_Group.H ../FL/Fl_Button.H
help.o: ../FL/Fl_Input.H ../FL/Fl_Input_.H ../FL/Fl_Box.H
help.o: ../FL/Fl_Help_View.H ../FL/Fl.H ../FL/Fl_Scrollbar.H
help.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H ../FL/fl_draw.H
-help.o: ../FL/Fl_Shared_Image.H ../FL/Fl_Image.H
+help.o: ../FL/Fl_Device.H ../FL/x.H ../FL/Fl_Shared_Image.H ../FL/Fl_Image.H
iconize.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
iconize.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
iconize.o: ../FL/fl_types.h ../FL/Fl_Window.H ../FL/Fl_Group.H
@@ -323,6 +350,9 @@ mandelbrot.o: ../FL/Fl_Export.H ../FL/fl_types.h mandelbrot.h ../FL/Fl_Box.H
mandelbrot.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H ../FL/Fl_Double_Window.H
mandelbrot.o: ../FL/Fl_Window.H ../FL/Fl_Group.H ../FL/Fl_Widget.H
mandelbrot.o: ../FL/Fl_Input.H ../FL/Fl_Input_.H ../FL/fl_draw.H
+mandelbrot.o: ../FL/Fl_Button.H ../FL/Fl_Printer.H ../FL/Fl_Device.H
+mandelbrot.o: ../FL/x.H ../FL/Fl_Pixmap.H ../FL/Fl_Image.H
+mandelbrot.o: ../FL/Fl_RGB_Image.H ../FL/Fl_Bitmap.H
menubar.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
menubar.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
menubar.o: ../FL/fl_types.h ../FL/Fl_Box.H ../FL/Fl_Double_Window.H
@@ -418,6 +448,23 @@ preferences.o: ../FL/Fl_Round_Button.H ../FL/Fl_Light_Button.H
preferences.o: ../FL/Fl_Button.H ../FL/Fl_Box.H ../FL/Fl_Check_Button.H
preferences.o: ../FL/Fl_Value_Slider.H ../FL/Fl_Slider.H ../FL/Fl_Valuator.H
preferences.o: ../FL/filename.H ../FL/fl_ask.H
+device.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
+device.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
+device.o: ../FL/fl_types.h ../FL/Fl_Overlay_Window.H ../FL/Fl_Double_Window.H
+device.o: ../FL/Fl_Window.H ../FL/Fl_Group.H ../FL/Fl_Widget.H
+device.o: ../FL/Fl_Light_Button.H ../FL/fl_draw.H ../FL/Fl_Clock.H
+device.o: ../test/pixmaps/porsche.xpm ../FL/Fl_Pixmap.H ../FL/Fl_Image.H
+device.o: ../FL/Fl_Bitmap.H ../FL/Fl_Round_Button.H ../FL/Fl_Light_Button.H
+device.o: ../FL/Fl_Button.H ../FL/Fl_Printer.H ../FL/Fl_Device.H ../FL/x.H
+device.o: ../FL/Fl_RGB_Image.H ../FL/Fl_File_Chooser.H
+device.o: ../FL/Fl_Double_Window.H ../FL/Fl_Group.H ../FL/Fl_Choice.H
+device.o: ../FL/Fl_Menu_.H ../FL/Fl_Menu_Item.H ../FL/Fl_Menu_Button.H
+device.o: ../FL/Fl_Button.H ../FL/Fl_Preferences.H ../FL/Fl_Tile.H
+device.o: ../FL/Fl_File_Browser.H ../FL/Fl_Browser.H ../FL/Fl_Browser_.H
+device.o: ../FL/Fl_Scrollbar.H ../FL/Fl_Slider.H ../FL/Fl_Valuator.H
+device.o: ../FL/Fl_File_Icon.H ../FL/Fl.H ../FL/filename.H ../FL/Fl_Box.H
+device.o: ../FL/Fl_Check_Button.H ../FL/Fl_File_Input.H ../FL/Fl_Input.H
+device.o: ../FL/Fl_Input_.H ../FL/Fl_Return_Button.H ../FL/fl_ask.H
radio.o: radio.h ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H
radio.o: ../FL/fl_types.h ../FL/Xutf8.h ../FL/Enumerations.H
radio.o: ../FL/Fl_Export.H ../FL/fl_types.h ../FL/Fl_Double_Window.H
@@ -475,10 +522,10 @@ sudoku.o: ../FL/Fl_Button.H ../FL/Fl_Group.H ../FL/fl_ask.H ../FL/fl_draw.H
sudoku.o: ../FL/Fl_Help_Dialog.H ../FL/Fl_Input.H ../FL/Fl_Input_.H
sudoku.o: ../FL/Fl_Box.H ../FL/Fl_Help_View.H ../FL/Fl.H ../FL/Fl_Scrollbar.H
sudoku.o: ../FL/Fl_Slider.H ../FL/Fl_Valuator.H ../FL/fl_draw.H
-sudoku.o: ../FL/Fl_Shared_Image.H ../FL/Fl_Image.H ../FL/Fl_Preferences.H
-sudoku.o: ../FL/Fl_Sys_Menu_Bar.H ../FL/Fl_Menu_Bar.H ../FL/Fl_Menu_.H
-sudoku.o: ../FL/Fl_Menu_Item.H ../FL/x.H ../FL/x.H ../FL/math.h
-sudoku.o: pixmaps/sudoku.xbm ../config.h
+sudoku.o: ../FL/Fl_Device.H ../FL/x.H ../FL/Fl_Shared_Image.H
+sudoku.o: ../FL/Fl_Image.H ../FL/Fl_Preferences.H ../FL/Fl_Sys_Menu_Bar.H
+sudoku.o: ../FL/Fl_Menu_Bar.H ../FL/Fl_Menu_.H ../FL/Fl_Menu_Item.H ../FL/x.H
+sudoku.o: ../FL/math.h pixmaps/sudoku.xbm ../config.h
symbols.o: ../FL/Fl.H ../FL/fl_utf8.h ../FL/Fl_Export.H ../FL/fl_types.h
symbols.o: ../FL/Xutf8.h ../FL/Enumerations.H ../FL/Fl_Export.H
symbols.o: ../FL/fl_types.h ../FL/Fl_Double_Window.H ../FL/Fl_Window.H
diff --git a/test/mandelbrot.cxx b/test/mandelbrot.cxx
index c274658c6..7599057be 100644
--- a/test/mandelbrot.cxx
+++ b/test/mandelbrot.cxx
@@ -27,6 +27,8 @@
#include "mandelbrot_ui.h"
#include <FL/fl_draw.H>
+#include <FL/Fl_Button.H>
+#include <FL/Fl_Printer.H>
#include <stdio.h>
#include <stdlib.h>
@@ -43,8 +45,30 @@ void set_idle() {
static void window_callback(Fl_Widget*, void*) {exit(0);}
+static void print(Fl_Widget *o, void *data)
+{
+ Fl_Printer printer;
+ Fl_Window *win = o->window();
+ if(!win->visible()) return;
+ win->make_current();
+ uchar *image_data = fl_read_image(NULL, 0, 0, win->w(), win->h(), 0);
+ if( printer.start_job(1) ) return;
+ if( printer.start_page() ) return;
+ printer.scale(.7,.7);
+ fl_draw_image(image_data, 0,0, win->w(), win->h());
+ printer.end_page();
+ delete image_data;
+ printer.end_job();
+}
+
int main(int argc, char **argv) {
mbrot.make_window();
+ mbrot.window->begin();
+ Fl_Button* o = new Fl_Button(0, 0, 0, 0, NULL);
+ o->callback(print,NULL);
+ o->shortcut(FL_CTRL+'p');
+ mbrot.window->end();
+
mbrot.d->X = -.75;
mbrot.d->scale = 2.5;
mbrot.update_label();
diff --git a/test/mandelbrot_ui.fl b/test/mandelbrot_ui.fl
index 075819b57..e0cb721f6 100644
--- a/test/mandelbrot_ui.fl
+++ b/test/mandelbrot_ui.fl
@@ -52,7 +52,7 @@ d->new_display();}
}
Fl_Box {} {
label {left: click = zoom out, drag = zoom in
-right click: Julia set}
+right click: Julia set, ctrl-P: Print}
xywh {240 50 190 30} labelsize 10 align 24 deactivate
}
Fl_Slider {} {
diff --git a/test/print.cxx b/test/print.cxx
new file mode 100644
index 000000000..82dcde049
--- /dev/null
+++ b/test/print.cxx
@@ -0,0 +1,189 @@
+//
+// "$Id: curve.cxx 6615 2009-01-01 16:35:13Z matt $"
+//
+// Curve test program for the Fast Light Tool Kit (FLTK).
+//
+// Copyright 1998-2009 by Bill Spitzak and others.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Library General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Library General Public License for more details.
+//
+// You should have received a copy of the GNU Library General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+// USA.
+//
+// Please report all bugs and problems on the following page:
+//
+// http://www.fltk.org/str.php
+//
+
+#include <FL/Fl.H>
+#include <FL/fl_ask.H>
+#include <FL/Fl_Double_Window.H>
+#include <FL/Fl_Hor_Value_Slider.H>
+#include <FL/fl_draw.H>
+#include <FL/Fl_Toggle_Button.H>
+//#include <FL/Fl_Printer.H>
+#include <FL/Fl_Device.H>
+#include <FL/Fl_Pixmap.H>
+#include "pixmaps/porsche.xpm"
+Fl_Pixmap porsche (porsche_xpm);
+double args[9] = {
+ 20,20, 50,200, 100,20, 200,200, 0};
+const char* name[9] = {
+ "X0", "Y0", "X1", "Y1", "X2", "Y2", "X3", "Y3", "rotate"};
+
+int points;
+
+#include <FL/Fl_Box.H>
+class Drawing : public Fl_Window {
+ void draw() {
+ fl_push_clip(0,0,w(),h());
+ fl_color(FL_DARK3);
+ fl_rectf(0,0,w(),h());
+ fl_color(FL_RED);
+ fl_font(FL_HELVETICA, 14);
+ // tau epsilon chi tau
+ static unsigned utfs[4] = {0x3c4, 0x3b5, 0x3c7, 0x3c4};
+ char utf8[40] = "test UTF ";
+ for(int i = 0; i < 4; i++) {
+ char buf[5];
+ int l = fl_utf8encode(utfs[i], buf); buf[l] = 0;
+ strcat(utf8, buf);
+ }
+ fl_draw(utf8, 5, 15);
+ fl_color(FL_BLACK);
+ fl_font(FL_HELVETICA, 24);
+ fl_draw("bottom clipped text", 5, h() + 4);
+ fl_line_style(FL_SOLID, 0);
+ fl_rect(x()+200,y()+10,64,64);
+ porsche.draw(x()+200,y()+10,64,64);
+ fl_push_matrix();
+ if (args[8]) {
+ fl_translate(w()/2.0, h()/2.0);
+ fl_rotate(args[8]);
+ fl_translate(-(w()/2.0), -(h()/2.0));
+ }
+ fl_translate(x(),y());
+ if (!points) {
+ fl_color(FL_WHITE);
+ fl_begin_complex_polygon();
+ fl_curve(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7]);
+ fl_end_complex_polygon();
+ }
+ fl_color(FL_BLACK);
+ fl_begin_line();
+ fl_vertex(args[0],args[1]);
+ fl_vertex(args[2],args[3]);
+ fl_vertex(args[4],args[5]);
+ fl_vertex(args[6],args[7]);
+ fl_end_line();
+ fl_color(points ? FL_WHITE : FL_RED);
+ points ? fl_begin_points() : fl_begin_line();
+ fl_curve(args[0],args[1],args[2],args[3],args[4],args[5],args[6],args[7]);
+ points ? fl_end_points() : fl_end_line();
+ fl_pop_matrix();
+ fl_pop_clip();
+ }
+public:
+ Drawing(int X,int Y,int W,int H) : Fl_Window(X,Y,W,H) {}
+};
+
+Drawing *d;
+
+void points_cb(Fl_Widget* o, void*) {
+ points = ((Fl_Toggle_Button*)o)->value();
+ d->redraw();
+}
+
+void slider_cb(Fl_Widget* o, void* v) {
+ Fl_Slider* s = (Fl_Slider*)o;
+ args[long(v)] = s->value();
+ d->redraw();
+}
+
+#include <FL/Fl_Printer.H>
+void print_cb(Fl_Widget* o, void* v) {
+ int w, h;
+ Drawing *d = (Drawing *)v;
+ Fl_Window *win = o->window();
+ // start print job and one page
+ Fl_Printer printer;
+ if ( printer.start_job(1) ) {
+#if defined(__APPLE__) || defined(WIN32)
+ fl_alert("error starting print job");
+#else
+ fl_alert("error starting print job\n"
+ "this platform doesn't support printing yet");
+#endif
+ return;
+ }
+ if (printer.start_page() ) return;
+ // draw the printable area border
+ printer.printable_rect(&w, &h);
+ fl_color(FL_GRAY);
+ fl_line_style(FL_DOT, 0);
+ fl_rect(0,0,w,h);
+ fl_line_style(FL_SOLID, 0);
+ //print the full window at top left of page
+ printer.print_widget(win);
+ //print the shrinked Drawing custom widget at right of page
+ printer.scale(.6,.6);
+ printer.printable_rect(&w, &h);
+ printer.origin(w - d->w(), 100);
+ printer.print_widget(d);
+ //print the print button at bottom left
+ printer.scale(1,1);
+ printer.printable_rect(&w, &h);
+ printer.print_widget(o, 0, h - o->h() );
+ //print the scaled window at bottom right
+ printer.scale(.5,.5);
+ printer.printable_rect(&w, &h);
+ printer.print_widget(win, w - win->w(), h - win->h());
+
+ // close page and print job
+ printer.end_page();
+ printer.end_job();
+}
+
+int main(int argc, char** argv) {
+ Fl_Double_Window window(300,555);
+ Fl_Double_Window window2(5,5,290,290);
+ Drawing drawing(5,5,280,280);
+ drawing.end();
+ window2.end();
+ window2.box(FL_DOWN_BOX);
+ d = &drawing;
+
+ int y = 300;
+ for (int n = 0; n<9; n++) {
+ Fl_Slider* s = new Fl_Hor_Value_Slider(50,y,240,25,name[n]); y += 25;
+ s->minimum(0); s->maximum(280);
+ if (n == 8) s->maximum(360);
+ s->step(1);
+ s->value(args[n]);
+ s->align(FL_ALIGN_LEFT);
+ s->callback(slider_cb, (void*)n);
+ }
+ Fl_Toggle_Button but(50,y,50,25,"points");
+ but.callback(points_cb);
+
+ Fl_Button pbut(110, y, 50, 25, "Print");
+ pbut.callback(print_cb, d);
+
+ window.end();
+ window.show(argc,argv);
+ return Fl::run();
+}
+
+//
+// End of "$Id: curve.cxx 6615 2009-01-01 16:35:13Z matt $".
+//
diff --git a/test/unittest_images.cxx b/test/unittest_images.cxx
index 6ec0cca70..a2819a5a3 100644
--- a/test/unittest_images.cxx
+++ b/test/unittest_images.cxx
@@ -78,8 +78,8 @@ public:
fl_color(FL_BLACK); fl_rectf(xx, yy, 130, 130);
fl_color(FL_WHITE); fl_rectf(xx+1, yy+1, 64, 64);
fl_color(FL_WHITE); fl_rectf(xx+65, yy+65, 64, 64);
- // fl_draw_image(img_rgba, xx+1, yy+1, 128, 128, 4);
- i_rgba->draw(xx+1,yy+1);
+ fl_draw_image(img_rgba, xx+1, yy+1, 128, 128, 4);
+ //i_rgba->draw(xx+1,yy+1);
fl_color(FL_BLACK); fl_draw("RGBA", xx+134, yy+64);
xx = x()+10+200; yy = y()+10;