diff --git a/wxPython/src/__core_rename.i b/wxPython/src/__core_rename.i index c52f48d9fc..5ae38d0fc0 100644 --- a/wxPython/src/__core_rename.i +++ b/wxPython/src/__core_rename.i @@ -15,6 +15,7 @@ %rename(STATIC_BORDER) wxSTATIC_BORDER; %rename(TRANSPARENT_WINDOW) wxTRANSPARENT_WINDOW; %rename(NO_BORDER) wxNO_BORDER; +%rename(DEFAULT_CONTROL_BORDER) wxDEFAULT_CONTROL_BORDER; %rename(TAB_TRAVERSAL) wxTAB_TRAVERSAL; %rename(WANTS_CHARS) wxWANTS_CHARS; %rename(POPUP_WINDOW) wxPOPUP_WINDOW; @@ -496,6 +497,9 @@ %rename(InternetFSHandler) wxInternetFSHandler; %rename(ZipFSHandler) wxZipFSHandler; %rename(MemoryFSHandler) wxMemoryFSHandler; +%rename(IMAGE_ALPHA_TRANSPARENT) wxIMAGE_ALPHA_TRANSPARENT; +%rename(IMAGE_ALPHA_THRESHOLD) wxIMAGE_ALPHA_THRESHOLD; +%rename(IMAGE_ALPHA_OPAQUE) wxIMAGE_ALPHA_OPAQUE; %rename(ImageHandler) wxImageHandler; %rename(ImageHistogram) wxImageHistogram; %rename(Image) wxImage; diff --git a/wxPython/src/gtk/_core.py b/wxPython/src/gtk/_core.py index 2120e6cb58..366bb71994 100644 --- a/wxPython/src/gtk/_core.py +++ b/wxPython/src/gtk/_core.py @@ -85,6 +85,7 @@ SIMPLE_BORDER = _core_.SIMPLE_BORDER STATIC_BORDER = _core_.STATIC_BORDER TRANSPARENT_WINDOW = _core_.TRANSPARENT_WINDOW NO_BORDER = _core_.NO_BORDER +DEFAULT_CONTROL_BORDER = _core_.DEFAULT_CONTROL_BORDER TAB_TRAVERSAL = _core_.TAB_TRAVERSAL WANTS_CHARS = _core_.WANTS_CHARS POPUP_WINDOW = _core_.POPUP_WINDOW @@ -2033,6 +2034,9 @@ def MemoryFSHandler_RemoveFile(*args, **kwargs): """MemoryFSHandler_RemoveFile(String filename)""" return _core_.MemoryFSHandler_RemoveFile(*args, **kwargs) +IMAGE_ALPHA_TRANSPARENT = _core_.IMAGE_ALPHA_TRANSPARENT +IMAGE_ALPHA_THRESHOLD = _core_.IMAGE_ALPHA_THRESHOLD +IMAGE_ALPHA_OPAQUE = _core_.IMAGE_ALPHA_OPAQUE #--------------------------------------------------------------------------- class ImageHandler(Object): @@ -2241,6 +2245,15 @@ class Image(Object): """ return _core_.Image_InitAlpha(*args, **kwargs) + def IsTransparent(*args, **kwargs): + """ + IsTransparent(self, int x, int y, unsigned char threshold=IMAGE_ALPHA_THRESHOLD) -> bool + + Returns True if this pixel is masked or has an alpha value less than + the spcified threshold. + """ + return _core_.Image_IsTransparent(*args, **kwargs) + def FindFirstUnusedColour(*args, **kwargs): """ FindFirstUnusedColour(int startR=1, int startG=0, int startB=0) -> (success, r, g, b) @@ -2253,7 +2266,7 @@ class Image(Object): def ConvertAlphaToMask(*args, **kwargs): """ - ConvertAlphaToMask(self, byte threshold=128) -> bool + ConvertAlphaToMask(self, byte threshold=IMAGE_ALPHA_THRESHOLD) -> bool If the image has alpha channel, this method converts it to mask. All pixels with alpha value less than ``threshold`` are replaced with mask colour and the diff --git a/wxPython/src/gtk/_core_wrap.cpp b/wxPython/src/gtk/_core_wrap.cpp index 461ff8bddd..fbd79c5911 100644 --- a/wxPython/src/gtk/_core_wrap.cpp +++ b/wxPython/src/gtk/_core_wrap.cpp @@ -11522,6 +11522,54 @@ static PyObject *_wrap_Image_InitAlpha(PyObject *, PyObject *args, PyObject *kwa } +static PyObject *_wrap_Image_IsTransparent(PyObject *, PyObject *args, PyObject *kwargs) { + PyObject *resultobj; + wxImage *arg1 = (wxImage *) 0 ; + int arg2 ; + int arg3 ; + unsigned char arg4 = (unsigned char) wxIMAGE_ALPHA_THRESHOLD ; + bool result; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + char *kwnames[] = { + (char *) "self",(char *) "x",(char *) "y",(char *) "threshold", NULL + }; + + if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|O:Image_IsTransparent",kwnames,&obj0,&obj1,&obj2,&obj3)) goto fail; + SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_wxImage, SWIG_POINTER_EXCEPTION | 0); + if (SWIG_arg_fail(1)) SWIG_fail; + { + arg2 = (int)(SWIG_As_int(obj1)); + if (SWIG_arg_fail(2)) SWIG_fail; + } + { + arg3 = (int)(SWIG_As_int(obj2)); + if (SWIG_arg_fail(3)) SWIG_fail; + } + if (obj3) { + { + arg4 = (unsigned char)(SWIG_As_unsigned_SS_char(obj3)); + if (SWIG_arg_fail(4)) SWIG_fail; + } + } + { + PyThreadState* __tstate = wxPyBeginAllowThreads(); + result = (bool)((wxImage const *)arg1)->IsTransparent(arg2,arg3,arg4); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) SWIG_fail; + } + { + resultobj = result ? Py_True : Py_False; Py_INCREF(resultobj); + } + return resultobj; + fail: + return NULL; +} + + static PyObject *_wrap_Image_FindFirstUnusedColour(PyObject *, PyObject *args, PyObject *kwargs) { PyObject *resultobj; wxImage *arg1 = (wxImage *) 0 ; @@ -11595,7 +11643,7 @@ static PyObject *_wrap_Image_FindFirstUnusedColour(PyObject *, PyObject *args, P static PyObject *_wrap_Image_ConvertAlphaToMask(PyObject *, PyObject *args, PyObject *kwargs) { PyObject *resultobj; wxImage *arg1 = (wxImage *) 0 ; - byte arg2 = (byte) 128 ; + byte arg2 = (byte) wxIMAGE_ALPHA_THRESHOLD ; bool result; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; @@ -45456,6 +45504,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"Image_GetAlpha", (PyCFunction) _wrap_Image_GetAlpha, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Image_HasAlpha", (PyCFunction) _wrap_Image_HasAlpha, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Image_InitAlpha", (PyCFunction) _wrap_Image_InitAlpha, METH_VARARGS | METH_KEYWORDS, NULL}, + { (char *)"Image_IsTransparent", (PyCFunction) _wrap_Image_IsTransparent, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Image_FindFirstUnusedColour", (PyCFunction) _wrap_Image_FindFirstUnusedColour, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Image_ConvertAlphaToMask", (PyCFunction) _wrap_Image_ConvertAlphaToMask, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"Image_ConvertColourToAlpha", (PyCFunction) _wrap_Image_ConvertColourToAlpha, METH_VARARGS | METH_KEYWORDS, NULL}, @@ -47675,6 +47724,9 @@ SWIGEXPORT(void) SWIG_init(void) { { PyDict_SetItemString(d,"NO_BORDER", SWIG_From_int((int)(wxNO_BORDER))); } + { + PyDict_SetItemString(d,"DEFAULT_CONTROL_BORDER", SWIG_From_int((int)(wxDEFAULT_CONTROL_BORDER))); + } { PyDict_SetItemString(d,"TAB_TRAVERSAL", SWIG_From_int((int)(wxTAB_TRAVERSAL))); } @@ -49464,6 +49516,15 @@ SWIGEXPORT(void) SWIG_init(void) { wxPyPtrTypeMap_Add("wxFileSystemHandler", "wxPyFileSystemHandler"); + { + PyDict_SetItemString(d,"IMAGE_ALPHA_TRANSPARENT", SWIG_From_int((int)(wxIMAGE_ALPHA_TRANSPARENT))); + } + { + PyDict_SetItemString(d,"IMAGE_ALPHA_THRESHOLD", SWIG_From_int((int)(wxIMAGE_ALPHA_THRESHOLD))); + } + { + PyDict_SetItemString(d,"IMAGE_ALPHA_OPAQUE", SWIG_From_int((int)(wxIMAGE_ALPHA_OPAQUE))); + } SWIG_addvarlink(SWIG_globals,(char*)"NullImage",_wrap_NullImage_get, _wrap_NullImage_set); SWIG_addvarlink(SWIG_globals,(char*)"IMAGE_OPTION_FILENAME",_wrap_IMAGE_OPTION_FILENAME_get, _wrap_IMAGE_OPTION_FILENAME_set); SWIG_addvarlink(SWIG_globals,(char*)"IMAGE_OPTION_BMP_FORMAT",_wrap_IMAGE_OPTION_BMP_FORMAT_get, _wrap_IMAGE_OPTION_BMP_FORMAT_set); diff --git a/wxPython/wxPython/_core.py b/wxPython/wxPython/_core.py index 6c6b496ecf..d911101989 100644 --- a/wxPython/wxPython/_core.py +++ b/wxPython/wxPython/_core.py @@ -31,6 +31,7 @@ wxSIMPLE_BORDER = wx._core.SIMPLE_BORDER wxSTATIC_BORDER = wx._core.STATIC_BORDER wxTRANSPARENT_WINDOW = wx._core.TRANSPARENT_WINDOW wxNO_BORDER = wx._core.NO_BORDER +wxDEFAULT_CONTROL_BORDER = wx._core.DEFAULT_CONTROL_BORDER wxTAB_TRAVERSAL = wx._core.TAB_TRAVERSAL wxWANTS_CHARS = wx._core.WANTS_CHARS wxPOPUP_WINDOW = wx._core.POPUP_WINDOW @@ -673,6 +674,9 @@ __wxMemoryFSHandler_AddFile_Data = wx._core.__wxMemoryFSHandler_AddFile_Data wxMemoryFSHandler = wx._core.MemoryFSHandler wxMemoryFSHandlerPtr = wx._core.MemoryFSHandlerPtr wxMemoryFSHandler_RemoveFile = wx._core.MemoryFSHandler_RemoveFile +wxIMAGE_ALPHA_TRANSPARENT = wx._core.IMAGE_ALPHA_TRANSPARENT +wxIMAGE_ALPHA_THRESHOLD = wx._core.IMAGE_ALPHA_THRESHOLD +wxIMAGE_ALPHA_OPAQUE = wx._core.IMAGE_ALPHA_OPAQUE wxImageHandler = wx._core.ImageHandler wxImageHandlerPtr = wx._core.ImageHandlerPtr wxImageHistogram = wx._core.ImageHistogram