diff options
| author | Manolo Gouy <Manolo> | 2012-03-12 11:55:50 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2012-03-12 11:55:50 +0000 |
| commit | f6cb583e27ffd6046da7a28edc35fc8001ea9415 (patch) | |
| tree | 6ebefa26d9d18394f37cce530e30e86392624ea3 | |
| parent | 4715e1593ede95a320f618c026bd8c886163755a (diff) | |
Replaced fl_copy_offscreen_with_alpha() by Fl_GDI_Graphics_Driver::copy_offscreen_with_alpha() and
fl_create_offscreen_with_alpha() by Fl_Quartz_Graphics_Driver::create_offscreen_with_alpha()
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9278 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | FL/Fl_Device.H | 8 | ||||
| -rw-r--r-- | FL/win32.H | 3 | ||||
| -rw-r--r-- | src/Fl_Double_Window.cxx | 6 | ||||
| -rw-r--r-- | src/Fl_Image.cxx | 4 | ||||
| -rw-r--r-- | src/Fl_Pixmap.cxx | 8 | ||||
| -rw-r--r-- | src/Fl_cocoa.mm | 5 | ||||
| -rw-r--r-- | src/fl_cursor.cxx | 15 |
7 files changed, 23 insertions, 26 deletions
diff --git a/FL/Fl_Device.H b/FL/Fl_Device.H index 07bda3f35..7da51df50 100644 --- a/FL/Fl_Device.H +++ b/FL/Fl_Device.H @@ -4,7 +4,7 @@ // Definition of classes Fl_Device, Fl_Graphics_Driver, Fl_Surface_Device, Fl_Display_Device // for the Fast Light Tool Kit (FLTK). // -// Copyright 2010-2011 by Bill Spitzak and others. +// Copyright 2010-2012 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -421,6 +421,9 @@ public: void text_extents(const char*, int n, int& dx, int& dy, int& w, int& h); int height(); int descent(); +#if ! defined(FL_DOXYGEN) + static Fl_Offscreen create_offscreen_with_alpha(int w, int h); +#endif }; #endif #if defined(WIN32) || defined(FL_DOXYGEN) @@ -451,6 +454,9 @@ public: void text_extents(const char*, int n, int& dx, int& dy, int& w, int& h); int height(); int descent(); +#if ! defined(FL_DOXYGEN) + void copy_offscreen_with_alpha(int x,int y,int w,int h,HBITMAP bitmap,int srcx,int srcy); +#endif }; #endif #if !(defined(__APPLE__) || defined(WIN32)) diff --git a/FL/win32.H b/FL/win32.H index d8c59cf7e..dec7cebbf 100644 --- a/FL/win32.H +++ b/FL/win32.H @@ -3,7 +3,7 @@ // // WIN32 header file for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2011 by Bill Spitzak and others. +// Copyright 1998-2012 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -136,7 +136,6 @@ typedef HBITMAP Fl_Offscreen; FL_EXPORT void fl_copy_offscreen(int x,int y,int w,int h,HBITMAP pixmap,int srcx,int srcy); -FL_EXPORT void fl_copy_offscreen_with_alpha(int x,int y,int w,int h,HBITMAP pixmap,int srcx,int srcy); #define fl_delete_offscreen(bitmap) DeleteObject(bitmap) // Bitmap masks diff --git a/src/Fl_Double_Window.cxx b/src/Fl_Double_Window.cxx index 0e2919d7a..bec91f1c1 100644 --- a/src/Fl_Double_Window.cxx +++ b/src/Fl_Double_Window.cxx @@ -167,7 +167,7 @@ static void fl_copy_offscreen_to_display(int x,int y,int w,int h,HBITMAP bitmap, DeleteDC(new_gc); } -void fl_copy_offscreen_with_alpha(int x,int y,int w,int h,HBITMAP bitmap,int srcx,int srcy) { +void Fl_GDI_Graphics_Driver::copy_offscreen_with_alpha(int x,int y,int w,int h,HBITMAP bitmap,int srcx,int srcy) { HDC new_gc = CreateCompatibleDC(fl_gc); int save = SaveDC(new_gc); SelectObject(new_gc, bitmap); @@ -176,7 +176,7 @@ void fl_copy_offscreen_with_alpha(int x,int y,int w,int h,HBITMAP bitmap,int src // if to printer, always try alpha_blend int to_display = Fl_Surface_Device::surface()->class_name() == Fl_Display_Device::class_id; // true iff display output if ( (to_display && fl_can_do_alpha_blending()) || Fl_Surface_Device::surface()->class_name() == Fl_Printer::class_id) { - alpha_ok = fl_alpha_blend(fl_gc, x, y, w, h, new_gc, srcx, srcy, w, h, blendfunc); + if (fl_alpha_blend) alpha_ok = fl_alpha_blend(fl_gc, x, y, w, h, new_gc, srcx, srcy, w, h, blendfunc); } // if that failed (it shouldn't), still copy the bitmap over, but now alpha is 1 if (!alpha_ok) { @@ -194,7 +194,7 @@ char fl_can_do_alpha_blending() { return 1; } -Fl_Offscreen fl_create_offscreen_with_alpha(int w, int h) { +Fl_Offscreen Fl_Quartz_Graphics_Driver::create_offscreen_with_alpha(int w, int h) { void *data = calloc(w*h,4); CGColorSpaceRef lut = CGColorSpaceCreateDeviceRGB(); CGContextRef ctx = CGBitmapContextCreate( diff --git a/src/Fl_Image.cxx b/src/Fl_Image.cxx index 4d280d3ac..891fff48b 100644 --- a/src/Fl_Image.cxx +++ b/src/Fl_Image.cxx @@ -3,7 +3,7 @@ // // Image drawing code for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2010 by Bill Spitzak and others. +// Copyright 1998-2012 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -513,7 +513,7 @@ void Fl_GDI_Graphics_Driver::draw(Fl_RGB_Image *img, int XP, int YP, int WP, int RestoreDC(new_gc,save); DeleteDC(new_gc); } else if (img->d()==2 || img->d()==4) { - fl_copy_offscreen_with_alpha(X, Y, W, H, (Fl_Offscreen)img->id_, cx, cy); + copy_offscreen_with_alpha(X, Y, W, H, (Fl_Offscreen)img->id_, cx, cy); } else { fl_copy_offscreen(X, Y, W, H, (Fl_Offscreen)img->id_, cx, cy); } diff --git a/src/Fl_Pixmap.cxx b/src/Fl_Pixmap.cxx index d77212822..4b76c5e0d 100644 --- a/src/Fl_Pixmap.cxx +++ b/src/Fl_Pixmap.cxx @@ -3,7 +3,7 @@ // // Pixmap drawing code for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2010 by Bill Spitzak and others. +// Copyright 1998-2012 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -48,10 +48,6 @@ extern void fl_release_dc(HWND, HDC); // located in Fl_win32.cxx #endif -#ifdef __APPLE_QUARTZ__ -extern Fl_Offscreen fl_create_offscreen_with_alpha(int w, int h); -#endif - extern uchar **fl_mask_bitmap; // used by fl_draw_pixmap.cxx to store mask void fl_restore_clip(); // in fl_rect.cxx @@ -106,7 +102,7 @@ void Fl_Quartz_Graphics_Driver::draw(Fl_Pixmap *pxm, int XP, int YP, int WP, int return; } if (!pxm->id_) { - pxm->id_ = fl_create_offscreen_with_alpha(pxm->w(), pxm->h()); + pxm->id_ = create_offscreen_with_alpha(pxm->w(), pxm->h()); fl_begin_offscreen((Fl_Offscreen)pxm->id_); fl_draw_pixmap(pxm->data(), 0, 0, FL_GREEN); fl_end_offscreen(); diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index f828a5865..2f41c7c48 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -78,7 +78,6 @@ typedef unsigned int NSUInteger; // external functions extern void fl_fix_focus(); -extern Fl_Offscreen fl_create_offscreen_with_alpha(int w, int h); extern unsigned short *fl_compute_macKeyLookUp(); // forward definition of functions in this file @@ -3154,7 +3153,7 @@ static NSImage *imageFromText(const char *text, int *pwidth, int *pheight) } height = nl * fl_height() + 3; width += 6; - Fl_Offscreen off = fl_create_offscreen_with_alpha(width, height); + Fl_Offscreen off = Fl_Quartz_Graphics_Driver::create_offscreen_with_alpha(width, height); fl_begin_offscreen(off); CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0); fl_rectf(0,0,width,height); @@ -3183,7 +3182,7 @@ static NSImage *imageFromText(const char *text, int *pwidth, int *pheight) static NSImage *defaultDragImage(int *pwidth, int *pheight) { const int width = 16, height = 16; - Fl_Offscreen off = fl_create_offscreen_with_alpha(width, height); + Fl_Offscreen off = Fl_Quartz_Graphics_Driver::create_offscreen_with_alpha(width, height); fl_begin_offscreen(off); CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0); fl_rectf(0,0,width,height); diff --git a/src/fl_cursor.cxx b/src/fl_cursor.cxx index 831874264..c9b372915 100644 --- a/src/fl_cursor.cxx +++ b/src/fl_cursor.cxx @@ -3,7 +3,7 @@ // // Mouse cursor support for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2010 by Bill Spitzak and others. +// Copyright 1998-2012 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -125,13 +125,10 @@ void Fl_Window::cursor(Fl_Cursor c, Fl_Color c1, Fl_Color c2) { # error "Either __LITTLE_ENDIAN__ or __BIG_ENDIAN__ must be defined" #endif -extern Fl_Offscreen fl_create_offscreen_with_alpha(int w, int h); - - CGContextRef Fl_X::help_cursor_image(void) { int w = 20, h = 20; - Fl_Offscreen off = fl_create_offscreen_with_alpha(w, h); + Fl_Offscreen off = Fl_Quartz_Graphics_Driver::create_offscreen_with_alpha(w, h); fl_begin_offscreen(off); CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0); fl_rectf(0,0,w,h); @@ -145,7 +142,7 @@ CGContextRef Fl_X::help_cursor_image(void) CGContextRef Fl_X::none_cursor_image(void) { int w = 20, h = 20; - Fl_Offscreen off = fl_create_offscreen_with_alpha(w, h); + Fl_Offscreen off = Fl_Quartz_Graphics_Driver::create_offscreen_with_alpha(w, h); fl_begin_offscreen(off); CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0); fl_rectf(0,0,w,h); @@ -158,7 +155,7 @@ CGContextRef Fl_X::watch_cursor_image(void) int w, h, r = 5; w = 2*r+6; h = 4*r; - Fl_Offscreen off = fl_create_offscreen_with_alpha(w, h); + Fl_Offscreen off = Fl_Quartz_Graphics_Driver::create_offscreen_with_alpha(w, h); fl_begin_offscreen(off); CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0); fl_rectf(0,0,w,h); @@ -182,7 +179,7 @@ CGContextRef Fl_X::nesw_cursor_image(void) { int c = 7, r = 2*c; int w = r, h = r; - Fl_Offscreen off = fl_create_offscreen_with_alpha(w, h); + Fl_Offscreen off = Fl_Quartz_Graphics_Driver::create_offscreen_with_alpha(w, h); fl_begin_offscreen(off); CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0); fl_rectf(0,0,w,h); @@ -202,7 +199,7 @@ CGContextRef Fl_X::nwse_cursor_image(void) { int c = 7, r = 2*c; int w = r, h = r; - Fl_Offscreen off = fl_create_offscreen_with_alpha(w, h); + Fl_Offscreen off = Fl_Quartz_Graphics_Driver::create_offscreen_with_alpha(w, h); fl_begin_offscreen(off); CGContextSetRGBFillColor( (CGContextRef)off, 0,0,0,0); fl_rectf(0,0,w,h); |
