Premultiplied Alpha is now exepcted on Mac too.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@46361 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -24,10 +24,10 @@
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
%{
|
%{
|
||||||
// See http://tinyurl.com/e5adr for what premultiplying alpha means. It
|
// See http://tinyurl.com/e5adr for what premultiplying alpha means. wxMSW and
|
||||||
// appears to me that the other platforms are already doing it, so I'll just
|
// wxMac want to have the values premultiplied by the alpha value, but the
|
||||||
// automatically do it for wxMSW here.
|
// other platforms don't. These macros help keep the code clean.
|
||||||
#ifdef __WXMSW__
|
#if defined(__WXMSW__) || (defined(__WXMAC__) && wxMAC_USE_CORE_GRAPHICS)
|
||||||
#define wxPy_premultiply(p, a) ((p) * (a) / 0xff)
|
#define wxPy_premultiply(p, a) ((p) * (a) / 0xff)
|
||||||
#define wxPy_unpremultiply(p, a) ((a) ? ((p) * 0xff / (a)) : (p))
|
#define wxPy_unpremultiply(p, a) ((a) ? ((p) * 0xff / (a)) : (p))
|
||||||
#else
|
#else
|
||||||
@@ -500,8 +500,8 @@ def BitmapFromBuffer(width, height, dataBuffer, alphaBuffer=None):
|
|||||||
expected to contain a series of RGB bytes and be width*height*3
|
expected to contain a series of RGB bytes and be width*height*3
|
||||||
bytes long. A buffer object can optionally be supplied for the
|
bytes long. A buffer object can optionally be supplied for the
|
||||||
image's alpha channel data, and it is expected to be width*height
|
image's alpha channel data, and it is expected to be width*height
|
||||||
bytes long. On Windows the RGB values are 'premultiplied' by the
|
bytes long. On Windows and Mac the RGB values are 'premultiplied'
|
||||||
alpha values. (The other platforms do the multiplication
|
by the alpha values. (The other platforms do the multiplication
|
||||||
themselves.)
|
themselves.)
|
||||||
|
|
||||||
Unlike `wx.ImageFromBuffer` the bitmap created with this function
|
Unlike `wx.ImageFromBuffer` the bitmap created with this function
|
||||||
@@ -567,8 +567,8 @@ def BitmapFromBufferRGBA(width, height, dataBuffer):
|
|||||||
parameter must be a Python object that implements the buffer
|
parameter must be a Python object that implements the buffer
|
||||||
interface, such as a string, array, etc. The dataBuffer object is
|
interface, such as a string, array, etc. The dataBuffer object is
|
||||||
expected to contain a series of RGBA bytes (red, green, blue and
|
expected to contain a series of RGBA bytes (red, green, blue and
|
||||||
alpha) and be width*height*4 bytes long. On Windows the RGB
|
alpha) and be width*height*4 bytes long. On Windows and Mac the
|
||||||
values are 'premultiplied' by the alpha values. (The other
|
RGB values are 'premultiplied' by the alpha values. (The other
|
||||||
platforms do the multiplication themselves.)
|
platforms do the multiplication themselves.)
|
||||||
|
|
||||||
Unlike `wx.ImageFromBuffer` the bitmap created with this function
|
Unlike `wx.ImageFromBuffer` the bitmap created with this function
|
||||||
|
Reference in New Issue
Block a user