X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/37f6a9770cfeb5b5cf088f5c728331088c49d68a..85bc0351f76f6d3f00460a167fc108b900e0725c:/utils/wxPython/src/gtk/image.cpp?ds=sidebyside diff --git a/utils/wxPython/src/gtk/image.cpp b/utils/wxPython/src/gtk/image.cpp index 70ae9f99af..867364253b 100644 --- a/utils/wxPython/src/gtk/image.cpp +++ b/utils/wxPython/src/gtk/image.cpp @@ -286,28 +286,20 @@ static PyObject *_wrap_wxImage_AddHandler(PyObject *self, PyObject *args, PyObje return _resultobj; } -#define new_wxImageHandler() (new wxImageHandler()) -static PyObject *_wrap_new_wxImageHandler(PyObject *self, PyObject *args, PyObject *kwargs) { +static PyObject *_wrap_wxInitAllImageHandlers(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; - wxImageHandler * _result; char *_kwnames[] = { NULL }; - char _ptemp[128]; self = self; - if(!PyArg_ParseTupleAndKeywords(args,kwargs,":new_wxImageHandler",_kwnames)) + if(!PyArg_ParseTupleAndKeywords(args,kwargs,":wxInitAllImageHandlers",_kwnames)) return NULL; { wxPy_BEGIN_ALLOW_THREADS; - _result = (wxImageHandler *)new_wxImageHandler(); + wxInitAllImageHandlers(); wxPy_END_ALLOW_THREADS; -} if (_result) { - SWIG_MakePtr(_ptemp, (char *) _result,"_wxImageHandler_p"); - _resultobj = Py_BuildValue("s",_ptemp); - } else { - Py_INCREF(Py_None); - _resultobj = Py_None; - } +} Py_INCREF(Py_None); + _resultobj = Py_None; return _resultobj; } @@ -335,7 +327,7 @@ static PyObject *_wrap_wxImageHandler_GetName(PyObject *self, PyObject *args, Py wxPy_END_ALLOW_THREADS; }{ - _resultobj = PyString_FromString(WXSTRINGCAST *(_result)); + _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); } { delete _result; @@ -367,7 +359,7 @@ static PyObject *_wrap_wxImageHandler_GetExtension(PyObject *self, PyObject *arg wxPy_END_ALLOW_THREADS; }{ - _resultobj = PyString_FromString(WXSTRINGCAST *(_result)); + _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); } { delete _result; @@ -426,7 +418,7 @@ static PyObject *_wrap_wxImageHandler_GetMimeType(PyObject *self, PyObject *args wxPy_END_ALLOW_THREADS; }{ - _resultobj = PyString_FromString(WXSTRINGCAST *(_result)); + _resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len()); } { delete _result; @@ -714,6 +706,105 @@ static PyObject *_wrap_new_wxGIFHandler(PyObject *self, PyObject *args, PyObject return _resultobj; } +static void *SwigwxPNMHandlerTowxImageHandler(void *ptr) { + wxPNMHandler *src; + wxImageHandler *dest; + src = (wxPNMHandler *) ptr; + dest = (wxImageHandler *) src; + return (void *) dest; +} + +#define new_wxPNMHandler() (new wxPNMHandler()) +static PyObject *_wrap_new_wxPNMHandler(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPNMHandler * _result; + char *_kwnames[] = { NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,":new_wxPNMHandler",_kwnames)) + return NULL; +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (wxPNMHandler *)new_wxPNMHandler(); + + wxPy_END_ALLOW_THREADS; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxPNMHandler_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +static void *SwigwxPCXHandlerTowxImageHandler(void *ptr) { + wxPCXHandler *src; + wxImageHandler *dest; + src = (wxPCXHandler *) ptr; + dest = (wxImageHandler *) src; + return (void *) dest; +} + +#define new_wxPCXHandler() (new wxPCXHandler()) +static PyObject *_wrap_new_wxPCXHandler(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxPCXHandler * _result; + char *_kwnames[] = { NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,":new_wxPCXHandler",_kwnames)) + return NULL; +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (wxPCXHandler *)new_wxPCXHandler(); + + wxPy_END_ALLOW_THREADS; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxPCXHandler_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + +static void *SwigwxTIFFHandlerTowxImageHandler(void *ptr) { + wxTIFFHandler *src; + wxImageHandler *dest; + src = (wxTIFFHandler *) ptr; + dest = (wxImageHandler *) src; + return (void *) dest; +} + +#define new_wxTIFFHandler() (new wxTIFFHandler()) +static PyObject *_wrap_new_wxTIFFHandler(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxTIFFHandler * _result; + char *_kwnames[] = { NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,":new_wxTIFFHandler",_kwnames)) + return NULL; +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = (wxTIFFHandler *)new_wxTIFFHandler(); + + wxPy_END_ALLOW_THREADS; +} if (_result) { + SWIG_MakePtr(_ptemp, (char *) _result,"_wxTIFFHandler_p"); + _resultobj = Py_BuildValue("s",_ptemp); + } else { + Py_INCREF(Py_None); + _resultobj = Py_None; + } + return _resultobj; +} + #define new_wxImage(_swigarg0,_swigarg1) (new wxImage(_swigarg0,_swigarg1)) static PyObject *_wrap_new_wxImage(PyObject *self, PyObject *args, PyObject *kwargs) { PyObject * _resultobj; @@ -1313,6 +1404,43 @@ static PyObject *_wrap_wxImage_GetHeight(PyObject *self, PyObject *args, PyObjec return _resultobj; } +#define wxImage_GetSubImage(_swigobj,_swigarg0) (_swigobj->GetSubImage(_swigarg0)) +static PyObject *_wrap_wxImage_GetSubImage(PyObject *self, PyObject *args, PyObject *kwargs) { + PyObject * _resultobj; + wxImage * _result; + wxImage * _arg0; + wxRect * _arg1; + PyObject * _argo0 = 0; + wxRect temp; + PyObject * _obj1 = 0; + char *_kwnames[] = { "self","rect", NULL }; + char _ptemp[128]; + + self = self; + if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxImage_GetSubImage",_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_GetSubImage. Expected _wxImage_p."); + return NULL; + } + } +{ + _arg1 = &temp; + if (! wxRect_helper(_obj1, &_arg1)) + return NULL; +} +{ + wxPy_BEGIN_ALLOW_THREADS; + _result = new wxImage (wxImage_GetSubImage(_arg0,*_arg1)); + + wxPy_END_ALLOW_THREADS; +} SWIG_MakePtr(_ptemp, (void *) _result,"_wxImage_p"); + _resultobj = Py_BuildValue("s",_ptemp); + return _resultobj; +} + static PyObject * wxImage_GetData(wxImage *self) { unsigned char* data = self->GetData(); int len = self->GetWidth() * self->GetHeight() * 3; @@ -1353,7 +1481,10 @@ static void wxImage_SetData(wxImage *self,PyObject * data) { PyErr_SetString(PyExc_TypeError, "Expected string object"); return /* NULL */ ; } - dataPtr = (unsigned char*)PyString_AsString(data); + + size_t len = self->GetWidth() * self->GetHeight() * 3; + dataPtr = new unsigned char[len]; + memcpy(dataPtr, PyString_AsString(data), len); self->SetData(dataPtr); } static PyObject *_wrap_wxImage_SetData(PyObject *self, PyObject *args, PyObject *kwargs) { @@ -1564,6 +1695,7 @@ static PyMethodDef imagecMethods[] = { { "wxImage_SetMaskColour", (PyCFunction) _wrap_wxImage_SetMaskColour, 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_GetSubImage", (PyCFunction) _wrap_wxImage_GetSubImage, METH_VARARGS | METH_KEYWORDS }, { "wxImage_GetHeight", (PyCFunction) _wrap_wxImage_GetHeight, METH_VARARGS | METH_KEYWORDS }, { "wxImage_GetWidth", (PyCFunction) _wrap_wxImage_GetWidth, METH_VARARGS | METH_KEYWORDS }, { "wxImage_Ok", (PyCFunction) _wrap_wxImage_Ok, METH_VARARGS | METH_KEYWORDS }, @@ -1582,6 +1714,9 @@ static PyMethodDef imagecMethods[] = { { "wxImage_ConvertToBitmap", (PyCFunction) _wrap_wxImage_ConvertToBitmap, METH_VARARGS | METH_KEYWORDS }, { "delete_wxImage", (PyCFunction) _wrap_delete_wxImage, METH_VARARGS | METH_KEYWORDS }, { "new_wxImage", (PyCFunction) _wrap_new_wxImage, METH_VARARGS | METH_KEYWORDS }, + { "new_wxTIFFHandler", (PyCFunction) _wrap_new_wxTIFFHandler, METH_VARARGS | METH_KEYWORDS }, + { "new_wxPCXHandler", (PyCFunction) _wrap_new_wxPCXHandler, METH_VARARGS | METH_KEYWORDS }, + { "new_wxPNMHandler", (PyCFunction) _wrap_new_wxPNMHandler, METH_VARARGS | METH_KEYWORDS }, { "new_wxGIFHandler", (PyCFunction) _wrap_new_wxGIFHandler, METH_VARARGS | METH_KEYWORDS }, { "new_wxBMPHandler", (PyCFunction) _wrap_new_wxBMPHandler, METH_VARARGS | METH_KEYWORDS }, { "new_wxJPEGHandler", (PyCFunction) _wrap_new_wxJPEGHandler, METH_VARARGS | METH_KEYWORDS }, @@ -1594,7 +1729,7 @@ 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 }, - { "new_wxImageHandler", (PyCFunction) _wrap_new_wxImageHandler, METH_VARARGS | METH_KEYWORDS }, + { "wxInitAllImageHandlers", (PyCFunction) _wrap_wxInitAllImageHandlers, METH_VARARGS | METH_KEYWORDS }, { "wxImage_AddHandler", (PyCFunction) _wrap_wxImage_AddHandler, METH_VARARGS | METH_KEYWORDS }, { "wxImageFromBitmap", (PyCFunction) _wrap_wxImageFromBitmap, METH_VARARGS | METH_KEYWORDS }, { "wxImageFromMime", (PyCFunction) _wrap_wxImageFromMime, METH_VARARGS | METH_KEYWORDS }, @@ -1614,6 +1749,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxJPEGHandler","_wxJPEGHandler",0}, { "_wxBMPHandler","_class_wxBMPHandler",0}, { "_wxImage","_class_wxImage",0}, + { "_wxPrintQuality","_wxCoord",0}, { "_wxPrintQuality","_int",0}, { "_wxPrintQuality","_signed_int",0}, { "_wxPrintQuality","_unsigned_int",0}, @@ -1625,6 +1761,12 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxGIFHandler","_class_wxGIFHandler",0}, { "_wxIndividualLayoutConstraint","_class_wxIndividualLayoutConstraint",0}, { "_wxCursor","_class_wxCursor",0}, + { "_wxImageHandler","_class_wxTIFFHandler",SwigwxTIFFHandlerTowxImageHandler}, + { "_wxImageHandler","_wxTIFFHandler",SwigwxTIFFHandlerTowxImageHandler}, + { "_wxImageHandler","_class_wxPCXHandler",SwigwxPCXHandlerTowxImageHandler}, + { "_wxImageHandler","_wxPCXHandler",SwigwxPCXHandlerTowxImageHandler}, + { "_wxImageHandler","_class_wxPNMHandler",SwigwxPNMHandlerTowxImageHandler}, + { "_wxImageHandler","_wxPNMHandler",SwigwxPNMHandlerTowxImageHandler}, { "_wxImageHandler","_class_wxGIFHandler",SwigwxGIFHandlerTowxImageHandler}, { "_wxImageHandler","_wxGIFHandler",SwigwxGIFHandlerTowxImageHandler}, { "_wxImageHandler","_class_wxBMPHandler",SwigwxBMPHandlerTowxImageHandler}, @@ -1638,25 +1780,28 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxPNGHandler","_class_wxPNGHandler",0}, { "_wxPen","_class_wxPen",0}, { "_byte","_unsigned_char",0}, - { "_long","_wxDash",0}, { "_long","_unsigned_long",0}, { "_long","_signed_long",0}, { "_wxImageList","_class_wxImageList",0}, + { "_class_wxTIFFHandler","_wxTIFFHandler",0}, { "_class_wxAcceleratorTable","_wxAcceleratorTable",0}, { "_wxDC","_class_wxDC",0}, { "_class_wxBMPHandler","_wxBMPHandler",0}, + { "_size_t","_wxCoord",0}, { "_size_t","_wxPrintQuality",0}, { "_size_t","_unsigned_int",0}, { "_size_t","_int",0}, { "_size_t","_wxWindowID",0}, { "_size_t","_uint",0}, { "_class_wxRealPoint","_wxRealPoint",0}, + { "_wxPNMHandler","_class_wxPNMHandler",0}, { "_class_wxGIFHandler","_wxGIFHandler",0}, { "_class_wxPostScriptDC","_wxPostScriptDC",0}, { "_class_wxMask","_wxMask",0}, { "_class_wxPNGHandler","_wxPNGHandler",0}, { "_wxColour","_class_wxColour",0}, { "_wxBrush","_class_wxBrush",0}, + { "_uint","_wxCoord",0}, { "_uint","_wxPrintQuality",0}, { "_uint","_size_t",0}, { "_uint","_unsigned_int",0}, @@ -1665,22 +1810,25 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxRect","_class_wxRect",0}, { "_class_wxImage","_wxImage",0}, { "_wxPoint","_class_wxPoint",0}, + { "_class_wxPNMHandler","_wxPNMHandler",0}, { "_wxBitmap","_class_wxBitmap",0}, + { "_char","_wxDash",0}, { "_wxPyTimer","_class_wxPyTimer",0}, { "_wxWindowDC","_class_wxWindowDC",0}, { "_class_wxIndividualLayoutConstraint","_wxIndividualLayoutConstraint",0}, + { "_EBool","_wxCoord",0}, { "_EBool","_wxPrintQuality",0}, { "_EBool","_signed_int",0}, { "_EBool","_int",0}, { "_EBool","_wxWindowID",0}, { "_class_wxRegion","_wxRegion",0}, { "_wxFont","_class_wxFont",0}, - { "_unsigned_long","_wxDash",0}, { "_unsigned_long","_long",0}, { "_class_wxRect","_wxRect",0}, { "_class_wxDC","_wxDC",0}, { "_class_wxPyTimer","_wxPyTimer",0}, { "_wxAcceleratorEntry","_class_wxAcceleratorEntry",0}, + { "_signed_int","_wxCoord",0}, { "_signed_int","_wxPrintQuality",0}, { "_signed_int","_EBool",0}, { "_signed_int","_wxWindowID",0}, @@ -1694,6 +1842,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_unsigned_short","_WXTYPE",0}, { "_unsigned_short","_short",0}, { "_class_wxFont","_wxFont",0}, + { "_wxBusyInfo","_class_wxBusyInfo",0}, { "_wxClientDC","_class_wxClientDC",0}, { "_class_wxPoint","_wxPoint",0}, { "_wxRealPoint","_class_wxRealPoint",0}, @@ -1705,6 +1854,12 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxAcceleratorEntry","_wxAcceleratorEntry",0}, { "_class_wxCursor","_wxCursor",0}, { "_wxPostScriptDC","_class_wxPostScriptDC",0}, + { "_class_wxImageHandler","_class_wxTIFFHandler",SwigwxTIFFHandlerTowxImageHandler}, + { "_class_wxImageHandler","_wxTIFFHandler",SwigwxTIFFHandlerTowxImageHandler}, + { "_class_wxImageHandler","_class_wxPCXHandler",SwigwxPCXHandlerTowxImageHandler}, + { "_class_wxImageHandler","_wxPCXHandler",SwigwxPCXHandlerTowxImageHandler}, + { "_class_wxImageHandler","_class_wxPNMHandler",SwigwxPNMHandlerTowxImageHandler}, + { "_class_wxImageHandler","_wxPNMHandler",SwigwxPNMHandlerTowxImageHandler}, { "_class_wxImageHandler","_class_wxGIFHandler",SwigwxGIFHandlerTowxImageHandler}, { "_class_wxImageHandler","_wxGIFHandler",SwigwxGIFHandlerTowxImageHandler}, { "_class_wxImageHandler","_class_wxBMPHandler",SwigwxBMPHandlerTowxImageHandler}, @@ -1715,6 +1870,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxImageHandler","_wxPNGHandler",SwigwxPNGHandlerTowxImageHandler}, { "_class_wxImageHandler","_wxImageHandler",0}, { "_unsigned_char","_byte",0}, + { "_unsigned_int","_wxCoord",0}, { "_unsigned_int","_wxPrintQuality",0}, { "_unsigned_int","_size_t",0}, { "_unsigned_int","_uint",0}, @@ -1726,7 +1882,9 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_short","_unsigned_short",0}, { "_short","_signed_short",0}, { "_class_wxImageList","_wxImageList",0}, + { "_wxPCXHandler","_class_wxPCXHandler",0}, { "_wxJPEGHandler","_class_wxJPEGHandler",0}, + { "_wxWindowID","_wxCoord",0}, { "_wxWindowID","_wxPrintQuality",0}, { "_wxWindowID","_size_t",0}, { "_wxWindowID","_EBool",0}, @@ -1734,6 +1892,7 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_wxWindowID","_int",0}, { "_wxWindowID","_signed_int",0}, { "_wxWindowID","_unsigned_int",0}, + { "_int","_wxCoord",0}, { "_int","_wxPrintQuality",0}, { "_int","_size_t",0}, { "_int","_EBool",0}, @@ -1749,13 +1908,23 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxColour","_wxColour",0}, { "_class_wxScreenDC","_wxScreenDC",0}, { "_wxPalette","_class_wxPalette",0}, + { "_wxCoord","_int",0}, + { "_wxCoord","_signed_int",0}, + { "_wxCoord","_unsigned_int",0}, + { "_wxCoord","_wxWindowID",0}, + { "_wxCoord","_uint",0}, + { "_wxCoord","_EBool",0}, + { "_wxCoord","_size_t",0}, + { "_wxCoord","_wxPrintQuality",0}, { "_wxRegion","_class_wxRegion",0}, + { "_class_wxPCXHandler","_wxPCXHandler",0}, + { "_wxTIFFHandler","_class_wxTIFFHandler",0}, + { "_class_wxBusyInfo","_wxBusyInfo",0}, { "_class_wxClientDC","_wxClientDC",0}, { "_class_wxSize","_wxSize",0}, { "_class_wxBitmap","_wxBitmap",0}, { "_class_wxMemoryDC","_wxMemoryDC",0}, - { "_wxDash","_unsigned_long",0}, - { "_wxDash","_long",0}, + { "_wxDash","_char",0}, { "_class_wxPalette","_wxPalette",0}, {0,0,0}};