Added missing wxImage methods

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12417 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn 2001-11-14 04:05:12 +00:00
parent edc2a0366a
commit 6c0168c945
3 changed files with 358 additions and 0 deletions

View File

@ -101,6 +101,7 @@ public:
#endif
void Create( int width, int height );
void Destroy();
wxImage Scale( int width, int height );
wxImage& Rescale(int width, int height);
@ -164,6 +165,15 @@ public:
void Replace( unsigned char r1, unsigned char g1, unsigned char b1,
unsigned char r2, unsigned char g2, unsigned char b2 );
// convert to monochrome image (<r,g,b> will be replaced by white, everything else by black)
wxImage ConvertToMono( unsigned char r, unsigned char g, unsigned char b ) const;
void SetOption(const wxString& name, const wxString& value);
%name(SetOptionInt)void SetOption(const wxString& name, int value);
wxString GetOption(const wxString& name) const;
int GetOptionInt(const wxString& name) const;
bool HasOption(const wxString& name) const;
unsigned long CountColours( unsigned long stopafter = (unsigned long) -1 );
// TODO: unsigned long ComputeHistogram( wxHashTable &h );

View File

@ -2197,6 +2197,329 @@ static PyObject *_wrap_wxImage_Replace(PyObject *self, PyObject *args, PyObject
return _resultobj;
}
#define wxImage_ConvertToMono(_swigobj,_swigarg0,_swigarg1,_swigarg2) (_swigobj->ConvertToMono(_swigarg0,_swigarg1,_swigarg2))
static PyObject *_wrap_wxImage_ConvertToMono(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxImage * _result;
wxImage * _arg0;
unsigned char _arg1;
unsigned char _arg2;
unsigned char _arg3;
PyObject * _argo0 = 0;
char *_kwnames[] = { "self","r","g","b", NULL };
char _ptemp[128];
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Obbb:wxImage_ConvertToMono",_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_ConvertToMono. Expected _wxImage_p.");
return NULL;
}
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = new wxImage (wxImage_ConvertToMono(_arg0,_arg1,_arg2,_arg3));
wxPy_END_ALLOW_THREADS;
if (PyErr_Occurred()) return NULL;
} SWIG_MakePtr(_ptemp, (void *) _result,"_wxImage_p");
_resultobj = Py_BuildValue("s",_ptemp);
return _resultobj;
}
#define wxImage_SetOption(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetOption(_swigarg0,_swigarg1))
static PyObject *_wrap_wxImage_SetOption(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxImage * _arg0;
wxString * _arg1;
wxString * _arg2;
PyObject * _argo0 = 0;
PyObject * _obj1 = 0;
PyObject * _obj2 = 0;
char *_kwnames[] = { "self","name","value", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOO:wxImage_SetOption",_kwnames,&_argo0,&_obj1,&_obj2))
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_SetOption. Expected _wxImage_p.");
return NULL;
}
}
{
#if PYTHON_API_VERSION >= 1009
char* tmpPtr; int tmpSize;
if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) {
PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
return NULL;
}
if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1)
return NULL;
_arg1 = new wxString(tmpPtr, tmpSize);
#else
if (!PyString_Check(_obj1)) {
PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
return NULL;
}
_arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1));
#endif
}
{
#if PYTHON_API_VERSION >= 1009
char* tmpPtr; int tmpSize;
if (!PyString_Check(_obj2) && !PyUnicode_Check(_obj2)) {
PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
return NULL;
}
if (PyString_AsStringAndSize(_obj2, &tmpPtr, &tmpSize) == -1)
return NULL;
_arg2 = new wxString(tmpPtr, tmpSize);
#else
if (!PyString_Check(_obj2)) {
PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
return NULL;
}
_arg2 = new wxString(PyString_AS_STRING(_obj2), PyString_GET_SIZE(_obj2));
#endif
}
{
wxPy_BEGIN_ALLOW_THREADS;
wxImage_SetOption(_arg0,*_arg1,*_arg2);
wxPy_END_ALLOW_THREADS;
if (PyErr_Occurred()) return NULL;
} Py_INCREF(Py_None);
_resultobj = Py_None;
{
if (_obj1)
delete _arg1;
}
{
if (_obj2)
delete _arg2;
}
return _resultobj;
}
#define wxImage_SetOptionInt(_swigobj,_swigarg0,_swigarg1) (_swigobj->SetOption(_swigarg0,_swigarg1))
static PyObject *_wrap_wxImage_SetOptionInt(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxImage * _arg0;
wxString * _arg1;
int _arg2;
PyObject * _argo0 = 0;
PyObject * _obj1 = 0;
char *_kwnames[] = { "self","name","value", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OOi:wxImage_SetOptionInt",_kwnames,&_argo0,&_obj1,&_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_SetOptionInt. Expected _wxImage_p.");
return NULL;
}
}
{
#if PYTHON_API_VERSION >= 1009
char* tmpPtr; int tmpSize;
if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) {
PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
return NULL;
}
if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1)
return NULL;
_arg1 = new wxString(tmpPtr, tmpSize);
#else
if (!PyString_Check(_obj1)) {
PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
return NULL;
}
_arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1));
#endif
}
{
wxPy_BEGIN_ALLOW_THREADS;
wxImage_SetOptionInt(_arg0,*_arg1,_arg2);
wxPy_END_ALLOW_THREADS;
if (PyErr_Occurred()) return NULL;
} Py_INCREF(Py_None);
_resultobj = Py_None;
{
if (_obj1)
delete _arg1;
}
return _resultobj;
}
#define wxImage_GetOption(_swigobj,_swigarg0) (_swigobj->GetOption(_swigarg0))
static PyObject *_wrap_wxImage_GetOption(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxString * _result;
wxImage * _arg0;
wxString * _arg1;
PyObject * _argo0 = 0;
PyObject * _obj1 = 0;
char *_kwnames[] = { "self","name", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxImage_GetOption",_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_GetOption. Expected _wxImage_p.");
return NULL;
}
}
{
#if PYTHON_API_VERSION >= 1009
char* tmpPtr; int tmpSize;
if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) {
PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
return NULL;
}
if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1)
return NULL;
_arg1 = new wxString(tmpPtr, tmpSize);
#else
if (!PyString_Check(_obj1)) {
PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
return NULL;
}
_arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1));
#endif
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = new wxString (wxImage_GetOption(_arg0,*_arg1));
wxPy_END_ALLOW_THREADS;
if (PyErr_Occurred()) return NULL;
}{
_resultobj = PyString_FromStringAndSize(_result->c_str(), _result->Len());
}
{
if (_obj1)
delete _arg1;
}
{
delete _result;
}
return _resultobj;
}
#define wxImage_GetOptionInt(_swigobj,_swigarg0) (_swigobj->GetOptionInt(_swigarg0))
static PyObject *_wrap_wxImage_GetOptionInt(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
int _result;
wxImage * _arg0;
wxString * _arg1;
PyObject * _argo0 = 0;
PyObject * _obj1 = 0;
char *_kwnames[] = { "self","name", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxImage_GetOptionInt",_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_GetOptionInt. Expected _wxImage_p.");
return NULL;
}
}
{
#if PYTHON_API_VERSION >= 1009
char* tmpPtr; int tmpSize;
if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) {
PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
return NULL;
}
if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1)
return NULL;
_arg1 = new wxString(tmpPtr, tmpSize);
#else
if (!PyString_Check(_obj1)) {
PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
return NULL;
}
_arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1));
#endif
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (int )wxImage_GetOptionInt(_arg0,*_arg1);
wxPy_END_ALLOW_THREADS;
if (PyErr_Occurred()) return NULL;
} _resultobj = Py_BuildValue("i",_result);
{
if (_obj1)
delete _arg1;
}
return _resultobj;
}
#define wxImage_HasOption(_swigobj,_swigarg0) (_swigobj->HasOption(_swigarg0))
static PyObject *_wrap_wxImage_HasOption(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
bool _result;
wxImage * _arg0;
wxString * _arg1;
PyObject * _argo0 = 0;
PyObject * _obj1 = 0;
char *_kwnames[] = { "self","name", NULL };
self = self;
if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxImage_HasOption",_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_HasOption. Expected _wxImage_p.");
return NULL;
}
}
{
#if PYTHON_API_VERSION >= 1009
char* tmpPtr; int tmpSize;
if (!PyString_Check(_obj1) && !PyUnicode_Check(_obj1)) {
PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
return NULL;
}
if (PyString_AsStringAndSize(_obj1, &tmpPtr, &tmpSize) == -1)
return NULL;
_arg1 = new wxString(tmpPtr, tmpSize);
#else
if (!PyString_Check(_obj1)) {
PyErr_SetString(PyExc_TypeError, wxStringErrorMsg);
return NULL;
}
_arg1 = new wxString(PyString_AS_STRING(_obj1), PyString_GET_SIZE(_obj1));
#endif
}
{
wxPy_BEGIN_ALLOW_THREADS;
_result = (bool )wxImage_HasOption(_arg0,*_arg1);
wxPy_END_ALLOW_THREADS;
if (PyErr_Occurred()) return NULL;
} _resultobj = Py_BuildValue("i",_result);
{
if (_obj1)
delete _arg1;
}
return _resultobj;
}
#define wxImage_CountColours(_swigobj,_swigarg0) (_swigobj->CountColours(_swigarg0))
static PyObject *_wrap_wxImage_CountColours(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
@ -2327,6 +2650,12 @@ static PyMethodDef imagecMethods[] = {
{ "wxImage_InsertHandler", (PyCFunction) _wrap_wxImage_InsertHandler, METH_VARARGS | METH_KEYWORDS },
{ "wxImage_AddHandler", (PyCFunction) _wrap_wxImage_AddHandler, 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 },
{ "wxImage_GetOption", (PyCFunction) _wrap_wxImage_GetOption, METH_VARARGS | METH_KEYWORDS },
{ "wxImage_SetOptionInt", (PyCFunction) _wrap_wxImage_SetOptionInt, METH_VARARGS | METH_KEYWORDS },
{ "wxImage_SetOption", (PyCFunction) _wrap_wxImage_SetOption, METH_VARARGS | METH_KEYWORDS },
{ "wxImage_ConvertToMono", (PyCFunction) _wrap_wxImage_ConvertToMono, METH_VARARGS | METH_KEYWORDS },
{ "wxImage_Replace", (PyCFunction) _wrap_wxImage_Replace, METH_VARARGS | METH_KEYWORDS },
{ "wxImage_Mirror", (PyCFunction) _wrap_wxImage_Mirror, METH_VARARGS | METH_KEYWORDS },
{ "wxImage_Rotate90", (PyCFunction) _wrap_wxImage_Rotate90, METH_VARARGS | METH_KEYWORDS },

View File

@ -247,6 +247,25 @@ class wxImagePtr(wxObjectPtr):
def Replace(self, *_args, **_kwargs):
val = apply(imagec.wxImage_Replace,(self,) + _args, _kwargs)
return val
def ConvertToMono(self, *_args, **_kwargs):
val = apply(imagec.wxImage_ConvertToMono,(self,) + _args, _kwargs)
if val: val = wxImagePtr(val) ; val.thisown = 1
return val
def SetOption(self, *_args, **_kwargs):
val = apply(imagec.wxImage_SetOption,(self,) + _args, _kwargs)
return val
def SetOptionInt(self, *_args, **_kwargs):
val = apply(imagec.wxImage_SetOptionInt,(self,) + _args, _kwargs)
return val
def GetOption(self, *_args, **_kwargs):
val = apply(imagec.wxImage_GetOption,(self,) + _args, _kwargs)
return val
def GetOptionInt(self, *_args, **_kwargs):
val = apply(imagec.wxImage_GetOptionInt,(self,) + _args, _kwargs)
return val
def HasOption(self, *_args, **_kwargs):
val = apply(imagec.wxImage_HasOption,(self,) + _args, _kwargs)
return val
def CountColours(self, *_args, **_kwargs):
val = apply(imagec.wxImage_CountColours,(self,) + _args, _kwargs)
return val