diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2001-11-19 01:06:45 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2001-11-19 01:06:45 +0000 |
| commit | 1acc39c5d8d5b3db88abfd008699dadb8aade2b9 (patch) | |
| tree | c35a486fc713b48c85286ce42291aa88e6652e7e /test | |
| parent | 681ded73c20af217254a8dfb7838b612b17b126c (diff) | |
OK, lots of changes to the Fl_Image, Fl_Bitmap, Fl_Pixmap, and Fl_RGB_Image
classes: new copy(), copy(w,h), desaturate(), color_average(), and
inactive() methods, alloc_xyz member for copied data, etc.
Updated test programs to use inactive() and copy() methods to create
inactive images for the test buttons, plus the inactive button to toggle
it...
Added start of separate image classes, a la 2.0, for various image formats.
FLUID will also be updated for it...
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1703 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'test')
| -rw-r--r-- | test/Makefile | 6 | ||||
| -rw-r--r-- | test/bitmap.cxx | 22 | ||||
| -rw-r--r-- | test/image.cxx | 31 | ||||
| -rw-r--r-- | test/pixmap.cxx | 31 |
4 files changed, 58 insertions, 32 deletions
diff --git a/test/Makefile b/test/Makefile index af484dc04..4d622fb35 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile,v 1.19.2.7.2.8 2001/11/18 12:48:38 easysw Exp $" +# "$Id: Makefile,v 1.19.2.7.2.9 2001/11/19 01:06:45 easysw Exp $" # # Test/example program makefile for the Fast Light Tool Kit (FLTK). # @@ -111,7 +111,7 @@ gldemos: $(GLALL) echo Generating $<... ../fluid/fluid -c $< -$(EXEEXT).fl: +.fl$(EXEEXT): echo Generating, compiling, and linking $@... ../fluid/fluid -c $< $(CXX) -I.. $(CXXFLAGS) $@.cxx $(LINKFLTK) $(LDLIBS) -o $@ @@ -186,5 +186,5 @@ install: @echo Nothing to install in test directory. # -# End of "$Id: Makefile,v 1.19.2.7.2.8 2001/11/18 12:48:38 easysw Exp $". +# End of "$Id: Makefile,v 1.19.2.7.2.9 2001/11/19 01:06:45 easysw Exp $". # diff --git a/test/bitmap.cxx b/test/bitmap.cxx index a033a84c6..e2bdecf31 100644 --- a/test/bitmap.cxx +++ b/test/bitmap.cxx @@ -1,5 +1,5 @@ // -// "$Id: bitmap.cxx,v 1.4.2.3.2.1 2001/08/05 23:58:54 easysw Exp $" +// "$Id: bitmap.cxx,v 1.4.2.3.2.2 2001/11/19 01:06:45 easysw Exp $" // // Bitmap label test program for the Fast Light Tool Kit (FLTK). // @@ -98,7 +98,7 @@ static uchar sorceress_bits[] = { #include <FL/Fl_Toggle_Button.H> -Fl_Toggle_Button *leftb,*rightb,*topb,*bottomb,*insideb,*overb; +Fl_Toggle_Button *leftb,*rightb,*topb,*bottomb,*insideb,*overb,*inactb; Fl_Button *b; Fl_Window *w; @@ -111,6 +111,8 @@ void button_cb(Fl_Widget *,void *) { if (insideb->value()) i |= FL_ALIGN_INSIDE; if (overb->value()) i |= FL_ALIGN_TEXT_OVER_IMAGE; b->align(i); + if (inactb->value()) b->deactivate(); + else b->activate(); w->redraw(); } @@ -118,18 +120,20 @@ int main(int argc, char **argv) { Fl_Window window(400,400); ::w = &window; Fl_Button b(140,160,120,120,"Bitmap"); ::b = &b; (new Fl_Bitmap(sorceress_bits,sorceress_width,sorceress_height))->label(&b); - leftb = new Fl_Toggle_Button(25,75,50,25,"left"); + leftb = new Fl_Toggle_Button(25,50,50,25,"left"); leftb->callback(button_cb); - rightb = new Fl_Toggle_Button(75,75,50,25,"right"); + rightb = new Fl_Toggle_Button(75,50,50,25,"right"); rightb->callback(button_cb); - topb = new Fl_Toggle_Button(125,75,50,25,"top"); + topb = new Fl_Toggle_Button(125,50,50,25,"top"); topb->callback(button_cb); - bottomb = new Fl_Toggle_Button(175,75,50,25,"bottom"); + bottomb = new Fl_Toggle_Button(175,50,50,25,"bottom"); bottomb->callback(button_cb); - insideb = new Fl_Toggle_Button(225,75,50,25,"inside"); + insideb = new Fl_Toggle_Button(225,50,50,25,"inside"); insideb->callback(button_cb); - overb = new Fl_Toggle_Button(275,75,100,25,"text over"); + overb = new Fl_Toggle_Button(25,75,100,25,"text over"); overb->callback(button_cb); + inactb = new Fl_Toggle_Button(125,75,100,25,"inactive"); + inactb->callback(button_cb); window.resizable(window); window.end(); window.show(argc, argv); @@ -137,5 +141,5 @@ int main(int argc, char **argv) { } // -// End of "$Id: bitmap.cxx,v 1.4.2.3.2.1 2001/08/05 23:58:54 easysw Exp $". +// End of "$Id: bitmap.cxx,v 1.4.2.3.2.2 2001/11/19 01:06:45 easysw Exp $". // diff --git a/test/image.cxx b/test/image.cxx index 565353cdb..fe70b73cd 100644 --- a/test/image.cxx +++ b/test/image.cxx @@ -1,5 +1,5 @@ // -// "$Id: image.cxx,v 1.6.2.3.2.2 2001/11/18 20:52:28 easysw Exp $" +// "$Id: image.cxx,v 1.6.2.3.2.3 2001/11/19 01:06:45 easysw Exp $" // // Fl_Image test program for the Fast Light Tool Kit (FLTK). // @@ -61,7 +61,7 @@ void make_image() { #include <FL/Fl_Toggle_Button.H> -Fl_Toggle_Button *leftb,*rightb,*topb,*bottomb,*insideb,*overb; +Fl_Toggle_Button *leftb,*rightb,*topb,*bottomb,*insideb,*overb,*inactb; Fl_Button *b; Fl_Window *w; @@ -74,6 +74,8 @@ void button_cb(Fl_Widget *,void *) { if (insideb->value()) i |= FL_ALIGN_INSIDE; if (overb->value()) i |= FL_ALIGN_TEXT_OVER_IMAGE; b->align(i); + if (inactb->value()) b->deactivate(); + else b->activate(); w->redraw(); } @@ -124,19 +126,28 @@ int main(int argc, char **argv) { window.color(FL_WHITE); Fl_Button b(140,160,120,120,"Image w/Alpha"); ::b = &b; make_image(); - b.image(new Fl_RGB_Image(image, width, height,4)); - leftb = new Fl_Toggle_Button(25,75,50,25,"left"); + Fl_RGB_Image *rgb = new Fl_RGB_Image(image, width, height,4); + Fl_RGB_Image *dergb; + dergb = (Fl_RGB_Image *)rgb->copy(); + dergb->inactive(); + + b.image(rgb); + b.deimage(dergb); + + leftb = new Fl_Toggle_Button(25,50,50,25,"left"); leftb->callback(button_cb); - rightb = new Fl_Toggle_Button(75,75,50,25,"right"); + rightb = new Fl_Toggle_Button(75,50,50,25,"right"); rightb->callback(button_cb); - topb = new Fl_Toggle_Button(125,75,50,25,"top"); + topb = new Fl_Toggle_Button(125,50,50,25,"top"); topb->callback(button_cb); - bottomb = new Fl_Toggle_Button(175,75,50,25,"bottom"); + bottomb = new Fl_Toggle_Button(175,50,50,25,"bottom"); bottomb->callback(button_cb); - insideb = new Fl_Toggle_Button(225,75,50,25,"inside"); + insideb = new Fl_Toggle_Button(225,50,50,25,"inside"); insideb->callback(button_cb); - overb = new Fl_Toggle_Button(275,75,100,25,"text over"); + overb = new Fl_Toggle_Button(25,75,100,25,"text over"); overb->callback(button_cb); + inactb = new Fl_Toggle_Button(125,75,100,25,"inactive"); + inactb->callback(button_cb); window.resizable(window); window.end(); window.show(argc, argv); @@ -144,5 +155,5 @@ int main(int argc, char **argv) { } // -// End of "$Id: image.cxx,v 1.6.2.3.2.2 2001/11/18 20:52:28 easysw Exp $". +// End of "$Id: image.cxx,v 1.6.2.3.2.3 2001/11/19 01:06:45 easysw Exp $". // diff --git a/test/pixmap.cxx b/test/pixmap.cxx index a6143cc73..52698bd48 100644 --- a/test/pixmap.cxx +++ b/test/pixmap.cxx @@ -1,5 +1,5 @@ // -// "$Id: pixmap.cxx,v 1.4.2.3.2.1 2001/08/05 23:58:54 easysw Exp $" +// "$Id: pixmap.cxx,v 1.4.2.3.2.2 2001/11/19 01:06:45 easysw Exp $" // // Pixmap label test program for the Fast Light Tool Kit (FLTK). // @@ -33,7 +33,7 @@ #include <FL/Fl_Toggle_Button.H> -Fl_Toggle_Button *leftb,*rightb,*topb,*bottomb,*insideb,*overb; +Fl_Toggle_Button *leftb,*rightb,*topb,*bottomb,*insideb,*overb,*inactb; Fl_Button *b; Fl_Window *w; @@ -46,6 +46,8 @@ void button_cb(Fl_Widget *,void *) { if (insideb->value()) i |= FL_ALIGN_INSIDE; if (overb->value()) i |= FL_ALIGN_TEXT_OVER_IMAGE; b->align(i); + if (inactb->value()) b->deactivate(); + else b->activate(); w->redraw(); } @@ -64,19 +66,28 @@ int main(int argc, char **argv) { Fl_Window window(400,400); ::w = &window; Fl_Button b(140,160,120,120,"Pixmap"); ::b = &b; - (new Fl_Pixmap(porsche_xpm))->label(&b); - leftb = new Fl_Toggle_Button(25,75,50,25,"left"); + Fl_Pixmap *pixmap = new Fl_Pixmap(porsche_xpm); + Fl_Pixmap *depixmap; + depixmap = (Fl_Pixmap *)pixmap->copy(); + depixmap->inactive(); + + b.image(pixmap); + b.deimage(depixmap); + + leftb = new Fl_Toggle_Button(25,50,50,25,"left"); leftb->callback(button_cb); - rightb = new Fl_Toggle_Button(75,75,50,25,"right"); + rightb = new Fl_Toggle_Button(75,50,50,25,"right"); rightb->callback(button_cb); - topb = new Fl_Toggle_Button(125,75,50,25,"top"); + topb = new Fl_Toggle_Button(125,50,50,25,"top"); topb->callback(button_cb); - bottomb = new Fl_Toggle_Button(175,75,50,25,"bottom"); + bottomb = new Fl_Toggle_Button(175,50,50,25,"bottom"); bottomb->callback(button_cb); - insideb = new Fl_Toggle_Button(225,75,50,25,"inside"); + insideb = new Fl_Toggle_Button(225,50,50,25,"inside"); insideb->callback(button_cb); - overb = new Fl_Toggle_Button(275,75,100,25,"text over"); + overb = new Fl_Toggle_Button(25,75,100,25,"text over"); overb->callback(button_cb); + inactb = new Fl_Toggle_Button(125,75,100,25,"inactive"); + inactb->callback(button_cb); if (!dvisual) Fl::visual(FL_RGB); window.resizable(window); window.end(); @@ -85,5 +96,5 @@ int main(int argc, char **argv) { } // -// End of "$Id: pixmap.cxx,v 1.4.2.3.2.1 2001/08/05 23:58:54 easysw Exp $". +// End of "$Id: pixmap.cxx,v 1.4.2.3.2.2 2001/11/19 01:06:45 easysw Exp $". // |
