From 1f906c064357c8a0c3b8fd1e10627a0810369f6b Mon Sep 17 00:00:00 2001 From: svenstaro Date: Sun, 18 Jul 2010 15:15:00 +0000 Subject: [PATCH] PySFML 1.6 and 2.0: Fixed SetSmooth and implemented IsSmooth git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1531 4e206d99-4929-0410-ac5d-dfc041789085 --- python/src/Image.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/python/src/Image.cpp b/python/src/Image.cpp index 000773bd..8eee10e4 100644 --- a/python/src/Image.cpp +++ b/python/src/Image.cpp @@ -210,6 +210,12 @@ PySfImage_SetSmooth (PySfImage *self, PyObject *args) Py_RETURN_NONE; } +static PyObject * +PySfImage_IsSmooth (PySfImage *self) +{ + return PyBool_FromLong(self->obj->IsSmooth()); +} + static PyObject * PySfImage_GetWidth(PySfImage *self) { @@ -233,7 +239,7 @@ static PyObject * PySfImage_GetTexCoords(PySfImage* self, PyObject *args) { PySfIntRect *RectArg = NULL; - + if (!PyArg_ParseTuple(args, "O!:Image.GetTextCoords", &PySfIntRectType, &RectArg)) return NULL; @@ -295,7 +301,8 @@ Create the image from the current contents of the given window. Return True if c {"GetPixels", (PyCFunction)PySfImage_GetPixels, METH_NOARGS, "GetPixels()\nGet a string representing the array of pixels (8 bits integers RGBA). String length is GetWidth() x GetHeight() x 4. This string becomes invalid if you reload or resize the image."}, {"CreateMaskFromColor", (PyCFunction)PySfImage_CreateMaskFromColor, METH_O, "CreateMaskFromColor(Color)\nCreate transparency mask from a specified colorkey."}, {"Bind", (PyCFunction)PySfImage_Bind, METH_NOARGS, "Bind()\nBind the image for rendering."}, - {"SetSmooth", (PyCFunction)PySfImage_SetSmooth, METH_VARARGS, "SetSmooth(Smooth)\nEnable or disable image smooth filter."}, + {"SetSmooth", (PyCFunction)PySfImage_SetSmooth, METH_O, "SetSmooth(Smooth)\nEnable or disable image smooth filter."}, + {"IsSmooth", (PyCFunction)PySfImage_IsSmooth, METH_NOARGS, "IsOpened(Smooth)\nTells whether the smooth filtering is enabled or not."}, {"GetWidth", (PyCFunction)PySfImage_GetWidth, METH_NOARGS, "GetWidth()\nReturn the width of the image."}, {"GetHeight", (PyCFunction)PySfImage_GetHeight, METH_NOARGS, "GetHeight()\nReturn the height of the image."}, {"GetTexCoords", (PyCFunction)PySfImage_GetTexCoords, METH_VARARGS, "GetTexCoords(Rect)\nConvert a subrect expressed in pixels, into float texture coordinates. Returns texture coordinates corresponding to the sub-rectangle (sf.FloatRect instance)\n\ @@ -379,7 +386,7 @@ PySfImage_Copy(PySfImage* self, PyObject *args, PyObject *kwds) unsigned int DestX, DestY; PyObject *PyApplyAlpha = NULL; bool ApplyAlpha = false; - + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!II|O!O:Image.Copy", (char **)kwlist, &PySfImageType, &Source, &DestX, &DestY, &PySfIntRectType, &SourceRect, &PyApplyAlpha)) return NULL;