diff options
| author | Manolo Gouy <Manolo> | 2010-03-30 11:18:45 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2010-03-30 11:18:45 +0000 |
| commit | 0eae439b66976043ac511c00d94b990aef1e0982 (patch) | |
| tree | c55d732c41d1f687542f5c140be698eed5b87ead /src | |
| parent | d89581ebc646ff0aebf6022a6d9d9f28458dfccd (diff) | |
fl_copy_offscreen_with_alpha: when non-display output, asks if alpha-blending is possible
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7363 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Double_Window.cxx | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Fl_Double_Window.cxx b/src/Fl_Double_Window.cxx index 19d03fca0..5e1268894 100644 --- a/src/Fl_Double_Window.cxx +++ b/src/Fl_Double_Window.cxx @@ -142,15 +142,23 @@ void fl_copy_offscreen(int x,int y,int w,int h,HBITMAP bitmap,int srcx,int srcy) DeleteDC(new_gc); } +#if(WINVER < 0x0500) +#define SHADEBLENDCAPS 120 +#define SB_PIXEL_ALPHA 0x02 +#endif void fl_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); BOOL alpha_ok = 0; // first try to alpha blend - if (fl_can_do_alpha_blending()) + int to_display = Fl_Device::current()->type() < 256; // true iff display output + if ( !to_display) { // ask if non-display device can alpha-blend pixel by pixel + alpha_ok = (GetDeviceCaps(fl_gc, SHADEBLENDCAPS) == SB_PIXEL_ALPHA); + } + if (alpha_ok || (to_display && fl_can_do_alpha_blending())) 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 that failed (it shouldn't), still copy the bitmap over, but now alpha is 1 if (!alpha_ok) BitBlt(fl_gc, x, y, w, h, new_gc, srcx, srcy, SRCCOPY); RestoreDC(new_gc, save); |
