Fix transparency stuff for MacOS X; currently it appears that CopyDeepMask
does not work with an 8-bit mask image, so we can't provide true alpha blending just yet... (just the screen-door transparency provided on X11 and WIN32...) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2085 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
e1828d045f
commit
bcb2033a96
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Bitmap.cxx,v 1.5.2.4.2.12 2002/04/15 12:19:01 easysw Exp $"
|
||||
// "$Id: Fl_Bitmap.cxx,v 1.5.2.4.2.13 2002/04/15 17:18:48 easysw Exp $"
|
||||
//
|
||||
// Bitmap drawing routines for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -207,7 +207,12 @@ void fl_delete_bitmask(Fl_Bitmask bm) {
|
||||
#endif // __APPLE__
|
||||
|
||||
|
||||
#ifdef __APPLE__
|
||||
// MRS: Currently it appears that CopyDeepMask() does not work with an 8-bit alpha mask.
|
||||
// If you want to test/fix this, uncomment the "#ifdef __APPLE__" and comment out
|
||||
// the "#if 0" here. Also see Fl_Image.cxx for a similar check...
|
||||
|
||||
//#ifdef __APPLE__
|
||||
#if 0
|
||||
// Create an 8-bit mask used for alpha blending
|
||||
Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *array) {
|
||||
Rect srcRect;
|
||||
@ -230,13 +235,14 @@ Fl_Bitmask fl_create_alphamask(int w, int h, int d, int ld, const uchar *array)
|
||||
{
|
||||
PixMapPtr pmp = *pm;
|
||||
// verify the parameters for direct memory write
|
||||
if ( pmp->pixelType == 0 || pmp->pixelSize == 1 || pmp->cmpCount == 1 || pmp->cmpSize == 1 )
|
||||
if ( pmp->pixelType == 0 || pmp->pixelSize == 8 || pmp->cmpCount == 1 || pmp->cmpSize == 8 )
|
||||
{
|
||||
// Copy alpha values from the source array to the pixmap...
|
||||
array += d - 1;
|
||||
for (int y = h; y > 0; y --, array += ld) {
|
||||
int rowoffset = (pmp->rowBytes & 0x3fff) - w;
|
||||
for (int y = h; y > 0; y --, array += ld, base += rowoffset) {
|
||||
for (int x = w; x > 0; x --, array += d) {
|
||||
*pmp++ = *array;
|
||||
*base++ = 255 /*255 - *array*/;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -456,5 +462,5 @@ Fl_Image *Fl_Bitmap::copy(int W, int H) {
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Bitmap.cxx,v 1.5.2.4.2.12 2002/04/15 12:19:01 easysw Exp $".
|
||||
// End of "$Id: Fl_Bitmap.cxx,v 1.5.2.4.2.13 2002/04/15 17:18:48 easysw Exp $".
|
||||
//
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// "$Id: Fl_Image.cxx,v 1.5.2.3.2.18 2002/04/15 12:19:01 easysw Exp $"
|
||||
// "$Id: Fl_Image.cxx,v 1.5.2.3.2.19 2002/04/15 17:18:48 easysw Exp $"
|
||||
//
|
||||
// Image drawing code for the Fast Light Tool Kit (FLTK).
|
||||
//
|
||||
@ -283,8 +283,6 @@ void Fl_RGB_Image::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
|
||||
fl_copy_offscreen(X, Y, W, H, id, cx, cy);
|
||||
}
|
||||
#elif defined(__APPLE__)
|
||||
fl_copy_offscreen(X, Y, W, H, id, cx, cy);
|
||||
|
||||
if (mask) {
|
||||
Rect src, dst;
|
||||
src.left = 0; src.right = w();
|
||||
@ -296,10 +294,21 @@ void Fl_RGB_Image::draw(int XP, int YP, int WP, int HP, int cx, int cy) {
|
||||
RGBBackColor(&rgb);
|
||||
rgb.red = 0x0000; rgb.green = 0x0000; rgb.blue = 0x0000;
|
||||
RGBForeColor(&rgb);
|
||||
|
||||
#if 0
|
||||
// MRS: This *should* work, but doesn't on my system (iBook); change to
|
||||
// "#if 1" and restore the corresponding code in Fl_Bitmap.cxx
|
||||
// to test the real alpha channel support.
|
||||
CopyDeepMask(GetPortBitMapForCopyBits((GrafPtr)id),
|
||||
GetPortBitMapForCopyBits((GrafPtr)mask),
|
||||
GetPortBitMapForCopyBits(GetWindowPort(fl_window)),
|
||||
&src, &src, &dst, blend, NULL);
|
||||
#else // Fallback to screen-door transparency...
|
||||
CopyMask(GetPortBitMapForCopyBits((GrafPtr)id),
|
||||
GetPortBitMapForCopyBits((GrafPtr)mask),
|
||||
GetPortBitMapForCopyBits(GetWindowPort(fl_window)),
|
||||
&src, &src, &dst);
|
||||
#endif // 0
|
||||
} else {
|
||||
fl_copy_offscreen(X, Y, W, H, id, cx, cy);
|
||||
}
|
||||
@ -334,5 +343,5 @@ void Fl_RGB_Image::label(Fl_Menu_Item* m) {
|
||||
|
||||
|
||||
//
|
||||
// End of "$Id: Fl_Image.cxx,v 1.5.2.3.2.18 2002/04/15 12:19:01 easysw Exp $".
|
||||
// End of "$Id: Fl_Image.cxx,v 1.5.2.3.2.19 2002/04/15 17:18:48 easysw Exp $".
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user