Update Fl_Image and friends so that we don't need to include the

system headers (which unfortunately are not too friendly with other
code...)


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2893 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 2003-01-10 19:29:09 +00:00
parent 24f57a7aea
commit 4bf5385fb1
8 changed files with 56 additions and 44 deletions

View File

@ -1,5 +1,5 @@
// //
// "$Id: Fl_Bitmap.H,v 1.5.2.3.2.8 2002/08/05 17:50:22 easysw Exp $" // "$Id: Fl_Bitmap.H,v 1.5.2.3.2.9 2003/01/10 19:29:07 easysw Exp $"
// //
// Bitmap header file for the Fast Light Tool Kit (FLTK). // Bitmap header file for the Fast Light Tool Kit (FLTK).
// //
@ -35,8 +35,12 @@ class FL_EXPORT Fl_Bitmap : public Fl_Image {
const uchar *array; const uchar *array;
int alloc_array; // Non-zero if data was allocated int alloc_array; // Non-zero if data was allocated
Fl_Bitmask id; // for internal use #ifdef __APPLE__
void *id; // for internal use
#else
unsigned id; // for internal use
#endif // __APPLE__
Fl_Bitmap(const uchar *bits, int W, int H) : Fl_Bitmap(const uchar *bits, int W, int H) :
Fl_Image(W,H,0), array(bits), alloc_array(0), id(0) {data((const char **)&array, 1);} Fl_Image(W,H,0), array(bits), alloc_array(0), id(0) {data((const char **)&array, 1);}
Fl_Bitmap(const char *bits, int W, int H) : Fl_Bitmap(const char *bits, int W, int H) :
@ -54,5 +58,5 @@ class FL_EXPORT Fl_Bitmap : public Fl_Image {
#endif #endif
// //
// End of "$Id: Fl_Bitmap.H,v 1.5.2.3.2.8 2002/08/05 17:50:22 easysw Exp $". // End of "$Id: Fl_Bitmap.H,v 1.5.2.3.2.9 2003/01/10 19:29:07 easysw Exp $".
// //

View File

@ -1,5 +1,5 @@
// //
// "$Id: Fl_Image.H,v 1.5.2.3.2.16 2002/10/11 14:17:20 easysw Exp $" // "$Id: Fl_Image.H,v 1.5.2.3.2.17 2003/01/10 19:29:07 easysw Exp $"
// //
// Image header file for the Fast Light Tool Kit (FLTK). // Image header file for the Fast Light Tool Kit (FLTK).
// //
@ -26,10 +26,9 @@
#ifndef Fl_Image_H #ifndef Fl_Image_H
# define Fl_Image_H # define Fl_Image_H
# include "x.H"
class Fl_Widget; class Fl_Widget;
struct Fl_Menu_Item; struct Fl_Menu_Item;
struct Fl_Label;
class FL_EXPORT Fl_Image { class FL_EXPORT Fl_Image {
int w_, h_, d_, ld_, count_; int w_, h_, d_, ld_, count_;
@ -80,8 +79,13 @@ class FL_EXPORT Fl_RGB_Image : public Fl_Image {
const uchar *array; const uchar *array;
int alloc_array; // Non-zero if array was allocated int alloc_array; // Non-zero if array was allocated
Fl_Offscreen id; // for internal use #ifdef __APPLE__
Fl_Bitmask mask; // for internal use (mask bitmap) void *id; // for internal use
void *mask; // for internal use (mask bitmap)
#else
unsigned id; // for internal use
unsigned mask; // for internal use (mask bitmap)
#endif //
Fl_RGB_Image(const uchar *bits, int W, int H, int D=3, int LD=0) : Fl_RGB_Image(const uchar *bits, int W, int H, int D=3, int LD=0) :
Fl_Image(W,H,D), array(bits), alloc_array(0), id(0), mask(0) {data((const char **)&array, 1); ld(LD);} Fl_Image(W,H,D), array(bits), alloc_array(0), id(0), mask(0) {data((const char **)&array, 1); ld(LD);}
@ -100,5 +104,5 @@ class FL_EXPORT Fl_RGB_Image : public Fl_Image {
#endif // !Fl_Image_H #endif // !Fl_Image_H
// //
// End of "$Id: Fl_Image.H,v 1.5.2.3.2.16 2002/10/11 14:17:20 easysw Exp $". // End of "$Id: Fl_Image.H,v 1.5.2.3.2.17 2003/01/10 19:29:07 easysw Exp $".
// //

View File

@ -1,5 +1,5 @@
// //
// "$Id: Fl_Pixmap.H,v 1.6.2.8.2.9 2002/08/09 01:09:48 easysw Exp $" // "$Id: Fl_Pixmap.H,v 1.6.2.8.2.10 2003/01/10 19:29:08 easysw Exp $"
// //
// Pixmap header file for the Fast Light Tool Kit (FLTK). // Pixmap header file for the Fast Light Tool Kit (FLTK).
// //
@ -47,9 +47,14 @@ class FL_EXPORT Fl_Pixmap : public Fl_Image {
public: public:
int alloc_data; // Non-zero if data was allocated int alloc_data; // Non-zero if data was allocated
Fl_Offscreen id; // for internal use #ifdef __APPLE__
Fl_Bitmask mask; // for internal use (mask bitmap) void *id; // for internal use
void *mask; // for internal use (mask bitmap)
#else
unsigned id; // for internal use
unsigned mask; // for internal use (mask bitmap)
#endif // __APPLE__
explicit Fl_Pixmap(char * const * D) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)D); measure();} explicit Fl_Pixmap(char * const * D) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)D); measure();}
explicit Fl_Pixmap(uchar* const * D) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)D); measure();} explicit Fl_Pixmap(uchar* const * D) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)D); measure();}
explicit Fl_Pixmap(const char * const * D) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)D); measure();} explicit Fl_Pixmap(const char * const * D) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)D); measure();}
@ -69,5 +74,5 @@ class FL_EXPORT Fl_Pixmap : public Fl_Image {
#endif #endif
// //
// End of "$Id: Fl_Pixmap.H,v 1.6.2.8.2.9 2002/08/09 01:09:48 easysw Exp $". // End of "$Id: Fl_Pixmap.H,v 1.6.2.8.2.10 2003/01/10 19:29:08 easysw Exp $".
// //

View File

@ -1,5 +1,5 @@
// //
// // "$Id: align_widget.cxx,v 1.1.2.2 2003/01/10 19:29:08 easysw Exp $"
// //
// alignment code for the Fast Light Tool Kit (FLTK). // alignment code for the Fast Light Tool Kit (FLTK).
// //
@ -24,6 +24,7 @@
// //
#include <FL/Fl.H> #include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include "Fl_Widget_Type.h" #include "Fl_Widget_Type.h"
/** /**
@ -322,3 +323,9 @@ void align_widget_cb(Fl_Widget*, long how)
break; break;
} }
} }
//
// End of "$Id: align_widget.cxx,v 1.1.2.2 2003/01/10 19:29:08 easysw Exp $".
//

View File

@ -1,5 +1,5 @@
// //
// "$Id: Fl_Bitmap.cxx,v 1.5.2.4.2.20 2002/12/19 21:34:25 easysw Exp $" // "$Id: Fl_Bitmap.cxx,v 1.5.2.4.2.21 2003/01/10 19:29:08 easysw Exp $"
// //
// Bitmap drawing routines for the Fast Light Tool Kit (FLTK). // Bitmap drawing routines for the Fast Light Tool Kit (FLTK).
// //
@ -361,10 +361,10 @@ void Fl_Bitmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
GrafPtr dstPort; GrafPtr dstPort;
GetPort( &dstPort ); GetPort( &dstPort );
Rect src, dst; Rect src, dst;
GetPortBounds( id, &src ); GetPortBounds( (Fl_Offscreen)id, &src );
SetRect( &src, cx, cy, cx+W, cy+H ); SetRect( &src, cx, cy, cx+W, cy+H );
SetRect( &dst, X, Y, X+W, Y+H ); SetRect( &dst, X, Y, X+W, Y+H );
CopyBits(GetPortBitMapForCopyBits(id), // srcBits CopyBits(GetPortBitMapForCopyBits((Fl_Offscreen)id), // srcBits
GetPortBitMapForCopyBits(dstPort), // dstBits GetPortBitMapForCopyBits(dstPort), // dstBits
&src, // src bounds &src, // src bounds
&dst, // dst bounds &dst, // dst bounds
@ -390,7 +390,7 @@ Fl_Bitmap::~Fl_Bitmap() {
void Fl_Bitmap::uncache() { void Fl_Bitmap::uncache() {
if (id) { if (id) {
fl_delete_bitmask(id); fl_delete_bitmask((Fl_Offscreen)id);
id = 0; id = 0;
} }
} }
@ -474,5 +474,5 @@ Fl_Image *Fl_Bitmap::copy(int W, int H) {
// //
// End of "$Id: Fl_Bitmap.cxx,v 1.5.2.4.2.20 2002/12/19 21:34:25 easysw Exp $". // End of "$Id: Fl_Bitmap.cxx,v 1.5.2.4.2.21 2003/01/10 19:29:08 easysw Exp $".
// //

View File

@ -1,5 +1,5 @@
// //
// "$Id: Fl_Image.cxx,v 1.5.2.3.2.26 2002/12/19 21:34:25 easysw Exp $" // "$Id: Fl_Image.cxx,v 1.5.2.3.2.27 2003/01/10 19:29:09 easysw Exp $"
// //
// Image drawing code for the Fast Light Tool Kit (FLTK). // Image drawing code for the Fast Light Tool Kit (FLTK).
// //
@ -125,12 +125,12 @@ Fl_RGB_Image::~Fl_RGB_Image() {
void Fl_RGB_Image::uncache() { void Fl_RGB_Image::uncache() {
if (id) { if (id) {
fl_delete_offscreen(id); fl_delete_offscreen((Fl_Offscreen)id);
id = 0; id = 0;
} }
if (mask) { if (mask) {
fl_delete_bitmask(mask); fl_delete_bitmask((Fl_Bitmask)mask);
mask = 0; mask = 0;
} }
} }
@ -310,7 +310,7 @@ void Fl_RGB_Image::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
if (H <= 0) return; if (H <= 0) return;
if (!id) { if (!id) {
id = fl_create_offscreen(w(), h()); id = fl_create_offscreen(w(), h());
fl_begin_offscreen(id); fl_begin_offscreen((Fl_Offscreen)id);
fl_draw_image(array, 0, 0, w(), h(), d(), ld()); fl_draw_image(array, 0, 0, w(), h(), d(), ld());
fl_end_offscreen(); fl_end_offscreen();
@ -357,7 +357,7 @@ void Fl_RGB_Image::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
&src, &src, &dst); &src, &src, &dst);
#endif // 0 #endif // 0
} else { } else {
fl_copy_offscreen(X, Y, W, H, id, cx, cy); fl_copy_offscreen(X, Y, W, H, (Fl_Offscreen)id, cx, cy);
} }
#else #else
if (mask) { if (mask) {
@ -392,5 +392,5 @@ void Fl_RGB_Image::label(Fl_Menu_Item* m) {
// //
// End of "$Id: Fl_Image.cxx,v 1.5.2.3.2.26 2002/12/19 21:34:25 easysw Exp $". // End of "$Id: Fl_Image.cxx,v 1.5.2.3.2.27 2003/01/10 19:29:09 easysw Exp $".
// //

View File

@ -1,5 +1,5 @@
// //
// "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.24 2002/12/19 21:34:26 easysw Exp $" // "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.25 2003/01/10 19:29:09 easysw Exp $"
// //
// Pixmap drawing code for the Fast Light Tool Kit (FLTK). // Pixmap drawing code for the Fast Light Tool Kit (FLTK).
// //
@ -81,7 +81,7 @@ void Fl_Pixmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
if (H <= 0) return; if (H <= 0) return;
if (!id) { if (!id) {
id = fl_create_offscreen(w(), h()); id = fl_create_offscreen(w(), h());
fl_begin_offscreen(id); fl_begin_offscreen((Fl_Offscreen)id);
uchar *bitmap = 0; uchar *bitmap = 0;
fl_mask_bitmap = &bitmap; fl_mask_bitmap = &bitmap;
fl_draw_pixmap(data(), 0, 0, FL_BLACK); fl_draw_pixmap(data(), 0, 0, FL_BLACK);
@ -121,7 +121,7 @@ void Fl_Pixmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
GetPortBitMapForCopyBits(GetWindowPort(fl_window)), GetPortBitMapForCopyBits(GetWindowPort(fl_window)),
&src, &src, &dst); &src, &src, &dst);
} else { } else {
fl_copy_offscreen(X, Y, W, H, id, cx, cy); fl_copy_offscreen(X, Y, W, H, (Fl_Offscreen)id, cx, cy);
} }
#else #else
if (mask) { if (mask) {
@ -152,12 +152,12 @@ Fl_Pixmap::~Fl_Pixmap() {
void Fl_Pixmap::uncache() { void Fl_Pixmap::uncache() {
if (id) { if (id) {
fl_delete_offscreen(id); fl_delete_offscreen((Fl_Offscreen)id);
id = 0; id = 0;
} }
if (mask) { if (mask) {
fl_delete_bitmask(mask); fl_delete_bitmask((Fl_Bitmask)mask);
mask = 0; mask = 0;
} }
} }
@ -461,5 +461,5 @@ void Fl_Pixmap::desaturate() {
} }
// //
// End of "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.24 2002/12/19 21:34:26 easysw Exp $". // End of "$Id: Fl_Pixmap.cxx,v 1.9.2.4.2.25 2003/01/10 19:29:09 easysw Exp $".
// //

View File

@ -1,5 +1,5 @@
// //
// "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.14 2002/11/19 16:37:35 easysw Exp $" // "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.15 2003/01/10 19:29:09 easysw Exp $"
// //
// System color support for the Fast Light Tool Kit (FLTK). // System color support for the Fast Light Tool Kit (FLTK).
// //
@ -260,15 +260,7 @@ int Fl::reload_scheme() {
sprintf(tile_cmap[2], ". c #%02x%02x%02x", 0xd8 * (int)r / 0xf0, sprintf(tile_cmap[2], ". c #%02x%02x%02x", 0xd8 * (int)r / 0xf0,
0xd8 * (int)g / 0xf0, 0xd8 * (int)b / 0xf0); 0xd8 * (int)g / 0xf0, 0xd8 * (int)b / 0xf0);
if (tile.id) { tile.uncache();
fl_delete_offscreen(tile.id);
tile.id = 0;
}
if (tile.mask) {
fl_delete_bitmask(tile.mask);
tile.mask = 0;
}
if (!scheme_bg_) scheme_bg_ = new Fl_Tiled_Image(&tile, w(), h()); if (!scheme_bg_) scheme_bg_ = new Fl_Tiled_Image(&tile, w(), h());
@ -317,5 +309,5 @@ int Fl::reload_scheme() {
// //
// End of "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.14 2002/11/19 16:37:35 easysw Exp $". // End of "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.15 2003/01/10 19:29:09 easysw Exp $".
// //