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
This commit is contained in:
parent
4715e1593e
commit
f6cb583e27
@ -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))
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user