Remove platform-dependent type Fl_Bitmask (not in documented public API).
This commit is contained in:
parent
70f61a63f4
commit
427e4dbc7a
@ -91,8 +91,6 @@ class FL_EXPORT Fl_Graphics_Driver {
|
||||
friend int fl_convert_pixmap(const char*const* cdata, uchar* out, Fl_Color bg);
|
||||
friend FL_EXPORT void gl_start();
|
||||
friend FL_EXPORT void gl_finish();
|
||||
friend FL_EXPORT Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *array);
|
||||
friend FL_EXPORT void fl_delete_bitmask(Fl_Bitmask);
|
||||
/* ============== Implementation note about image drawing =========================
|
||||
A graphics driver can implement up to 6 virtual member functions to draw images:
|
||||
virtual void draw_pixmap(Fl_Pixmap *pxm,int XP, int YP, int WP, int HP, int cx, int cy)
|
||||
@ -132,7 +130,7 @@ and
|
||||
|
||||
Graphics drivers also implement cache(Fl_Pixmap*), cache(Fl_Bitmap*) and cache(Fl_RGB_Image*)
|
||||
to compute the cached form of all image types, and uncache(Fl_RGB_Image *,...),
|
||||
uncache_pixmap(fl_uintptr_t) and delete_bitmask(Fl_Bitmask) to destroy cached image forms.
|
||||
uncache_pixmap(fl_uintptr_t) and delete_bitmask(fl_uintptr_t) to destroy cached image forms.
|
||||
Graphics drivers that use the mask_ variable of class Fl_Pixmap to cache an Fl_Pixmap
|
||||
object also reimplement the uchar **Fl_Graphics_Driver::mask_bitmap() member function.
|
||||
*/
|
||||
@ -197,8 +195,6 @@ protected:
|
||||
virtual void draw_bitmap(Fl_Bitmap *bm, int XP, int YP, int WP, int HP, int cx, int cy);
|
||||
virtual void copy_offscreen(int x, int y, int w, int h, Fl_Offscreen pixmap, int srcx, int srcy);
|
||||
|
||||
virtual Fl_Bitmask create_bitmask(int w, int h, const uchar *array);
|
||||
virtual void delete_bitmask(Fl_Bitmask bm);
|
||||
/** For internal library use only */
|
||||
static void change_image_size(Fl_Image *img, int W, int H) {
|
||||
img->w(W);
|
||||
@ -378,6 +374,7 @@ public:
|
||||
virtual PangoFontDescription* pango_font_description(Fl_Font) { return NULL; }
|
||||
virtual void antialias(int state);
|
||||
virtual int antialias();
|
||||
virtual void delete_bitmask(fl_uintptr_t bm);
|
||||
};
|
||||
|
||||
#ifndef FL_DOXYGEN
|
||||
|
@ -74,9 +74,6 @@ extern FL_EXPORT Fl_Window* fl_find(Window xid);
|
||||
extern FL_EXPORT void fl_open_display();
|
||||
extern FL_EXPORT void fl_close_display();
|
||||
extern FL_EXPORT Window fl_window;
|
||||
extern FL_EXPORT Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *data);
|
||||
extern FL_EXPORT Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *data);
|
||||
extern FL_EXPORT void fl_delete_bitmask(Fl_Bitmask bm);
|
||||
extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b);
|
||||
extern FL_EXPORT void fl_open_callback(void (*)(const char *));
|
||||
|
||||
|
@ -33,7 +33,6 @@ typedef opaque fl_intptr_t;
|
||||
typedef opaque fl_uintptr_t;
|
||||
|
||||
typedef opaque Fl_Offscreen; /**< an offscreen drawing buffer */
|
||||
typedef opaque Fl_Bitmask; /**< mask */
|
||||
typedef opaque Fl_Region; /**< a region made of several rectangles */
|
||||
typedef opaque FL_SOCKET; /**< socket or file descriptor */
|
||||
typedef opaque GLContext; /**< an OpenGL graphics context, into which all OpenGL calls are rendered */
|
||||
@ -50,7 +49,7 @@ typedef opaque GLContext; /**< an OpenGL graphics context, into which all OpenGL
|
||||
|
||||
/* Platform-dependent types are defined here.
|
||||
These types must be defined by any platform:
|
||||
Fl_Offscreen, Fl_Bitmask, Fl_Region, FL_SOCKET, GLContext, struct dirent, struct stat,
|
||||
Fl_Offscreen, Fl_Region, FL_SOCKET, GLContext, struct dirent, struct stat,
|
||||
fl_intptr_t, fl_uintptr_t
|
||||
|
||||
NOTE: *FIXME* AlbrechtS 13 Apr 2016 (concerning FL_SOCKET)
|
||||
@ -82,7 +81,6 @@ typedef unsigned long fl_uintptr_t;
|
||||
|
||||
#ifdef __APPLE__
|
||||
typedef struct CGContext* Fl_Offscreen;
|
||||
typedef struct CGImage* Fl_Bitmask;
|
||||
typedef struct flCocoaRegion* Fl_Region;
|
||||
typedef int FL_SOCKET;
|
||||
#ifdef __OBJC__
|
||||
@ -101,7 +99,6 @@ typedef int FL_SOCKET;
|
||||
#elif defined(_WIN32)
|
||||
typedef struct HBITMAP__ *HBITMAP;
|
||||
typedef HBITMAP Fl_Offscreen;
|
||||
typedef HBITMAP Fl_Bitmask;
|
||||
typedef struct HRGN__ *Fl_Region;
|
||||
# if defined(_WIN64) && defined(_MSC_VER)
|
||||
typedef unsigned __int64 FL_SOCKET; /* *FIXME* - FL_SOCKET (see above) */
|
||||
@ -118,7 +115,6 @@ typedef struct HGLRC__ *GLContext;
|
||||
|
||||
#elif defined(FLTK_USE_WAYLAND)
|
||||
typedef struct fl_wld_buffer *Fl_Offscreen; /**< an offscreen drawing buffer */
|
||||
typedef struct _cairo_pattern* Fl_Bitmask;
|
||||
typedef struct flWaylandRegion* Fl_Region;
|
||||
typedef int FL_SOCKET; /**< socket or file descriptor */
|
||||
typedef void *EGLContext;
|
||||
@ -130,7 +126,6 @@ typedef EGLContext GLContext;
|
||||
#elif defined(FLTK_USE_X11)
|
||||
|
||||
typedef unsigned long Fl_Offscreen;
|
||||
typedef unsigned long Fl_Bitmask;
|
||||
typedef struct _XRegion *Fl_Region;
|
||||
typedef int FL_SOCKET;
|
||||
typedef struct __GLXcontextRec *GLContext;
|
||||
|
@ -26,88 +26,6 @@
|
||||
#include <FL/Fl_Menu_Item.H>
|
||||
#include <FL/Fl_Bitmap.H>
|
||||
|
||||
/** Create a bit mask */
|
||||
Fl_Bitmask fl_create_bitmask(int w, int h, const uchar *array) {
|
||||
return fl_graphics_driver->create_bitmask(w, h, array);
|
||||
}
|
||||
|
||||
/** delete a bit mask */
|
||||
void fl_delete_bitmask(Fl_Bitmask bm) {
|
||||
return Fl_Graphics_Driver::default_driver().delete_bitmask(bm);
|
||||
}
|
||||
|
||||
// Create a 1-bit mask used for alpha blending
|
||||
Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *array) {
|
||||
Fl_Bitmask bm;
|
||||
int bmw = (w + 7) / 8;
|
||||
uchar *bitmap = new uchar[bmw * h];
|
||||
uchar *bitptr, bit;
|
||||
const uchar *dataptr;
|
||||
int x, y;
|
||||
static uchar dither[16][16] = { // Simple 16x16 Floyd dither
|
||||
{ 0, 128, 32, 160, 8, 136, 40, 168,
|
||||
2, 130, 34, 162, 10, 138, 42, 170 },
|
||||
{ 192, 64, 224, 96, 200, 72, 232, 104,
|
||||
194, 66, 226, 98, 202, 74, 234, 106 },
|
||||
{ 48, 176, 16, 144, 56, 184, 24, 152,
|
||||
50, 178, 18, 146, 58, 186, 26, 154 },
|
||||
{ 240, 112, 208, 80, 248, 120, 216, 88,
|
||||
242, 114, 210, 82, 250, 122, 218, 90 },
|
||||
{ 12, 140, 44, 172, 4, 132, 36, 164,
|
||||
14, 142, 46, 174, 6, 134, 38, 166 },
|
||||
{ 204, 76, 236, 108, 196, 68, 228, 100,
|
||||
206, 78, 238, 110, 198, 70, 230, 102 },
|
||||
{ 60, 188, 28, 156, 52, 180, 20, 148,
|
||||
62, 190, 30, 158, 54, 182, 22, 150 },
|
||||
{ 252, 124, 220, 92, 244, 116, 212, 84,
|
||||
254, 126, 222, 94, 246, 118, 214, 86 },
|
||||
{ 3, 131, 35, 163, 11, 139, 43, 171,
|
||||
1, 129, 33, 161, 9, 137, 41, 169 },
|
||||
{ 195, 67, 227, 99, 203, 75, 235, 107,
|
||||
193, 65, 225, 97, 201, 73, 233, 105 },
|
||||
{ 51, 179, 19, 147, 59, 187, 27, 155,
|
||||
49, 177, 17, 145, 57, 185, 25, 153 },
|
||||
{ 243, 115, 211, 83, 251, 123, 219, 91,
|
||||
241, 113, 209, 81, 249, 121, 217, 89 },
|
||||
{ 15, 143, 47, 175, 7, 135, 39, 167,
|
||||
13, 141, 45, 173, 5, 133, 37, 165 },
|
||||
{ 207, 79, 239, 111, 199, 71, 231, 103,
|
||||
205, 77, 237, 109, 197, 69, 229, 101 },
|
||||
{ 63, 191, 31, 159, 55, 183, 23, 151,
|
||||
61, 189, 29, 157, 53, 181, 21, 149 },
|
||||
{ 254, 127, 223, 95, 247, 119, 215, 87,
|
||||
253, 125, 221, 93, 245, 117, 213, 85 }
|
||||
};
|
||||
|
||||
// Generate a 1-bit "screen door" alpha mask; not always pretty, but
|
||||
// definitely fast... In the future we may be able to support things
|
||||
// like the RENDER extension in XFree86, when available, to provide
|
||||
// true RGBA-blended rendering. See:
|
||||
//
|
||||
// http://www.xfree86.org/~keithp/render/protocol.html
|
||||
//
|
||||
// for more info on XRender...
|
||||
//
|
||||
// MacOS already provides alpha blending support and has its own
|
||||
// fl_create_alphamask() function...
|
||||
memset(bitmap, 0, bmw * h);
|
||||
|
||||
for (dataptr = array + d - 1, y = 0; y < h; y ++, dataptr += ld)
|
||||
for (bitptr = bitmap + y * bmw, bit = 1, x = 0; x < w; x ++, dataptr += d) {
|
||||
if (*dataptr > dither[x & 15][y & 15])
|
||||
*bitptr |= bit;
|
||||
if (bit < 128) bit <<= 1;
|
||||
else {
|
||||
bit = 1;
|
||||
bitptr ++;
|
||||
}
|
||||
}
|
||||
|
||||
bm = fl_create_bitmask(w, h, bitmap);
|
||||
delete[] bitmap;
|
||||
|
||||
return (bm);
|
||||
}
|
||||
|
||||
void Fl_Bitmap::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
|
||||
fl_graphics_driver->draw_bitmap(this, XP, YP, WP, HP, cx, cy);
|
||||
@ -124,7 +42,7 @@ Fl_Bitmap::~Fl_Bitmap() {
|
||||
|
||||
void Fl_Bitmap::uncache() {
|
||||
if (id_) {
|
||||
fl_delete_bitmask((Fl_Bitmask)id_);
|
||||
fl_graphics_driver->delete_bitmask(id_);
|
||||
id_ = 0;
|
||||
}
|
||||
}
|
||||
|
@ -455,10 +455,7 @@ void Fl_Graphics_Driver::draw_image(Fl_Draw_Image_Cb cb, void* data, int X,int Y
|
||||
void Fl_Graphics_Driver::draw_image_mono(Fl_Draw_Image_Cb cb, void* data, int X,int Y,int W,int H, int D) {}
|
||||
|
||||
/** Support function for image drawing */
|
||||
Fl_Bitmask Fl_Graphics_Driver::create_bitmask(int w, int h, const uchar *array) {return 0; }
|
||||
|
||||
/** Support function for image drawing */
|
||||
void Fl_Graphics_Driver::delete_bitmask(Fl_Bitmask bm) {}
|
||||
void Fl_Graphics_Driver::delete_bitmask(fl_uintptr_t /*bm*/) {}
|
||||
|
||||
/** see fl_point() */
|
||||
void Fl_Graphics_Driver::point(int x, int y) {}
|
||||
|
@ -63,7 +63,7 @@ void Fl_Pixmap::uncache() {
|
||||
}
|
||||
|
||||
if (mask_) {
|
||||
fl_delete_bitmask((Fl_Bitmask)mask_);
|
||||
Fl_Graphics_Driver::default_driver().delete_bitmask(mask_);
|
||||
mask_ = 0;
|
||||
}
|
||||
}
|
||||
|
@ -140,8 +140,6 @@ public:
|
||||
void draw_image_mono(const uchar* d, int x,int y,int w,int h, int delta=1, int ld=0);
|
||||
void draw_image(Fl_Draw_Image_Cb call, void* data, int x,int y, int w, int h, int delta=3);
|
||||
void draw_image_mono(Fl_Draw_Image_Cb call, void* data, int x,int y, int w, int h, int delta=1);
|
||||
// ---
|
||||
Fl_Bitmask create_bitmask(int /*w*/, int /*h*/, const uchar * /*array*/) { return 0L; }
|
||||
|
||||
void ps_origin(int x, int y);
|
||||
void ps_translate(int, int);
|
||||
@ -154,7 +152,7 @@ public:
|
||||
void uncache(Fl_RGB_Image *img, fl_uintptr_t &id_, fl_uintptr_t &mask_);
|
||||
void draw_bitmap(Fl_Bitmap *bm,int XP, int YP, int WP, int HP, int cx, int cy);
|
||||
void cache(Fl_Bitmap *img);
|
||||
void delete_bitmask(Fl_Bitmask bm);
|
||||
virtual void delete_bitmask(fl_uintptr_t bm);
|
||||
void cache(Fl_Pixmap *pxm);
|
||||
void draw_pixmap(Fl_Pixmap *rgb,int XP, int YP, int WP, int HP, int cx, int cy);
|
||||
void uncache_pixmap(fl_uintptr_t p);
|
||||
|
@ -889,7 +889,7 @@ void Fl_Cairo_Graphics_Driver::uncache_pixmap(fl_uintptr_t p) {
|
||||
}
|
||||
|
||||
|
||||
void Fl_Cairo_Graphics_Driver::delete_bitmask(Fl_Bitmask bm) {
|
||||
void Fl_Cairo_Graphics_Driver::delete_bitmask(fl_uintptr_t bm) {
|
||||
cairo_pattern_t *pat = (cairo_pattern_t*)bm;
|
||||
if (pat) {
|
||||
cairo_surface_t *surf;
|
||||
|
@ -69,8 +69,9 @@ public:
|
||||
virtual void *gc() {return gc_;}
|
||||
|
||||
// --- bitmap stuff
|
||||
Fl_Bitmask create_bitmask(int w, int h, const uchar *array);
|
||||
void delete_bitmask(Fl_Bitmask bm);
|
||||
HBITMAP create_bitmask(int w, int h, const uchar *array); // NOT virtual
|
||||
virtual void delete_bitmask(fl_uintptr_t bm);
|
||||
HBITMAP create_alphamask(int w, int h, int d, int ld, const uchar *array);
|
||||
virtual void draw_unscaled(const char* str, int n, int x, int y);
|
||||
virtual void draw_unscaled(int angle, const char *str, int n, int x, int y);
|
||||
virtual void rtl_draw_unscaled(const char* str, int n, int x, int y);
|
||||
|
@ -334,11 +334,11 @@ void Fl_GDI_Graphics_Driver::colored_rectf(int x, int y, int w, int h, uchar r,
|
||||
}
|
||||
#endif
|
||||
|
||||
// 'fl_create_bitmask()' - Create an N-bit bitmap for masking...
|
||||
Fl_Bitmask Fl_GDI_Graphics_Driver::create_bitmask(int w, int h, const uchar *data) {
|
||||
// Create an N-bit bitmap for masking...
|
||||
HBITMAP Fl_GDI_Graphics_Driver::create_bitmask(int w, int h, const uchar *data) {
|
||||
// this won't work when the user changes display mode during run or
|
||||
// has two screens with differnet depths
|
||||
Fl_Bitmask bm;
|
||||
HBITMAP bm;
|
||||
static uchar hiNibble[16] =
|
||||
{ 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
|
||||
0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0 };
|
||||
@ -393,7 +393,7 @@ Fl_Bitmask Fl_GDI_Graphics_Driver::create_bitmask(int w, int h, const uchar *dat
|
||||
return bm;
|
||||
}
|
||||
|
||||
void Fl_GDI_Graphics_Driver::delete_bitmask(Fl_Bitmask bm) {
|
||||
void Fl_GDI_Graphics_Driver::delete_bitmask(fl_uintptr_t bm) {
|
||||
DeleteObject((HGDIOBJ)bm);
|
||||
}
|
||||
|
||||
@ -476,6 +476,78 @@ void Fl_GDI_Printer_Graphics_Driver::draw_bitmap(Fl_Bitmap *bm, int XP, int YP,
|
||||
}
|
||||
|
||||
|
||||
// Create a 1-bit mask used for alpha blending
|
||||
HBITMAP Fl_GDI_Graphics_Driver::create_alphamask(int w, int h, int d, int ld, const uchar *array) {
|
||||
HBITMAP bm;
|
||||
int bmw = (w + 7) / 8;
|
||||
uchar *bitmap = new uchar[bmw * h];
|
||||
uchar *bitptr, bit;
|
||||
const uchar *dataptr;
|
||||
int x, y;
|
||||
static uchar dither[16][16] = { // Simple 16x16 Floyd dither
|
||||
{ 0, 128, 32, 160, 8, 136, 40, 168,
|
||||
2, 130, 34, 162, 10, 138, 42, 170 },
|
||||
{ 192, 64, 224, 96, 200, 72, 232, 104,
|
||||
194, 66, 226, 98, 202, 74, 234, 106 },
|
||||
{ 48, 176, 16, 144, 56, 184, 24, 152,
|
||||
50, 178, 18, 146, 58, 186, 26, 154 },
|
||||
{ 240, 112, 208, 80, 248, 120, 216, 88,
|
||||
242, 114, 210, 82, 250, 122, 218, 90 },
|
||||
{ 12, 140, 44, 172, 4, 132, 36, 164,
|
||||
14, 142, 46, 174, 6, 134, 38, 166 },
|
||||
{ 204, 76, 236, 108, 196, 68, 228, 100,
|
||||
206, 78, 238, 110, 198, 70, 230, 102 },
|
||||
{ 60, 188, 28, 156, 52, 180, 20, 148,
|
||||
62, 190, 30, 158, 54, 182, 22, 150 },
|
||||
{ 252, 124, 220, 92, 244, 116, 212, 84,
|
||||
254, 126, 222, 94, 246, 118, 214, 86 },
|
||||
{ 3, 131, 35, 163, 11, 139, 43, 171,
|
||||
1, 129, 33, 161, 9, 137, 41, 169 },
|
||||
{ 195, 67, 227, 99, 203, 75, 235, 107,
|
||||
193, 65, 225, 97, 201, 73, 233, 105 },
|
||||
{ 51, 179, 19, 147, 59, 187, 27, 155,
|
||||
49, 177, 17, 145, 57, 185, 25, 153 },
|
||||
{ 243, 115, 211, 83, 251, 123, 219, 91,
|
||||
241, 113, 209, 81, 249, 121, 217, 89 },
|
||||
{ 15, 143, 47, 175, 7, 135, 39, 167,
|
||||
13, 141, 45, 173, 5, 133, 37, 165 },
|
||||
{ 207, 79, 239, 111, 199, 71, 231, 103,
|
||||
205, 77, 237, 109, 197, 69, 229, 101 },
|
||||
{ 63, 191, 31, 159, 55, 183, 23, 151,
|
||||
61, 189, 29, 157, 53, 181, 21, 149 },
|
||||
{ 254, 127, 223, 95, 247, 119, 215, 87,
|
||||
253, 125, 221, 93, 245, 117, 213, 85 }
|
||||
};
|
||||
|
||||
// Generate a 1-bit "screen door" alpha mask; not always pretty, but
|
||||
// definitely fast... In the future we may be able to support things
|
||||
// like the RENDER extension in XFree86, when available, to provide
|
||||
// true RGBA-blended rendering. See:
|
||||
//
|
||||
// http://www.xfree86.org/~keithp/render/protocol.html
|
||||
//
|
||||
// for more info on XRender...
|
||||
//
|
||||
memset(bitmap, 0, bmw * h);
|
||||
|
||||
for (dataptr = array + d - 1, y = 0; y < h; y ++, dataptr += ld)
|
||||
for (bitptr = bitmap + y * bmw, bit = 1, x = 0; x < w; x ++, dataptr += d) {
|
||||
if (*dataptr > dither[x & 15][y & 15])
|
||||
*bitptr |= bit;
|
||||
if (bit < 128) bit <<= 1;
|
||||
else {
|
||||
bit = 1;
|
||||
bitptr ++;
|
||||
}
|
||||
}
|
||||
|
||||
bm = create_bitmask(w, h, bitmap);
|
||||
delete[] bitmap;
|
||||
|
||||
return bm;
|
||||
}
|
||||
|
||||
|
||||
void Fl_GDI_Graphics_Driver::cache(Fl_RGB_Image *img)
|
||||
{
|
||||
Fl_Image_Surface *surface = new Fl_Image_Surface(img->data_w(), img->data_h());
|
||||
@ -485,7 +557,7 @@ void Fl_GDI_Graphics_Driver::cache(Fl_RGB_Image *img)
|
||||
} else {
|
||||
fl_draw_image(img->array, 0, 0, img->data_w(), img->data_h(), img->d(), img->ld());
|
||||
if (img->d() == 2 || img->d() == 4) {
|
||||
*Fl_Graphics_Driver::mask(img) = (fl_uintptr_t)fl_create_alphamask(img->data_w(), img->data_h(), img->d(), img->ld(), img->array);
|
||||
*Fl_Graphics_Driver::mask(img) = (fl_uintptr_t)create_alphamask(img->data_w(), img->data_h(), img->d(), img->ld(), img->array);
|
||||
}
|
||||
}
|
||||
Fl_Surface_Device::pop_current();
|
||||
@ -586,13 +658,13 @@ void Fl_GDI_Graphics_Driver::uncache(Fl_RGB_Image*, fl_uintptr_t &id_, fl_uintpt
|
||||
}
|
||||
|
||||
if (mask_) {
|
||||
fl_delete_bitmask((Fl_Bitmask)mask_);
|
||||
delete_bitmask(mask_);
|
||||
mask_ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// 'fl_create_bitmap()' - Create a 1-bit bitmap for drawing...
|
||||
static Fl_Bitmask fl_create_bitmap(int w, int h, const uchar *data) {
|
||||
static HBITMAP fl_create_bitmap(int w, int h, const uchar *data) {
|
||||
// we need to pad the lines out to words & swap the bits
|
||||
// in each byte.
|
||||
int w1 = (w + 7) / 8;
|
||||
@ -600,7 +672,7 @@ static Fl_Bitmask fl_create_bitmap(int w, int h, const uchar *data) {
|
||||
uchar* newarray = new uchar[w2*h];
|
||||
const uchar* src = data;
|
||||
uchar* dest = newarray;
|
||||
Fl_Bitmask bm;
|
||||
HBITMAP bm;
|
||||
static uchar reverse[16] = /* Bit reversal lookup table */
|
||||
{ 0x00, 0x88, 0x44, 0xcc, 0x22, 0xaa, 0x66, 0xee,
|
||||
0x11, 0x99, 0x55, 0xdd, 0x33, 0xbb, 0x77, 0xff };
|
||||
@ -731,8 +803,7 @@ void Fl_GDI_Graphics_Driver::cache(Fl_Pixmap *img) {
|
||||
fl_draw_pixmap(img->data(), 0, 0, FL_BLACK);
|
||||
uchar *bitmap = *pbitmap;
|
||||
if (bitmap) {
|
||||
// call fl_create_bitmask here because "this" is not the current graphics driver
|
||||
*Fl_Graphics_Driver::mask(img) = (fl_uintptr_t)fl_create_bitmask(img->data_w(), img->data_h(), bitmap);
|
||||
*Fl_Graphics_Driver::mask(img) = (fl_uintptr_t)create_bitmask(img->data_w(), img->data_h(), bitmap);
|
||||
delete[] bitmap;
|
||||
}
|
||||
*pbitmap = 0;
|
||||
|
@ -248,8 +248,6 @@ public:
|
||||
void draw_bitmap(Fl_Bitmap * bitmap,int XP, int YP, int WP, int HP, int cx, int cy);
|
||||
void draw_rgb(Fl_RGB_Image * rgb,int XP, int YP, int WP, int HP, int cx, int cy);
|
||||
~Fl_PostScript_Graphics_Driver();
|
||||
// ---
|
||||
Fl_Bitmask create_bitmask(int /*w*/, int /*h*/, const uchar * /*array*/) { return 0L; }
|
||||
virtual int has_feature(driver_feature feature_mask) { return feature_mask & PRINTER; }
|
||||
|
||||
void ps_origin(int x, int y);
|
||||
|
@ -65,8 +65,8 @@ public:
|
||||
char can_do_alpha_blending();
|
||||
|
||||
// --- bitmap stuff
|
||||
Fl_Bitmask create_bitmask(int w, int h, const uchar *array);
|
||||
void delete_bitmask(Fl_Bitmask bm);
|
||||
CGImageRef create_bitmask(int w, int h, const uchar *array); // NOT virtual
|
||||
virtual void delete_bitmask(fl_uintptr_t bm);
|
||||
void draw_pixmap(Fl_Pixmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
|
||||
void draw_bitmap(Fl_Bitmap *pxm, int XP, int YP, int WP, int HP, int cx, int cy);
|
||||
void draw_rgb(Fl_RGB_Image *img, int XP, int YP, int WP, int HP, int cx, int cy);
|
||||
|
@ -207,7 +207,7 @@ void Fl_Quartz_Graphics_Driver::draw_pixmap(Fl_Pixmap *pxm, int XP, int YP, int
|
||||
draw_CGImage(cgimg, X,Y,W,H, cx,cy, pxm->w(), pxm->h());
|
||||
}
|
||||
|
||||
Fl_Bitmask Fl_Quartz_Graphics_Driver::create_bitmask(int w, int h, const uchar *array) {
|
||||
CGImageRef Fl_Quartz_Graphics_Driver::create_bitmask(int w, int h, const uchar *array) {
|
||||
static uchar reverse[16] = /* Bit reversal lookup table */
|
||||
{ 0x00, 0x88, 0x44, 0xcc, 0x22, 0xaa, 0x66, 0xee,
|
||||
0x11, 0x99, 0x55, 0xdd, 0x33, 0xbb, 0x77, 0xff };
|
||||
@ -221,10 +221,10 @@ Fl_Bitmask Fl_Quartz_Graphics_Driver::create_bitmask(int w, int h, const uchar *
|
||||
CGDataProviderRef srcp = CGDataProviderCreateWithData( NULL, bmask, rowBytes*h, dataReleaseCB);
|
||||
CGImageRef id_ = CGImageMaskCreate( w, h, 1, 1, rowBytes, srcp, 0L, false);
|
||||
CGDataProviderRelease(srcp);
|
||||
return (Fl_Bitmask)id_;
|
||||
return id_;
|
||||
}
|
||||
|
||||
void Fl_Quartz_Graphics_Driver::delete_bitmask(Fl_Bitmask bm) {
|
||||
void Fl_Quartz_Graphics_Driver::delete_bitmask(fl_uintptr_t bm) {
|
||||
if (bm) CGImageRelease((CGImageRef)bm);
|
||||
}
|
||||
|
||||
|
@ -119,8 +119,8 @@ public:
|
||||
static int fl_overlay;
|
||||
|
||||
// --- bitmap stuff
|
||||
Fl_Bitmask create_bitmask(int w, int h, const uchar *array);
|
||||
void delete_bitmask(Fl_Bitmask bm);
|
||||
unsigned long create_bitmask(int w, int h, const uchar *array); // NOT virtual
|
||||
virtual void delete_bitmask(fl_uintptr_t bm);
|
||||
virtual void draw_unscaled(const char* str, int n, int x, int y);
|
||||
virtual void draw_unscaled(int angle, const char *str, int n, int x, int y);
|
||||
virtual void rtl_draw_unscaled(const char* str, int n, int x, int y);
|
||||
|
@ -613,13 +613,13 @@ void Fl_Xlib_Graphics_Driver::colored_rectf(int x, int y, int w, int h, uchar r,
|
||||
}
|
||||
}
|
||||
|
||||
Fl_Bitmask Fl_Xlib_Graphics_Driver::create_bitmask(int w, int h, const uchar *data) {
|
||||
unsigned long Fl_Xlib_Graphics_Driver::create_bitmask(int w, int h, const uchar *data) {
|
||||
return XCreateBitmapFromData(fl_display, fl_window, (const char *)data,
|
||||
(w+7)&-8, h);
|
||||
}
|
||||
|
||||
void Fl_Xlib_Graphics_Driver::delete_bitmask(Fl_Bitmask bm) {
|
||||
XFreePixmap(fl_display, bm);
|
||||
void Fl_Xlib_Graphics_Driver::delete_bitmask(fl_uintptr_t bm) {
|
||||
XFreePixmap(fl_display, (unsigned long)bm);
|
||||
}
|
||||
|
||||
void Fl_Xlib_Graphics_Driver::draw_fixed(Fl_Bitmap *bm, int X, int Y, int W, int H, int cx, int cy) {
|
||||
|
Loading…
Reference in New Issue
Block a user