Add wxHAS_PREMULTIPLIED_ALPHA to abstract if wxBitmap pixels are premultiplied.
All previous relevant platform-specific tests have been changed to use this symbol. Also, samples/image now premultiplies conditionally, correcting a visual anomaly on wxGTK.
This commit is contained in:
parent
17c34d41ba
commit
fce4941404
7 changed files with 86 additions and 42 deletions
|
|
@ -101,12 +101,12 @@ wxBitmap CreateBitmapRGBA(int w, int h, bool withMask)
|
|||
const wxColour clrBg(*wxGREEN);
|
||||
const unsigned char alpha = 51;
|
||||
|
||||
#if defined(__WXMSW__) || defined(__WXOSX__) || defined(__WXQT__)
|
||||
#ifdef wxHAS_PREMULTIPLIED_ALPHA
|
||||
// premultiplied values
|
||||
const wxColour clrFgAlpha(((clrFg.Red() * alpha) + 127) / 255, ((clrFg.Green() * alpha) + 127) / 255, ((clrFg.Blue() * alpha) + 127) / 255);
|
||||
#else
|
||||
const wxColour clrFgAlpha(clrFg);
|
||||
#endif // __WXMSW__ || __WXOSX__ || __WXQT__
|
||||
#endif // wxHAS_PREMULTIPLIED_ALPHA
|
||||
|
||||
wxAlphaPixelData data(bmp);
|
||||
REQUIRE(data);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue