%new wxBitmap* wxEmptyBitmap(int width, int height, int depth=-1);
%new wxBitmap* wxBitmapFromXPMData(PyObject* listOfStrings);
%new wxBitmap* wxBitmapFromIcon(const wxIcon& icon);
-%new wxBitmap* wxBitmapFromBits(char* bits, int width, int height, int depth = 1 );
+%new wxBitmap* wxBitmapFromBits(PyObject* bits, int width, int height, int depth = 1 );
// #ifdef __WXMSW__
// %new wxBitmap* wxBitmapFromData(PyObject* data, long type,
}
- wxBitmap* wxBitmapFromBits(char* bits, int width, int height, int depth = 1 ) {
- return new wxBitmap(bits, width, height, depth);
+ wxBitmap* wxBitmapFromBits(PyObject* bits, int width, int height, int depth = 1 ) {
+ char* buf;
+ int length;
+ PyString_AsStringAndSize(bits, &buf, &length);
+ return new wxBitmap(buf, width, height, depth);
}
int fill_style=wxODDEVEN_RULE);
void DrawPoint(long x, long y);
void DrawRectangle(long x, long y, long width, long height);
+ %name(DrawRectangleRect)void DrawRectangle(const wxRect& rect);
void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle);
void DrawRoundedRectangle(long x, long y, long width, long height, long radius=20);
void DrawSpline(int PCOUNT, wxPoint* points);
void SetBackgroundMode(int mode);
void SetClippingRegion(long x, long y, long width, long height);
%name(SetClippingRegionAsRegion) void SetClippingRegion(const wxRegion& region);
+ %name(SetClippingRect) void SetClippingRegion(const wxRect& rect);
void SetPalette(const wxPalette& colourMap);
void SetBrush(const wxBrush& brush);
void SetFont(const wxFont& font);
// Draw a point for every set of coordinants in pyPoints, optionally
// setting a new pen for each
PyObject* _DrawPointList(PyObject* pyPoints, PyObject* pyPens) {
+ wxPyBeginBlockThreads();
+
bool isFastSeq = PyList_Check(pyPoints) || PyTuple_Check(pyPoints);
bool isFastPens = PyList_Check(pyPens) || PyTuple_Check(pyPens);
int numObjs = 0;
PyObject* obj;
int x1, y1;
int i = 0;
+ PyObject* retval;
if (!PySequence_Check(pyPoints)) {
goto err0;
Py_DECREF(obj);
goto err0;
}
+ if (PyErr_Occurred()) {
+ retval = NULL;
+ if (!isFastPens)
+ Py_DECREF(obj);
+ goto exit;
+ }
+
// Now draw the point
self->DrawPoint(x1, y1);
}
Py_INCREF(Py_None);
- return Py_None;
+ retval = Py_None;
+ goto exit;
err1:
PyErr_SetString(PyExc_TypeError, "Expected a sequence of wxPens");
- return NULL;
+ retval = NULL;
+ goto exit;
err0:
PyErr_SetString(PyExc_TypeError, "Expected a sequence of (x,y) sequences.");
- return NULL;
+ retval = NULL;
+ goto exit;
+
+ exit:
+ wxPyEndBlockThreads();
+ return retval;
}
// Draw a line for every set of coordinants in pyLines, optionally
// setting a new pen for each
PyObject* _DrawLineList(PyObject* pyLines, PyObject* pyPens) {
+ wxPyBeginBlockThreads();
+
bool isFastSeq = PyList_Check(pyLines) || PyTuple_Check(pyLines);
bool isFastPens = PyList_Check(pyPens) || PyTuple_Check(pyPens);
int numObjs = 0;
PyObject* obj;
int x1, y1, x2, y2;
int i = 0;
+ PyObject* retval;
if (!PySequence_Check(pyLines)) {
goto err0;
Py_DECREF(obj);
goto err0;
}
+ if (PyErr_Occurred()) {
+ retval = NULL;
+ if (!isFastPens)
+ Py_DECREF(obj);
+ goto exit;
+ }
// Now draw the line
self->DrawLine(x1, y1, x2, y2);
}
Py_INCREF(Py_None);
- return Py_None;
+ retval = Py_None;
+ goto exit;
err1:
PyErr_SetString(PyExc_TypeError, "Expected a sequence of wxPens");
- return NULL;
+ retval = NULL;
+ goto exit;
+
err0:
PyErr_SetString(PyExc_TypeError, "Expected a sequence of (x1,y1, x2,y2) sequences.");
- return NULL;
+ retval = NULL;
+ goto exit;
+
+ exit:
+ wxPyEndBlockThreads();
+ return retval;
}
}
class wxRegion : public wxGDIObject {
public:
wxRegion(long x=0, long y=0, long width=0, long height=0);
+#ifndef __WXMAC__
+ %name(wxRegionFromPoints)wxRegion(int PCOUNT, wxPoint* points, int fillStyle = wxWINDING_RULE);
+#endif
~wxRegion();
void Clear();