diff --git a/wxPython/src/gtk/_gdi.py b/wxPython/src/gtk/_gdi.py index bb81158846..3b09aed023 100644 --- a/wxPython/src/gtk/_gdi.py +++ b/wxPython/src/gtk/_gdi.py @@ -774,8 +774,8 @@ def BitmapFromBuffer(width, height, dataBuffer, alphaBuffer=None): expected to contain a series of RGB bytes and be width*height*3 bytes long. A buffer object can optionally be supplied for the image's alpha channel data, and it is expected to be width*height - bytes long. On Windows the RGB values are 'premultiplied' by the - alpha values. (The other platforms do the multiplication + bytes long. On Windows and Mac the RGB values are 'premultiplied' + by the alpha values. (The other platforms do the multiplication themselves.) Unlike `wx.ImageFromBuffer` the bitmap created with this function @@ -804,8 +804,8 @@ def BitmapFromBufferRGBA(width, height, dataBuffer): parameter must be a Python object that implements the buffer interface, such as a string, array, etc. The dataBuffer object is expected to contain a series of RGBA bytes (red, green, blue and - alpha) and be width*height*4 bytes long. On Windows the RGB - values are 'premultiplied' by the alpha values. (The other + alpha) and be width*height*4 bytes long. On Windows and Mac the + RGB values are 'premultiplied' by the alpha values. (The other platforms do the multiplication themselves.) Unlike `wx.ImageFromBuffer` the bitmap created with this function diff --git a/wxPython/src/gtk/_gdi_wrap.cpp b/wxPython/src/gtk/_gdi_wrap.cpp index 6cef0197b2..b5d77798f5 100644 --- a/wxPython/src/gtk/_gdi_wrap.cpp +++ b/wxPython/src/gtk/_gdi_wrap.cpp @@ -2925,10 +2925,10 @@ SWIGINTERN bool wxPen___ne__(wxPen *self,wxPen const *other){ return other ? (*s #include -// See http://tinyurl.com/e5adr for what premultiplying alpha means. It -// appears to me that the other platforms are already doing it, so I'll just -// automatically do it for wxMSW here. -#ifdef __WXMSW__ +// See http://tinyurl.com/e5adr for what premultiplying alpha means. wxMSW and +// wxMac want to have the values premultiplied by the alpha value, but the +// other platforms don't. These macros help keep the code clean. +#if defined(__WXMSW__) || (defined(__WXMAC__) && wxMAC_USE_CORE_GRAPHICS) #define wxPy_premultiply(p, a) ((p) * (a) / 0xff) #define wxPy_unpremultiply(p, a) ((a) ? ((p) * 0xff / (a)) : (p)) #else diff --git a/wxPython/src/gtk/_misc_wrap.cpp b/wxPython/src/gtk/_misc_wrap.cpp index cafaf15a44..7308275a5b 100644 --- a/wxPython/src/gtk/_misc_wrap.cpp +++ b/wxPython/src/gtk/_misc_wrap.cpp @@ -8175,6 +8175,7 @@ SWIGINTERN PyObject *_wrap_Thread_IsMain(PyObject *SWIGUNUSEDPARM(self), PyObjec if (!SWIG_Python_UnpackTuple(args,"Thread_IsMain",0,0,0)) SWIG_fail; { + if (!wxPyCheckForApp()) SWIG_fail; PyThreadState* __tstate = wxPyBeginAllowThreads(); result = (bool)wxThread_IsMain(); wxPyEndAllowThreads(__tstate); diff --git a/wxPython/src/mac/_gdi.py b/wxPython/src/mac/_gdi.py index 51046d2c14..8ea7c71ff2 100644 --- a/wxPython/src/mac/_gdi.py +++ b/wxPython/src/mac/_gdi.py @@ -777,8 +777,8 @@ def BitmapFromBuffer(width, height, dataBuffer, alphaBuffer=None): expected to contain a series of RGB bytes and be width*height*3 bytes long. A buffer object can optionally be supplied for the image's alpha channel data, and it is expected to be width*height - bytes long. On Windows the RGB values are 'premultiplied' by the - alpha values. (The other platforms do the multiplication + bytes long. On Windows and Mac the RGB values are 'premultiplied' + by the alpha values. (The other platforms do the multiplication themselves.) Unlike `wx.ImageFromBuffer` the bitmap created with this function @@ -807,8 +807,8 @@ def BitmapFromBufferRGBA(width, height, dataBuffer): parameter must be a Python object that implements the buffer interface, such as a string, array, etc. The dataBuffer object is expected to contain a series of RGBA bytes (red, green, blue and - alpha) and be width*height*4 bytes long. On Windows the RGB - values are 'premultiplied' by the alpha values. (The other + alpha) and be width*height*4 bytes long. On Windows and Mac the + RGB values are 'premultiplied' by the alpha values. (The other platforms do the multiplication themselves.) Unlike `wx.ImageFromBuffer` the bitmap created with this function diff --git a/wxPython/src/mac/_gdi_wrap.cpp b/wxPython/src/mac/_gdi_wrap.cpp index 631e3a0af5..aae8ef9979 100644 --- a/wxPython/src/mac/_gdi_wrap.cpp +++ b/wxPython/src/mac/_gdi_wrap.cpp @@ -2948,10 +2948,10 @@ SWIG_AsVal_short (PyObject * obj, short *val) #include -// See http://tinyurl.com/e5adr for what premultiplying alpha means. It -// appears to me that the other platforms are already doing it, so I'll just -// automatically do it for wxMSW here. -#ifdef __WXMSW__ +// See http://tinyurl.com/e5adr for what premultiplying alpha means. wxMSW and +// wxMac want to have the values premultiplied by the alpha value, but the +// other platforms don't. These macros help keep the code clean. +#if defined(__WXMSW__) || (defined(__WXMAC__) && wxMAC_USE_CORE_GRAPHICS) #define wxPy_premultiply(p, a) ((p) * (a) / 0xff) #define wxPy_unpremultiply(p, a) ((a) ? ((p) * 0xff / (a)) : (p)) #else diff --git a/wxPython/src/mac/_misc_wrap.cpp b/wxPython/src/mac/_misc_wrap.cpp index b9b3258abe..0cd7167ba1 100644 --- a/wxPython/src/mac/_misc_wrap.cpp +++ b/wxPython/src/mac/_misc_wrap.cpp @@ -8167,6 +8167,7 @@ SWIGINTERN PyObject *_wrap_Thread_IsMain(PyObject *SWIGUNUSEDPARM(self), PyObjec if (!SWIG_Python_UnpackTuple(args,"Thread_IsMain",0,0,0)) SWIG_fail; { + if (!wxPyCheckForApp()) SWIG_fail; PyThreadState* __tstate = wxPyBeginAllowThreads(); result = (bool)wxThread_IsMain(); wxPyEndAllowThreads(__tstate); diff --git a/wxPython/src/msw/_gdi.py b/wxPython/src/msw/_gdi.py index 84c56180f4..f85a8d805c 100644 --- a/wxPython/src/msw/_gdi.py +++ b/wxPython/src/msw/_gdi.py @@ -799,8 +799,8 @@ def BitmapFromBuffer(width, height, dataBuffer, alphaBuffer=None): expected to contain a series of RGB bytes and be width*height*3 bytes long. A buffer object can optionally be supplied for the image's alpha channel data, and it is expected to be width*height - bytes long. On Windows the RGB values are 'premultiplied' by the - alpha values. (The other platforms do the multiplication + bytes long. On Windows and Mac the RGB values are 'premultiplied' + by the alpha values. (The other platforms do the multiplication themselves.) Unlike `wx.ImageFromBuffer` the bitmap created with this function @@ -829,8 +829,8 @@ def BitmapFromBufferRGBA(width, height, dataBuffer): parameter must be a Python object that implements the buffer interface, such as a string, array, etc. The dataBuffer object is expected to contain a series of RGBA bytes (red, green, blue and - alpha) and be width*height*4 bytes long. On Windows the RGB - values are 'premultiplied' by the alpha values. (The other + alpha) and be width*height*4 bytes long. On Windows and Mac the + RGB values are 'premultiplied' by the alpha values. (The other platforms do the multiplication themselves.) Unlike `wx.ImageFromBuffer` the bitmap created with this function diff --git a/wxPython/src/msw/_gdi_wrap.cpp b/wxPython/src/msw/_gdi_wrap.cpp index 0d017c96e3..90edcb85a8 100644 --- a/wxPython/src/msw/_gdi_wrap.cpp +++ b/wxPython/src/msw/_gdi_wrap.cpp @@ -2925,10 +2925,10 @@ SWIGINTERN bool wxPen___ne__(wxPen *self,wxPen const *other){ return other ? (*s #include -// See http://tinyurl.com/e5adr for what premultiplying alpha means. It -// appears to me that the other platforms are already doing it, so I'll just -// automatically do it for wxMSW here. -#ifdef __WXMSW__ +// See http://tinyurl.com/e5adr for what premultiplying alpha means. wxMSW and +// wxMac want to have the values premultiplied by the alpha value, but the +// other platforms don't. These macros help keep the code clean. +#if defined(__WXMSW__) || (defined(__WXMAC__) && wxMAC_USE_CORE_GRAPHICS) #define wxPy_premultiply(p, a) ((p) * (a) / 0xff) #define wxPy_unpremultiply(p, a) ((a) ? ((p) * 0xff / (a)) : (p)) #else diff --git a/wxPython/src/msw/_misc_wrap.cpp b/wxPython/src/msw/_misc_wrap.cpp index 67c5935915..3c4279c902 100644 --- a/wxPython/src/msw/_misc_wrap.cpp +++ b/wxPython/src/msw/_misc_wrap.cpp @@ -8167,6 +8167,7 @@ SWIGINTERN PyObject *_wrap_Thread_IsMain(PyObject *SWIGUNUSEDPARM(self), PyObjec if (!SWIG_Python_UnpackTuple(args,"Thread_IsMain",0,0,0)) SWIG_fail; { + if (!wxPyCheckForApp()) SWIG_fail; PyThreadState* __tstate = wxPyBeginAllowThreads(); result = (bool)wxThread_IsMain(); wxPyEndAllowThreads(__tstate);