X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/68bc8549d81adc1b6f031bdbb03b91a71944197c..71aba8333cc915afff9e740c944f7fa7247abacb:/wxPython/src/msw/image.cpp?ds=sidebyside diff --git a/wxPython/src/msw/image.cpp b/wxPython/src/msw/image.cpp index 648bd9b26a..44b65e5906 100644 --- a/wxPython/src/msw/image.cpp +++ b/wxPython/src/msw/image.cpp @@ -19,6 +19,8 @@ /* Implementation : PYTHON */ #define SWIGPYTHON +#include "Python.h" + #include #include /* Definitions for Windows/Unix exporting */ @@ -36,12 +38,9 @@ # define SWIGEXPORT(a) a #endif -#include "Python.h" - #ifdef __cplusplus extern "C" { #endif - extern void SWIG_MakePtr(char *, void *, char *); extern void SWIG_RegisterMapping(char *, char *, void *(*)(void *)); extern char *SWIG_GetPtr(char *, void **, char *); @@ -86,11 +85,11 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) { return target; } - wxImage* wxEmptyImage(int width=0, int height=0) { - if (width == 0 && height == 0) - return new wxImage; + wxImage* wxEmptyImage(int width=0, int height=0, bool clear = TRUE) { + if (width > 0 && height > 0) + return new wxImage(width, height, clear); else - return new wxImage(width, height); + return new wxImage; } @@ -144,15 +143,18 @@ static PyObject *_wrap_wxEmptyImage(PyObject *self, PyObject *args, PyObject *kw wxImage * _result; int _arg0 = (int ) 0; int _arg1 = (int ) 0; - char *_kwnames[] = { "width","height", NULL }; + bool _arg2 = (bool ) TRUE; + int tempbool2 = (int) TRUE; + char *_kwnames[] = { "width","height","clear", NULL }; char _ptemp[128]; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"|ii:wxEmptyImage",_kwnames,&_arg0,&_arg1)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"|iii:wxEmptyImage",_kwnames,&_arg0,&_arg1,&tempbool2)) return NULL; + _arg2 = (bool ) tempbool2; { PyThreadState* __tstate = wxPyBeginAllowThreads(); - _result = (wxImage *)wxEmptyImage(_arg0,_arg1); + _result = (wxImage *)wxEmptyImage(_arg0,_arg1,_arg2); wxPyEndAllowThreads(__tstate); if (PyErr_Occurred()) return NULL; @@ -226,8 +228,7 @@ static PyObject *_wrap_wxImageFromBitmap(PyObject *self, PyObject *args, PyObjec if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxImageFromBitmap",_kwnames,&_argo0)) return NULL; if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxBitmap_p")) { + if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxBitmap_p")) { PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxImageFromBitmap. Expected _wxBitmap_p."); return NULL; } @@ -304,7 +305,7 @@ static PyObject *_wrap_wxImageFromStream(PyObject *self, PyObject *args, PyObjec _arg0 = temp->m_wxis; created = FALSE; } else { - _arg0 = wxPyCBInputStream::create(_obj0, FALSE); + _arg0 = wxPyCBInputStream_create(_obj0, FALSE); if (_arg0 == NULL) { PyErr_SetString(PyExc_TypeError,"Expected _wxInputStream_p or Python file-like object."); return NULL; @@ -353,7 +354,7 @@ static PyObject *_wrap_wxImageFromStreamMime(PyObject *self, PyObject *args, PyO _arg0 = temp->m_wxis; created = FALSE; } else { - _arg0 = wxPyCBInputStream::create(_obj0, FALSE); + _arg0 = wxPyCBInputStream_create(_obj0, FALSE); if (_arg0 == NULL) { PyErr_SetString(PyExc_TypeError,"Expected _wxInputStream_p or Python file-like object."); return NULL; @@ -436,8 +437,7 @@ static PyObject *_wrap_wxBitmapFromImage(PyObject *self, PyObject *args, PyObjec if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|i:wxBitmapFromImage",_kwnames,&_argo0,&_arg1)) return NULL; if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxImage_p")) { + if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxImage_p")) { PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxBitmapFromImage. Expected _wxImage_p."); return NULL; } @@ -458,6 +458,114 @@ static PyObject *_wrap_wxBitmapFromImage(PyObject *self, PyObject *args, PyObjec return _resultobj; } +#define new_wxImageHistogram() (new wxImageHistogram()) +static PyObject *_wrap_new_wxImageHistogram(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxImageHistogram * _result; + char *_kwnames[] = { NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,":new_wxImageHistogram",_kwnames)) + return NULL; +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (wxImageHistogram *)new_wxImageHistogram(); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxImageHistogram_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +static PyObject *_wrap_wxImageHistogram_MakeKey(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + unsigned long _result; + unsigned char _arg0; + unsigned char _arg1; + unsigned char _arg2; + char *_kwnames[] = { "r","g","b", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"bbb:wxImageHistogram_MakeKey",_kwnames,&_arg0,&_arg1,&_arg2)) + return NULL; +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (unsigned long )wxImageHistogram::MakeKey(_arg0,_arg1,_arg2); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("l",_result); + return _resultobj; +} + +#define wxImageHistogram_FindFirstUnusedColour(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5) (_swigobj->FindFirstUnusedColour(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5)) +static PyObject *_wrap_wxImageHistogram_FindFirstUnusedColour(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxImageHistogram * _arg0; + unsigned char * _arg1; + unsigned char temp; + unsigned char * _arg2; + unsigned char temp0; + unsigned char * _arg3; + unsigned char temp1; + unsigned char _arg4 = (unsigned char ) 1; + unsigned char _arg5 = (unsigned char ) 0; + unsigned char _arg6 = (unsigned char ) 0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","startR","startG","startB", NULL }; + + self = self; +{ + _arg1 = &temp; +} +{ + _arg2 = &temp0; +} +{ + _arg3 = &temp1; +} + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O|bbb:wxImageHistogram_FindFirstUnusedColour",_kwnames,&_argo0,&_arg4,&_arg5,&_arg6)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxImageHistogram_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxImageHistogram_FindFirstUnusedColour. Expected _wxImageHistogram_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (bool )wxImageHistogram_FindFirstUnusedColour(_arg0,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); +{ + PyObject *o; + o = PyInt_FromLong((long) (*_arg1)); + _resultobj = t_output_helper(_resultobj, o); +} +{ + PyObject *o; + o = PyInt_FromLong((long) (*_arg2)); + _resultobj = t_output_helper(_resultobj, o); +} +{ + PyObject *o; + o = PyInt_FromLong((long) (*_arg3)); + _resultobj = t_output_helper(_resultobj, o); +} + return _resultobj; +} + static void *SwigwxImageHandlerTowxObject(void *ptr) { wxImageHandler *src; wxObject *dest; @@ -492,7 +600,7 @@ static PyObject *_wrap_wxImageHandler_GetName(PyObject *self, PyObject *args, Py if (PyErr_Occurred()) return NULL; }{ #if wxUSE_UNICODE - _resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len()); + _resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len()); #else _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); #endif @@ -529,7 +637,7 @@ static PyObject *_wrap_wxImageHandler_GetExtension(PyObject *self, PyObject *arg if (PyErr_Occurred()) return NULL; }{ #if wxUSE_UNICODE - _resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len()); + _resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len()); #else _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); #endif @@ -594,7 +702,7 @@ static PyObject *_wrap_wxImageHandler_GetMimeType(PyObject *self, PyObject *args if (PyErr_Occurred()) return NULL; }{ #if wxUSE_UNICODE - _resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len()); + _resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len()); #else _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); #endif @@ -1423,6 +1531,38 @@ static PyObject *_wrap_wxImage_Scale(PyObject *self, PyObject *args, PyObject *k return _resultobj; } +#define wxImage_ShrinkBy(_swigobj,_swigarg0,_swigarg1) (_swigobj->ShrinkBy(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxImage_ShrinkBy(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxImage * _result; + wxImage * _arg0; + int _arg1; + int _arg2; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","xFactor","yFactor", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxImage_ShrinkBy",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxImage_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxImage_ShrinkBy. Expected _wxImage_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = new wxImage (wxImage_ShrinkBy(_arg0,_arg1,_arg2)); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} SWIG_MakePtr(_ptemp, (void *) _result,"_wxImage_p"); + _resultobj = Py_BuildValue("s",_ptemp); + return _resultobj; +} + #define wxImage_Rescale(_swigobj,_swigarg0,_swigarg1) (_swigobj->Rescale(_swigarg0,_swigarg1)) static PyObject *_wrap_wxImage_Rescale(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; @@ -1584,6 +1724,95 @@ static PyObject *_wrap_wxImage_GetBlue(PyObject *self, PyObject *args, PyObject return _resultobj; } +#define wxImage_SetAlpha(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->SetAlpha(_swigarg0,_swigarg1,_swigarg2)) +static PyObject *_wrap_wxImage_SetAlpha(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxImage * _arg0; + int _arg1; + int _arg2; + unsigned char _arg3; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","x","y","alpha", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oiib:wxImage_SetAlpha",_kwnames,&_argo0,&_arg1,&_arg2,&_arg3)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxImage_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxImage_SetAlpha. Expected _wxImage_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxImage_SetAlpha(_arg0,_arg1,_arg2,_arg3); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +#define wxImage_GetAlpha(_swigobj,_swigarg0,_swigarg1) (_swigobj->GetAlpha(_swigarg0,_swigarg1)) +static PyObject *_wrap_wxImage_GetAlpha(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + unsigned char _result; + wxImage * _arg0; + int _arg1; + int _arg2; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self","x","y", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii:wxImage_GetAlpha",_kwnames,&_argo0,&_arg1,&_arg2)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxImage_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxImage_GetAlpha. Expected _wxImage_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (unsigned char )wxImage_GetAlpha(_arg0,_arg1,_arg2); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("b",_result); + return _resultobj; +} + +#define wxImage_HasAlpha(_swigobj) (_swigobj->HasAlpha()) +static PyObject *_wrap_wxImage_HasAlpha(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + bool _result; + wxImage * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxImage_HasAlpha",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxImage_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxImage_HasAlpha. Expected _wxImage_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (bool )wxImage_HasAlpha(_arg0); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("i",_result); + return _resultobj; +} + #define wxImage_FindFirstUnusedColour(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5) (_swigobj->FindFirstUnusedColour(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5)) static PyObject *_wrap_wxImage_FindFirstUnusedColour(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; @@ -1669,8 +1898,7 @@ static PyObject *_wrap_wxImage_SetMaskFromImage(PyObject *self, PyObject *args, } } if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxImage_p")) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxImage_p")) { PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxImage_SetMaskFromImage. Expected _wxImage_p."); return NULL; } @@ -1685,55 +1913,6 @@ static PyObject *_wrap_wxImage_SetMaskFromImage(PyObject *self, PyObject *args, return _resultobj; } -#define wxImage_DoFloodFill(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5) (_swigobj->DoFloodFill(_swigarg0,_swigarg1,_swigarg2,_swigarg3,_swigarg4,_swigarg5)) -static PyObject *_wrap_wxImage_DoFloodFill(PyObject *self, PyObject *args, PyObject *kwargs) { - PyObject * _resultobj; - wxImage * _arg0; - wxCoord _arg1; - wxCoord _arg2; - wxBrush * _arg3; - wxColour * _arg4; - int _arg5 = (int ) wxFLOOD_SURFACE; - int _arg6 = (int ) wxCOPY; - PyObject * _argo0 = 0; - PyObject * _argo3 = 0; - wxColour temp; - PyObject * _obj4 = 0; - char *_kwnames[] = { "self","x","y","fillBrush","testColour","style","LogicalFunction", NULL }; - - self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OiiOO|ii:wxImage_DoFloodFill",_kwnames,&_argo0,&_arg1,&_arg2,&_argo3,&_obj4,&_arg5,&_arg6)) - return NULL; - if (_argo0) { - if (_argo0 == Py_None) { _arg0 = NULL; } - else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxImage_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxImage_DoFloodFill. Expected _wxImage_p."); - return NULL; - } - } - if (_argo3) { - if (_argo3 == Py_None) { _arg3 = NULL; } - else if (SWIG_GetPtrObj(_argo3,(void **) &_arg3,"_wxBrush_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in argument 4 of wxImage_DoFloodFill. Expected _wxBrush_p."); - return NULL; - } - } -{ - _arg4 = &temp; - if (! wxColour_helper(_obj4, &_arg4)) - return NULL; -} -{ - PyThreadState* __tstate = wxPyBeginAllowThreads(); - wxImage_DoFloodFill(_arg0,_arg1,_arg2,*_arg3,*_arg4,_arg5,_arg6); - - wxPyEndAllowThreads(__tstate); - if (PyErr_Occurred()) return NULL; -} Py_INCREF(Py_None); - _resultobj = Py_None; - return _resultobj; -} - static PyObject *_wrap_wxImage_CanRead(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; bool _result; @@ -1992,7 +2171,7 @@ static PyObject *_wrap_wxImage_CanReadStream(PyObject *self, PyObject *args, PyO _arg0 = temp->m_wxis; created = FALSE; } else { - _arg0 = wxPyCBInputStream::create(_obj0, FALSE); + _arg0 = wxPyCBInputStream_create(_obj0, FALSE); if (_arg0 == NULL) { PyErr_SetString(PyExc_TypeError,"Expected _wxInputStream_p or Python file-like object."); return NULL; @@ -2043,7 +2222,7 @@ static PyObject *_wrap_wxImage_LoadStream(PyObject *self, PyObject *args, PyObje _arg1 = temp->m_wxis; created = FALSE; } else { - _arg1 = wxPyCBInputStream::create(_obj1, FALSE); + _arg1 = wxPyCBInputStream_create(_obj1, FALSE); if (_arg1 == NULL) { PyErr_SetString(PyExc_TypeError,"Expected _wxInputStream_p or Python file-like object."); return NULL; @@ -2095,7 +2274,7 @@ static PyObject *_wrap_wxImage_LoadMimeStream(PyObject *self, PyObject *args, Py _arg1 = temp->m_wxis; created = FALSE; } else { - _arg1 = wxPyCBInputStream::create(_obj1, FALSE); + _arg1 = wxPyCBInputStream_create(_obj1, FALSE); if (_arg1 == NULL) { PyErr_SetString(PyExc_TypeError,"Expected _wxInputStream_p or Python file-like object."); return NULL; @@ -2300,8 +2479,7 @@ static PyObject *_wrap_wxImage_Paste(PyObject *self, PyObject *args, PyObject *k } } if (_argo1) { - if (_argo1 == Py_None) { _arg1 = NULL; } - else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxImage_p")) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxImage_p")) { PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxImage_Paste. Expected _wxImage_p."); return NULL; } @@ -2363,6 +2541,7 @@ static void wxImage_SetData(wxImage *self,PyObject * data) { dataPtr = (unsigned char*) malloc(len); memcpy(dataPtr, PyString_AsString(data), len); self->SetData(dataPtr); + // wxImage takes ownership of dataPtr... } static PyObject *_wrap_wxImage_SetData(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; @@ -2396,6 +2575,248 @@ static PyObject *_wrap_wxImage_SetData(PyObject *self, PyObject *args, PyObject return _resultobj; } +static PyObject * wxImage_GetDataBuffer(wxImage *self) { + unsigned char* data = self->GetData(); + int len = self->GetWidth() * self->GetHeight() * 3; + return PyBuffer_FromReadWriteMemory(data, len); + } +static PyObject *_wrap_wxImage_GetDataBuffer(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + PyObject * _result; + wxImage * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxImage_GetDataBuffer",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxImage_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxImage_GetDataBuffer. Expected _wxImage_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (PyObject *)wxImage_GetDataBuffer(_arg0); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +}{ + _resultobj = _result; +} + return _resultobj; +} + +static void wxImage_SetDataBuffer(wxImage *self,PyObject * data) { + unsigned char* buffer; + int size; + + if (!PyArg_Parse(data, "w#", &buffer, &size)) + return; + + if (size != self->GetWidth() * self->GetHeight() * 3) { + PyErr_SetString(PyExc_TypeError, "Incorrect buffer size"); + return; + } + self->SetData(buffer); + } +static PyObject *_wrap_wxImage_SetDataBuffer(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxImage * _arg0; + PyObject * _arg1; + PyObject * _argo0 = 0; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","data", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxImage_SetDataBuffer",_kwnames,&_argo0,&_obj1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxImage_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxImage_SetDataBuffer. Expected _wxImage_p."); + return NULL; + } + } +{ + _arg1 = _obj1; +} +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxImage_SetDataBuffer(_arg0,_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +static PyObject * wxImage_GetAlphaData(wxImage *self) { + unsigned char* data = self->GetAlpha(); + if (! data) { + RETURN_NONE(); + } else { + int len = self->GetWidth() * self->GetHeight(); + return PyString_FromStringAndSize((char*)data, len); + } + } +static PyObject *_wrap_wxImage_GetAlphaData(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + PyObject * _result; + wxImage * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxImage_GetAlphaData",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxImage_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxImage_GetAlphaData. Expected _wxImage_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (PyObject *)wxImage_GetAlphaData(_arg0); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +}{ + _resultobj = _result; +} + return _resultobj; +} + +static void wxImage_SetAlphaData(wxImage *self,PyObject * data) { + unsigned char* dataPtr; + + if (! PyString_Check(data)) { + PyErr_SetString(PyExc_TypeError, "Expected string object"); + return /* NULL */ ; + } + + size_t len = self->GetWidth() * self->GetHeight(); + dataPtr = (unsigned char*) malloc(len); + memcpy(dataPtr, PyString_AsString(data), len); + self->SetAlpha(dataPtr); + // wxImage takes ownership of dataPtr... + } +static PyObject *_wrap_wxImage_SetAlphaData(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxImage * _arg0; + PyObject * _arg1; + PyObject * _argo0 = 0; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","data", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxImage_SetAlphaData",_kwnames,&_argo0,&_obj1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxImage_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxImage_SetAlphaData. Expected _wxImage_p."); + return NULL; + } + } +{ + _arg1 = _obj1; +} +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxImage_SetAlphaData(_arg0,_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + +static PyObject * wxImage_GetAlphaBuffer(wxImage *self) { + unsigned char* data = self->GetAlpha(); + int len = self->GetWidth() * self->GetHeight(); + return PyBuffer_FromReadWriteMemory(data, len); + } +static PyObject *_wrap_wxImage_GetAlphaBuffer(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + PyObject * _result; + wxImage * _arg0; + PyObject * _argo0 = 0; + char *_kwnames[] = { "self", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxImage_GetAlphaBuffer",_kwnames,&_argo0)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxImage_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxImage_GetAlphaBuffer. Expected _wxImage_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (PyObject *)wxImage_GetAlphaBuffer(_arg0); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +}{ + _resultobj = _result; +} + return _resultobj; +} + +static void wxImage_SetAlphaBuffer(wxImage *self,PyObject * data) { + unsigned char* buffer; + int size; + + if (!PyArg_Parse(data, "w#", &buffer, &size)) + return; + + if (size != self->GetWidth() * self->GetHeight()) { + PyErr_SetString(PyExc_TypeError, "Incorrect buffer size"); + return; + } + self->SetAlpha(buffer); + } +static PyObject *_wrap_wxImage_SetAlphaBuffer(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxImage * _arg0; + PyObject * _arg1; + PyObject * _argo0 = 0; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","data", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxImage_SetAlphaBuffer",_kwnames,&_argo0,&_obj1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxImage_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxImage_SetAlphaBuffer. Expected _wxImage_p."); + return NULL; + } + } +{ + _arg1 = _obj1; +} +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + wxImage_SetAlphaBuffer(_arg0,_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; +} + #define wxImage_SetMaskColour(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->SetMaskColour(_swigarg0,_swigarg1,_swigarg2)) static PyObject *_wrap_wxImage_SetMaskColour(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; @@ -2877,7 +3298,7 @@ static PyObject *_wrap_wxImage_GetOption(PyObject *self, PyObject *args, PyObjec if (PyErr_Occurred()) return NULL; }{ #if wxUSE_UNICODE - _resultobj = PyUnicode_FromUnicode(_result->c_str(), _result->Len()); + _resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len()); #else _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); #endif @@ -2999,6 +3420,42 @@ static PyObject *_wrap_wxImage_CountColours(PyObject *self, PyObject *args, PyOb return _resultobj; } +#define wxImage_ComputeHistogram(_swigobj,_swigarg0) (_swigobj->ComputeHistogram(_swigarg0)) +static PyObject *_wrap_wxImage_ComputeHistogram(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + unsigned long _result; + wxImage * _arg0; + wxImageHistogram * _arg1; + PyObject * _argo0 = 0; + PyObject * _argo1 = 0; + char *_kwnames[] = { "self","h", NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxImage_ComputeHistogram",_kwnames,&_argo0,&_argo1)) + return NULL; + if (_argo0) { + if (_argo0 == Py_None) { _arg0 = NULL; } + else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxImage_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxImage_ComputeHistogram. Expected _wxImage_p."); + return NULL; + } + } + if (_argo1) { + if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxImageHistogram_p")) { + PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxImage_ComputeHistogram. Expected _wxImageHistogram_p."); + return NULL; + } + } +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = (unsigned long )wxImage_ComputeHistogram(_arg0,*_arg1); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +} _resultobj = Py_BuildValue("l",_result); + return _resultobj; +} + static PyObject *_wrap_wxImage_AddHandler(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; wxImageHandler * _arg0; @@ -3082,6 +3539,33 @@ static PyObject *_wrap_wxImage_RemoveHandler(PyObject *self, PyObject *args, PyO return _resultobj; } +static PyObject *_wrap_wxImage_GetImageExtWildcard(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxString * _result; + char *_kwnames[] = { NULL }; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,":wxImage_GetImageExtWildcard",_kwnames)) + return NULL; +{ + PyThreadState* __tstate = wxPyBeginAllowThreads(); + _result = new wxString (wxImage::GetImageExtWildcard()); + + wxPyEndAllowThreads(__tstate); + if (PyErr_Occurred()) return NULL; +}{ +#if wxUSE_UNICODE + _resultobj = PyUnicode_FromWideChar(_result->c_str(), _result->Len()); +#else + _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); +#endif +} +{ + delete _result; +} + return _resultobj; +} + static wxBitmap wxImage_ConvertToBitmap(wxImage *self) { wxBitmap bitmap(*self); return bitmap; @@ -3155,9 +3639,11 @@ static PyObject *_wrap_wxImage_ConvertToMonoBitmap(PyObject *self, PyObject *arg static PyMethodDef imagecMethods[] = { { "wxImage_ConvertToMonoBitmap", (PyCFunction) _wrap_wxImage_ConvertToMonoBitmap, METH_VARARGS | METH_KEYWORDS }, { "wxImage_ConvertToBitmap", (PyCFunction) _wrap_wxImage_ConvertToBitmap, METH_VARARGS | METH_KEYWORDS }, + { "wxImage_GetImageExtWildcard", (PyCFunction) _wrap_wxImage_GetImageExtWildcard, METH_VARARGS | METH_KEYWORDS }, { "wxImage_RemoveHandler", (PyCFunction) _wrap_wxImage_RemoveHandler, METH_VARARGS | METH_KEYWORDS }, { "wxImage_InsertHandler", (PyCFunction) _wrap_wxImage_InsertHandler, METH_VARARGS | METH_KEYWORDS }, { "wxImage_AddHandler", (PyCFunction) _wrap_wxImage_AddHandler, METH_VARARGS | METH_KEYWORDS }, + { "wxImage_ComputeHistogram", (PyCFunction) _wrap_wxImage_ComputeHistogram, METH_VARARGS | METH_KEYWORDS }, { "wxImage_CountColours", (PyCFunction) _wrap_wxImage_CountColours, METH_VARARGS | METH_KEYWORDS }, { "wxImage_HasOption", (PyCFunction) _wrap_wxImage_HasOption, METH_VARARGS | METH_KEYWORDS }, { "wxImage_GetOptionInt", (PyCFunction) _wrap_wxImage_GetOptionInt, METH_VARARGS | METH_KEYWORDS }, @@ -3175,6 +3661,12 @@ static PyMethodDef imagecMethods[] = { { "wxImage_GetMaskGreen", (PyCFunction) _wrap_wxImage_GetMaskGreen, METH_VARARGS | METH_KEYWORDS }, { "wxImage_GetMaskRed", (PyCFunction) _wrap_wxImage_GetMaskRed, METH_VARARGS | METH_KEYWORDS }, { "wxImage_SetMaskColour", (PyCFunction) _wrap_wxImage_SetMaskColour, METH_VARARGS | METH_KEYWORDS }, + { "wxImage_SetAlphaBuffer", (PyCFunction) _wrap_wxImage_SetAlphaBuffer, METH_VARARGS | METH_KEYWORDS }, + { "wxImage_GetAlphaBuffer", (PyCFunction) _wrap_wxImage_GetAlphaBuffer, METH_VARARGS | METH_KEYWORDS }, + { "wxImage_SetAlphaData", (PyCFunction) _wrap_wxImage_SetAlphaData, METH_VARARGS | METH_KEYWORDS }, + { "wxImage_GetAlphaData", (PyCFunction) _wrap_wxImage_GetAlphaData, METH_VARARGS | METH_KEYWORDS }, + { "wxImage_SetDataBuffer", (PyCFunction) _wrap_wxImage_SetDataBuffer, METH_VARARGS | METH_KEYWORDS }, + { "wxImage_GetDataBuffer", (PyCFunction) _wrap_wxImage_GetDataBuffer, METH_VARARGS | METH_KEYWORDS }, { "wxImage_SetData", (PyCFunction) _wrap_wxImage_SetData, METH_VARARGS | METH_KEYWORDS }, { "wxImage_GetData", (PyCFunction) _wrap_wxImage_GetData, METH_VARARGS | METH_KEYWORDS }, { "wxImage_Paste", (PyCFunction) _wrap_wxImage_Paste, METH_VARARGS | METH_KEYWORDS }, @@ -3192,14 +3684,17 @@ static PyMethodDef imagecMethods[] = { { "wxImage_LoadFile", (PyCFunction) _wrap_wxImage_LoadFile, METH_VARARGS | METH_KEYWORDS }, { "wxImage_GetImageCount", (PyCFunction) _wrap_wxImage_GetImageCount, METH_VARARGS | METH_KEYWORDS }, { "wxImage_CanRead", (PyCFunction) _wrap_wxImage_CanRead, METH_VARARGS | METH_KEYWORDS }, - { "wxImage_DoFloodFill", (PyCFunction) _wrap_wxImage_DoFloodFill, METH_VARARGS | METH_KEYWORDS }, { "wxImage_SetMaskFromImage", (PyCFunction) _wrap_wxImage_SetMaskFromImage, METH_VARARGS | METH_KEYWORDS }, { "wxImage_FindFirstUnusedColour", (PyCFunction) _wrap_wxImage_FindFirstUnusedColour, METH_VARARGS | METH_KEYWORDS }, + { "wxImage_HasAlpha", (PyCFunction) _wrap_wxImage_HasAlpha, METH_VARARGS | METH_KEYWORDS }, + { "wxImage_GetAlpha", (PyCFunction) _wrap_wxImage_GetAlpha, METH_VARARGS | METH_KEYWORDS }, + { "wxImage_SetAlpha", (PyCFunction) _wrap_wxImage_SetAlpha, METH_VARARGS | METH_KEYWORDS }, { "wxImage_GetBlue", (PyCFunction) _wrap_wxImage_GetBlue, METH_VARARGS | METH_KEYWORDS }, { "wxImage_GetGreen", (PyCFunction) _wrap_wxImage_GetGreen, METH_VARARGS | METH_KEYWORDS }, { "wxImage_GetRed", (PyCFunction) _wrap_wxImage_GetRed, METH_VARARGS | METH_KEYWORDS }, { "wxImage_SetRGB", (PyCFunction) _wrap_wxImage_SetRGB, METH_VARARGS | METH_KEYWORDS }, { "wxImage_Rescale", (PyCFunction) _wrap_wxImage_Rescale, METH_VARARGS | METH_KEYWORDS }, + { "wxImage_ShrinkBy", (PyCFunction) _wrap_wxImage_ShrinkBy, METH_VARARGS | METH_KEYWORDS }, { "wxImage_Scale", (PyCFunction) _wrap_wxImage_Scale, METH_VARARGS | METH_KEYWORDS }, { "wxImage_Destroy", (PyCFunction) _wrap_wxImage_Destroy, METH_VARARGS | METH_KEYWORDS }, { "wxImage_Create", (PyCFunction) _wrap_wxImage_Create, METH_VARARGS | METH_KEYWORDS }, @@ -3224,6 +3719,9 @@ static PyMethodDef imagecMethods[] = { { "wxImageHandler_GetType", (PyCFunction) _wrap_wxImageHandler_GetType, METH_VARARGS | METH_KEYWORDS }, { "wxImageHandler_GetExtension", (PyCFunction) _wrap_wxImageHandler_GetExtension, METH_VARARGS | METH_KEYWORDS }, { "wxImageHandler_GetName", (PyCFunction) _wrap_wxImageHandler_GetName, METH_VARARGS | METH_KEYWORDS }, + { "wxImageHistogram_FindFirstUnusedColour", (PyCFunction) _wrap_wxImageHistogram_FindFirstUnusedColour, METH_VARARGS | METH_KEYWORDS }, + { "wxImageHistogram_MakeKey", (PyCFunction) _wrap_wxImageHistogram_MakeKey, METH_VARARGS | METH_KEYWORDS }, + { "new_wxImageHistogram", (PyCFunction) _wrap_new_wxImageHistogram, METH_VARARGS | METH_KEYWORDS }, { "wxBitmapFromImage", (PyCFunction) _wrap_wxBitmapFromImage, METH_VARARGS | METH_KEYWORDS }, { "wxInitAllImageHandlers", (PyCFunction) _wrap_wxInitAllImageHandlers, METH_VARARGS | METH_KEYWORDS }, { "wxImageFromStreamMime", (PyCFunction) _wrap_wxImageFromStreamMime, METH_VARARGS | METH_KEYWORDS },