Commits

Anonymous committed e4b0c64

Renamed base C API methods from *Object -> *Obj
Renamed sdl C API method SDLRect_FromRect -> SDLRectFromRect.
sdlgfx.primitives methods can handle base.Color and numeric values now.

Comments (0)

Files changed (26)

doc/capi/base.rst

   Converts radians to degrees. The own implementation will only be used, if no
   system-specific one was found.
 
+.. cfunction:: ARGB_2_RGBA(a)
+
+  Converts a 32-bit unsigned integer value from an 0xAARRGGBB layout to
+  a 32-bit unsigned integer value using an 0xRRGGBBAA layout.
+
+.. cfunction:: RGBA_2_ARGB(a)
+
+  Converts a 32-bit unsigned integer value from an 0xRRGGBBAA layout to
+  a 32-bit unsigned integer value using an 0xAARRGGBB layout.
+
 .. cfunction:: ADD_LIMIT(q,v,lower,upper)
                SUB_LIMIT(q,v,lower,upper)
 
   and converts it to an unsigned int, which will be stored in *val*. This
   returns 1 on success and 0 on failure.
 
-.. cfunction:: int PointFromObject (PyObject *obj, int *x, int *y)
+.. cfunction:: int PointFromObj (PyObject *obj, int *x, int *y)
 
   Tries to get two int values from the passed object. If the object is a
   :ctype:`PyRect` or :ctype:`PyFRect`, the topleft x and y values are taken,
   if the object is a sequence type, the first two items are used. This returns
   1 on success and 0 on failure.
 
-.. cfunction:: int SizeFromObject (PyObject *obj, pgint32 *x, pgint32 *y)
+.. cfunction:: int SizeFromObj (PyObject *obj, pgint32 *x, pgint32 *y)
 
   Tries to get two pgint32 values from the passed object. If the object is a
   :ctype:`PyRect` or :ctype:`PyFRect`, the width and height values are taken,
   if the object is a sequence type, the first two items are used. This returns
   1 on success and 0 on failure.
 
-.. cfunction:: int FPointFromObject (PyObject *obj, double *x, double *y)
+.. cfunction:: int FPointFromObj (PyObject *obj, double *x, double *y)
 
   Tries to get two double values from the passed object. If the object is a
   :ctype:`PyRect` or :ctype:`PyFRect`, the topleft x and y values are taken,
   if the object is a sequence type, the first two items are used. This returns
   1 on success and 0 on failure.
 
-.. cfunction:: int FSizeFromObject (PyObject *obj, double *x, double *y)
+.. cfunction:: int FSizeFromObj (PyObject *obj, double *x, double *y)
 
   Tries to get two double values from the passed object. If the object is a
   :ctype:`PyRect` or :ctype:`PyFRect`, the width and height values are taken,
   if the object is a sequence type, the first two items are used. This returns
   1 on success and 0 on failure.
 
-.. cfunction:: int ASCIIFromObject (PyObject *obj, char** text, PyObject **convobj)
+.. cfunction:: int ASCIIFromObj (PyObject *obj, char** text, PyObject **convobj)
 
   Tries to get ASCII text from the passed object and stores the result in
   *text*. If the object has to be converted, the conversion result will be
   stored in *convobj* and needs to be freed by the caller, once *text* is not
   required anymore. This returns 1 on success and 0 on failure.
 
-.. cfunction:: int UTF8FromObject (PyObject *obj, char** text, PyObject **convobj)
+.. cfunction:: int UTF8FromObj (PyObject *obj, char** text, PyObject **convobj)
 
   Tries to get UTF-8 encoded text from the passed object and stores the result
   in *text*. If the object has to be converted, the conversion result will be

doc/capi/sdlbase.rst

   values two Uint16-compatible values in the order (Sint16, Sint16,
   Uint16, Uint16). This returns 1 on success and 0 on failure.
 
-.. cfunction:: int SDLRect_FromRect (PyObject *obj, SDL_Rect *rect)
+.. cfunction:: int SDLRectFromRect (PyObject *obj, SDL_Rect *rect)
 
    Tries to convert the passed object to a :ctype:`SDL_Rect` and stores
    the result in the passed *rect*'s members. The object must be a valid

src/base/basemod.c

 }
 
 int
-PointFromObject (PyObject *obj, int *x, int *y)
+PointFromObj (PyObject *obj, int *x, int *y)
 {
     if (!obj || !x || !y)
     {
 }
 
 int
-FPointFromObject (PyObject *obj, double *x, double *y)
+FPointFromObj (PyObject *obj, double *x, double *y)
 {
     if (!obj || !x || !y)
     {
 }
 
 int
-SizeFromObject (PyObject *obj, pgint32 *w, pgint32 *h)
+SizeFromObj (PyObject *obj, pgint32 *w, pgint32 *h)
 {
     if (!obj || !w || !h)
     {
 }
 
 int
-FSizeFromObject (PyObject *obj, double *w, double *h)
+FSizeFromObj (PyObject *obj, double *w, double *h)
 {
     if (!obj || !w || !h)
     {
 }
 
 int
-ASCIIFromObject (PyObject *obj, char **text, PyObject **freeme)
+ASCIIFromObj (PyObject *obj, char **text, PyObject **freeme)
 {
     if (!obj || !text || !freeme)
     {
 }
 
 int
-UTF8FromObject (PyObject *obj, char **text, PyObject **freeme)
+UTF8FromObj (PyObject *obj, char **text, PyObject **freeme)
 {
     if (!obj || !text || !freeme)
     {
     c_api[PYGAME_BASE_FIRSTSLOT+4] = DoubleFromSeqIndex;
     c_api[PYGAME_BASE_FIRSTSLOT+5] = IntFromSeqIndex;
     c_api[PYGAME_BASE_FIRSTSLOT+6] = UintFromSeqIndex;
-    c_api[PYGAME_BASE_FIRSTSLOT+7] = PointFromObject;
-    c_api[PYGAME_BASE_FIRSTSLOT+8] = SizeFromObject;
-    c_api[PYGAME_BASE_FIRSTSLOT+9] = FPointFromObject;
-    c_api[PYGAME_BASE_FIRSTSLOT+10] = FSizeFromObject;
-    c_api[PYGAME_BASE_FIRSTSLOT+11] = ASCIIFromObject;
-    c_api[PYGAME_BASE_FIRSTSLOT+12] = UTF8FromObject;
+    c_api[PYGAME_BASE_FIRSTSLOT+7] = PointFromObj;
+    c_api[PYGAME_BASE_FIRSTSLOT+8] = SizeFromObj;
+    c_api[PYGAME_BASE_FIRSTSLOT+9] = FPointFromObj;
+    c_api[PYGAME_BASE_FIRSTSLOT+10] = FSizeFromObj;
+    c_api[PYGAME_BASE_FIRSTSLOT+11] = ASCIIFromObj;
+    c_api[PYGAME_BASE_FIRSTSLOT+12] = UTF8FromObj;
     c_api[PYGAME_BASE_FIRSTSLOT+13] = UlongFromObj;
     c_api[PYGAME_BASE_FIRSTSLOT+14] = LongFromObj;
     c_api[PYGAME_BASE_FIRSTSLOT+15] = ColorFromObj;
     char *name;
     PyObject *tmp;
 
-    if (!ASCIIFromObject (color, &name, &tmp))
+    if (!ASCIIFromObj (color, &name, &tmp))
         return 0;
 
     len = strlen (name);

src/base/floatrect.c

                     w = ((PyFRect*)rect)->w;
                     h = ((PyFRect*)rect)->h;
                 }
-                else if (!FSizeFromObject (rect, &w, &h))
+                else if (!FSizeFromObj (rect, &w, &h))
                     return -1;
             }
             else
             {
-                if (!FPointFromObject (pt, &x, &y))
+                if (!FPointFromObj (pt, &x, &y))
                     return -1;
-                if (!FSizeFromObject (rect, &w, &h))
+                if (!FSizeFromObj (rect, &w, &h))
                     return -1;
             }
         }
 _frect_setcenter (PyObject *self, PyObject *value, void *closure)
 {
     double x, y;
-    if (!FPointFromObject (value, &x, &y))
+    if (!FPointFromObj (value, &x, &y))
         return -1;
     
     ((PyFRect*)self)->x = DBL_SUB_LIMIT (x, (((PyFRect*)self)->w / 2));
 {
     double w, h;
 
-    if (!FSizeFromObject (value, &w, &h))
+    if (!FSizeFromObj (value, &w, &h))
         return -1;
 
     if (w < 0 || h < 0)
 _frect_setmidtop (PyObject *self, PyObject *value, void *closure)
 {
     double x, y;
-    if (!FPointFromObject (value, &x, &y))
+    if (!FPointFromObj (value, &x, &y))
         return -1;
 
     ((PyFRect*)self)->x = DBL_SUB_LIMIT (x, (((PyFRect*)self)->w / 2));
 _frect_setmidleft (PyObject *self, PyObject *value, void *closure)
 {
     double x, y;
-    if (!FPointFromObject (value, &x, &y))
+    if (!FPointFromObj (value, &x, &y))
         return -1;
 
     ((PyFRect*)self)->x = x;
 _frect_setmidbottom (PyObject *self, PyObject *value, void *closure)
 {
     double x, y;
-    if (!FPointFromObject (value, &x, &y))
+    if (!FPointFromObj (value, &x, &y))
         return -1;
     
     ((PyFRect*)self)->x = DBL_SUB_LIMIT (x, (((PyFRect*)self)->w / 2));
 _frect_setmidright (PyObject *self, PyObject *value, void *closure)
 {
     double x, y;
-    if (!FPointFromObject (value, &x, &y))
+    if (!FPointFromObj (value, &x, &y))
         return -1;
 
     ((PyFRect*)self)->x = DBL_SUB_LIMIT (x, ((PyFRect*)self)->w);
 _frect_settopleft (PyObject *self, PyObject *value, void *closure)
 {
     double x, y;
-    if (!FPointFromObject (value, &x, &y))
+    if (!FPointFromObj (value, &x, &y))
         return -1;
 
     ((PyFRect*)self)->x = x;
 _frect_settopright (PyObject *self, PyObject *value, void *closure)
 {
     double x, y;
-    if (!FPointFromObject (value, &x, &y))
+    if (!FPointFromObj (value, &x, &y))
         return -1;
 
     ((PyFRect*)self)->x = DBL_SUB_LIMIT (x, ((PyFRect*)self)->w);
 _frect_setbottomleft (PyObject *self, PyObject *value, void *closure)
 {
     double x, y;
-    if (!FPointFromObject (value, &x, &y))
+    if (!FPointFromObj (value, &x, &y))
         return -1;
 
     ((PyFRect*)self)->x = x;
 _frect_setbottomright (PyObject *self, PyObject *value, void *closure)
 {
     double x, y;
-    if (!FPointFromObject (value, &x, &y))
+    if (!FPointFromObj (value, &x, &y))
         return -1;
 
     ((PyFRect*)self)->x = DBL_SUB_LIMIT (x, ((PyFRect*)self)->w);
         PyErr_Clear ();
         if (!PyArg_ParseTuple (args, "O:move", &pos))
             return NULL;
-        if (!FPointFromObject (pos, &x, &y))
+        if (!FPointFromObj (pos, &x, &y))
             return NULL;
     }
 
         PyErr_Clear ();
         if (!PyArg_ParseTuple (args, "O:move_ip", &pos))
             return NULL;
-        if (!FPointFromObject (pos, &x, &y))
+        if (!FPointFromObj (pos, &x, &y))
             return NULL;
     }
 
         PyErr_Clear ();
         if (!PyArg_ParseTuple (args, "O:inflate", &pos))
             return NULL;
-        if (!FPointFromObject (pos, &x, &y))
+        if (!FPointFromObj (pos, &x, &y))
             return NULL;
     }
 
         PyErr_Clear ();
         if (!PyArg_ParseTuple (args, "O:inflate_ip", &pos))
             return NULL;
-        if (!FPointFromObject (pos, &x, &y))
+        if (!FPointFromObj (pos, &x, &y))
             return NULL;
     }
 
         PyErr_Clear ();
         if (!PyArg_ParseTuple (args, "O:collidepoint", &pos))
             return NULL;
-        if (!FPointFromObject (pos, &x, &y))
+        if (!FPointFromObj (pos, &x, &y))
             return NULL;
     }
 

src/base/internals.h

 int IntFromSeqIndex (PyObject* obj, Py_ssize_t _index, int* val);
 int UintFromSeqIndex (PyObject* obj, Py_ssize_t _index, unsigned int* val);
 int DoubleFromSeqIndex (PyObject* obj, Py_ssize_t _index, double* val);
-int PointFromObject (PyObject* obj, int *x, int *y);
-int SizeFromObject (PyObject* obj, pgint32 *w, pgint32 *h);
-int FPointFromObject (PyObject* obj, double *x, double *y);
-int FSizeFromObject (PyObject* obj, double *w, double *h);
-int ASCIIFromObject (PyObject *obj, char **text, PyObject **freeme);
-int UTF8FromObject (PyObject *obj, char **text, PyObject **freeme);
+int PointFromObj (PyObject* obj, int *x, int *y);
+int SizeFromObj (PyObject* obj, pgint32 *w, pgint32 *h);
+int FPointFromObj (PyObject* obj, double *x, double *y);
+int FSizeFromObj (PyObject* obj, double *w, double *h);
+int ASCIIFromObj (PyObject *obj, char **text, PyObject **freeme);
+int UTF8FromObj (PyObject *obj, char **text, PyObject **freeme);
 int LongFromObj (PyObject* obj, long* val);
 unsigned long UlongFromObj (PyObject* obj, long* val);
 int ColorFromObj (PyObject *obj, pguint32 *val);

src/base/pgbase.h

     (*(int(*)(PyObject*, Py_ssize_t, int*))PyGameBase_C_API[PYGAME_BASE_FIRSTSLOT+5])
 #define UintFromSeqIndex                                                \
     (*(int(*)(PyObject*, Py_ssize_t, unsigned int*))PyGameBase_C_API[PYGAME_BASE_FIRSTSLOT+6])
-#define PointFromObject                                                 \
+#define PointFromObj                                                    \
     (*(int(*)(PyObject*, int*, int*))PyGameBase_C_API[PYGAME_BASE_FIRSTSLOT+7])
-#define SizeFromObject                                                  \
+#define SizeFromObj                                                     \
     (*(int(*)(PyObject*, pgint32*, pgint32*))PyGameBase_C_API[PYGAME_BASE_FIRSTSLOT+8])
-#define FPointFromObject                                                \
+#define FPointFromObj                                                   \
     (*(int(*)(PyObject*, double*, double*))PyGameBase_C_API[PYGAME_BASE_FIRSTSLOT+9])
-#define FSizeFromObject                                                 \
+#define FSizeFromObj                                                    \
     (*(int(*)(PyObject*, double*, double*))PyGameBase_C_API[PYGAME_BASE_FIRSTSLOT+10])
-#define ASCIIFromObject                                                 \
+#define ASCIIFromObj                                                    \
     (*(int(*)(PyObject*, char**, PyObject**))PyGameBase_C_API[PYGAME_BASE_FIRSTSLOT+11])
-#define UTF8FromObject                                                  \
+#define UTF8FromObj                                                     \
     (*(int(*)(PyObject*, char**, PyObject**))PyGameBase_C_API[PYGAME_BASE_FIRSTSLOT+12])
 #define UlongFromObj                                                    \
     (*(int(*)(PyObject*, unsigned long*))PyGameBase_C_API[PYGAME_BASE_FIRSTSLOT+13])
                     w = (pgint32) trunc (((PyFRect*)rect)->w);
                     h = (pgint32) trunc (((PyFRect*)rect)->h);
                 }
-                else if (!SizeFromObject (rect, &w, &h))
+                else if (!SizeFromObj (rect, &w, &h))
                     return -1;
             }
             else
             {
-                if (!PointFromObject (pt, (int*)&x, (int*)&y))
+                if (!PointFromObj (pt, (int*)&x, (int*)&y))
                     return -1;
-                if (!SizeFromObject (rect, &w, &h))
+                if (!SizeFromObj (rect, &w, &h))
                     return -1;
             }
         }
 _rect_setcenter (PyObject *self, PyObject *value, void *closure)
 {
     pgint16 x, y;
-    if (!PointFromObject (value, (int*)&x, (int*)&y))
+    if (!PointFromObj (value, (int*)&x, (int*)&y))
         return -1;
 
     INT16_SUB_UINT16_LIMIT (x, (((PyRect*)self)->w >> 1), ((PyRect*)self)->x);
 {
     pguint16 w, h;
 
-    if (!SizeFromObject (value, (pgint32*)&w, (pgint32*)&h))
+    if (!SizeFromObj (value, (pgint32*)&w, (pgint32*)&h))
         return -1;
 
     ((PyRect*)self)->w = w;
 _rect_setmidtop (PyObject *self, PyObject *value, void *closure)
 {
     pgint16 x, y;
-    if (!PointFromObject (value, (int*)&x, (int*)&y))
+    if (!PointFromObj (value, (int*)&x, (int*)&y))
         return -1;
 
     INT16_SUB_UINT16_LIMIT (x, (((PyRect*)self)->w >> 1), ((PyRect*)self)->x);
 _rect_setmidleft (PyObject *self, PyObject *value, void *closure)
 {
     pgint16 x, y;
-    if (!PointFromObject (value, (int*)&x, (int*)&y))
+    if (!PointFromObj (value, (int*)&x, (int*)&y))
         return -1;
 
     ((PyRect*)self)->x = x;
 _rect_setmidbottom (PyObject *self, PyObject *value, void *closure)
 {
     pgint16 x, y;
-    if (!PointFromObject (value, (int*)&x, (int*)&y))
+    if (!PointFromObj (value, (int*)&x, (int*)&y))
         return -1;
 
     INT16_SUB_UINT16_LIMIT (x, (((PyRect*)self)->w >> 1), ((PyRect*)self)->x);
 _rect_setmidright (PyObject *self, PyObject *value, void *closure)
 {
     pgint16 x, y;
-    if (!PointFromObject (value, (int*)&x, (int*)&y))
+    if (!PointFromObj (value, (int*)&x, (int*)&y))
         return -1;
 
     INT16_SUB_UINT16_LIMIT (x, ((PyRect*)self)->w, ((PyRect*)self)->x);
 _rect_settopleft (PyObject *self, PyObject *value, void *closure)
 {
     pgint16 x, y;
-    if (!PointFromObject (value, (int*)&x, (int*)&y))
+    if (!PointFromObj (value, (int*)&x, (int*)&y))
         return -1;
 
     ((PyRect*)self)->x = x;
 _rect_settopright (PyObject *self, PyObject *value, void *closure)
 {
     pgint16 x, y;
-    if (!PointFromObject (value, (int*)&x, (int*)&y))
+    if (!PointFromObj (value, (int*)&x, (int*)&y))
         return -1;
 
     INT16_SUB_UINT16_LIMIT (x, ((PyRect*)self)->w, ((PyRect*)self)->x);
 _rect_setbottomleft (PyObject *self, PyObject *value, void *closure)
 {
     pgint16 x, y;
-    if (!PointFromObject (value, (int*)&x, (int*)&y))
+    if (!PointFromObj (value, (int*)&x, (int*)&y))
         return -1;
 
     ((PyRect*)self)->x = x;
 _rect_setbottomright (PyObject *self, PyObject *value, void *closure)
 {
     pgint16 x, y;
-    if (!PointFromObject (value, (int*)&x, (int*)&y))
+    if (!PointFromObj (value, (int*)&x, (int*)&y))
         return -1;
 
     INT16_SUB_UINT16_LIMIT (x, ((PyRect*)self)->w, ((PyRect*)self)->x);
         PyErr_Clear ();
         if (!PyArg_ParseTuple (args, "O:move", &pos))
             return NULL;
-        if (!PointFromObject (pos, (int*)&x, (int*)&y))
+        if (!PointFromObj (pos, (int*)&x, (int*)&y))
             return NULL;
     }
 
         PyErr_Clear ();
         if (!PyArg_ParseTuple (args, "O:move_ip", &pos))
             return NULL;
-        if (!PointFromObject (pos, (int*)&x, (int*)&y))
+        if (!PointFromObj (pos, (int*)&x, (int*)&y))
             return NULL;
     }
     rect->x = INT16_ADD_LIMIT (rect->x, x);
         PyErr_Clear ();
         if (!PyArg_ParseTuple (args, "O:inflate", &pos))
             return NULL;
-        if (!PointFromObject (pos, (int*)&x, (int*)&y))
+        if (!PointFromObj (pos, (int*)&x, (int*)&y))
             return NULL;
     }
 
         PyErr_Clear ();
         if (!PyArg_ParseTuple (args, "O:inflate_ip", &pos))
             return NULL;
-        if (!PointFromObject (pos, (int*)&x, (int*)&y))
+        if (!PointFromObj (pos, (int*)&x, (int*)&y))
             return NULL;
     }
 
         PyErr_Clear ();
         if (!PyArg_ParseTuple (args, "O:collidepoint", &pos))
             return NULL;
-        if (!PointFromObject (pos, (int*)&x, (int*)&y))
+        if (!PointFromObj (pos, (int*)&x, (int*)&y))
             return NULL;
     }
 

src/freetype/ft_font.c

     {
         CPyStreamWrapper *wrapper = CPyStreamWrapper_New (file);
         if (!wrapper)
-            return NULL;
+            return -1;
         if (PGFT_TryLoadFont_Stream (ft, font, wrapper, face_index) != 0)
         {
             if (PyErr_Occurred ())
         PyObject *tmp;
         char *filename;
 
-        if (!UTF8FromObject(file, &filename, &tmp))
+        if (!UTF8FromObj(file, &filename, &tmp))
         {
             PyErr_SetString(PyExc_ValueError, "Failed to decode file name");
             return -1;
         PyErr_Clear ();
         if (!PyArg_ParseTuple (args, "O", &size))
             return -1;
-        if (!SizeFromObject (size, (pgint32*)&w, (pgint32*)&h))
+        if (!SizeFromObj (size, (pgint32*)&w, (pgint32*)&h))
             return -1;
     }
     if (w <= 0 || h <= 0)
         PyErr_Clear ();
         if (!PyArg_ParseTuple (args, "O", &pt))
             return NULL;
-        if (!PointFromObject (pt, &x, &y))
+        if (!PointFromObj (pt, &x, &y))
             return NULL;
     }
 
         PyErr_Clear ();
         if (!PyArg_ParseTuple (args, "O|i", &pt, &value))
             return NULL;
-        if (!PointFromObject (pt, &x, &y))
+        if (!PointFromObj (pt, &x, &y))
             return NULL;
     }
 
         PyErr_Clear ();
         if (!PyArg_ParseTuple (args, "O!O", &PyMask_Type, &maskobj, &pt))
             return NULL;
-        if (!PointFromObject (pt, &x, &y))
+        if (!PointFromObj (pt, &x, &y))
             return NULL;
     }
 
         PyErr_Clear ();
         if (!PyArg_ParseTuple (args, "O!O", &PyMask_Type, &maskobj, &pt))
             return NULL;
-        if (!PointFromObject (pt, &x, &y))
+        if (!PointFromObj (pt, &x, &y))
             return NULL;
     }
 
         PyErr_Clear ();
         if (!PyArg_ParseTuple (args, "O!O", &PyMask_Type, &maskobj, &pt))
             return NULL;
-        if (!PointFromObject (pt, &x, &y))
+        if (!PointFromObj (pt, &x, &y))
             return NULL;
     }
 
         PyErr_Clear ();
         if (!PyArg_ParseTuple (args, "O", &pt))
             return NULL;
-        if (!PointFromObject (pt, &x, &y))
+        if (!PointFromObj (pt, &x, &y))
             return NULL;
     }
 
         PyErr_Clear ();
         if (!PyArg_ParseTuple (args, "O!O", &PyMask_Type, &maskobj, &pt))
             return NULL;
-        if (!PointFromObject (pt, &x, &y))
+        if (!PointFromObj (pt, &x, &y))
             return NULL;
     }
 
         PyErr_Clear ();
         if (!PyArg_ParseTuple (args, "O!O", &PyMask_Type, &maskobj, &pt))
             return NULL;
-        if (!PointFromObject (pt, &x, &y))
+        if (!PointFromObj (pt, &x, &y))
             return NULL;
     }
     
         PyErr_Clear ();
         if (!PyArg_ParseTuple (args, "|O", &pt))
             return NULL;
-        if (!PointFromObject (pt, &x, &y))
+        if (!PointFromObj (pt, &x, &y))
             return NULL;
     }
     
     }
     else if (pt)
     {
-        if (!PointFromObject (pt, &x, &y))
+        if (!PointFromObj (pt, &x, &y))
             return NULL;
     }
     
         if (PyArg_ParseTuple (args, "OOO|O", &databuf, &maskbuf, &size,
                 &pt))
             return -1;
-        if (!SizeFromObject (size, (pgint32*)&w, (pgint32*)&h))
+        if (!SizeFromObj (size, (pgint32*)&w, (pgint32*)&h))
             return -1;
-        if (!PointFromObject (pt, &hotx, &hoty))
+        if (!PointFromObj (pt, &hotx, &hoty))
             return -1;
     }
 
     str = PyObject_Str (ev->dict);
     if (!str)
         return NULL;
-    ret = UTF8FromObject (str, &dicttext, &tmp);
+    ret = UTF8FromObj (str, &dicttext, &tmp);
     Py_DECREF (str);
     if (!ret)
     {

src/sdl/mousemod.c

         PyObject *pt;
         if (!PyArg_ParseTuple (args, "O:warp", &pt))
             return NULL;
-        if (!PointFromObject (pt, (int*)&x, (int*)&y))
+        if (!PointFromObj (pt, (int*)&x, (int*)&y))
             return NULL;
     }
     SDL_WarpMouse (x, y);
 static PyObject*
 _sdl_setcursor (PyObject *self, PyObject *args)
 {
-    PyObject *cursor;
     SDL_Cursor *c;
     
     ASSERT_VIDEO_SURFACE_SET(NULL);

src/sdl/overlay.c

     }
     else
     {
-        if (!SizeFromObject (size, (pgint32*)&width, (pgint32*)&height))
+        if (!SizeFromObj (size, (pgint32*)&width, (pgint32*)&height))
             return -1;
     }
     
     if (!PyArg_ParseTuple (args, "|O:display", &rect))
         return NULL;
     
-    if (rect && !SDLRect_FromRect (rect, &sdlrect))
+    if (rect && !SDLRectFromRect (rect, &sdlrect))
         return NULL;
     if (!rect)
     {
     (*(int(*)(PyObject*,Py_ssize_t,Uint32*))PyGameSDLBase_C_API[PYGAME_SDLBASE_FIRSTSLOT+7])
 #define IsValidRect                                                     \
     (*(int(*)(PyObject*))PyGameSDLBase_C_API[PYGAME_SDLBASE_FIRSTSLOT+8])
-#define SDLRect_FromRect                                                \
+#define SDLRectFromRect                                                \
     (*(int(*)(PyObject*,SDL_Rect*))PyGameSDLBase_C_API[PYGAME_SDLBASE_FIRSTSLOT+9])
 #endif /* PYGAME_SDLBASE_INTERNAL */
 

src/sdl/rwopsmod.c

     {
         PyObject *tmp;
         char *filename;
-        if (!UTF8FromObject (obj, &filename, &tmp))
+        if (!UTF8FromObj (obj, &filename, &tmp))
             return NULL;
         Py_XDECREF (tmp);
         *canautoclose = 1;
     {
         PyObject *tmp;
         char *filename;
-        if (!UTF8FromObject (obj, &filename, &tmp))
+        if (!UTF8FromObj (obj, &filename, &tmp))
             return NULL;
         Py_XDECREF (tmp);
         *canautoclose = 1;
     {
         PyObject *tmp;
         char *filename;
-        if (!UTF8FromObject (obj, &filename, &tmp))
+        if (!UTF8FromObj (obj, &filename, &tmp))
             return NULL;
         Py_XDECREF (tmp);
         *canautoclose = 1;
     {
         PyObject *tmp;
         char *filename;
-        if (!UTF8FromObject (obj, &filename, &tmp))
+        if (!UTF8FromObj (obj, &filename, &tmp))
             return NULL;
         Py_XDECREF (tmp);
         *canautoclose = 1;
 static int Sint16FromSeqIndex (PyObject* obj, Py_ssize_t _index, Sint16* val);
 static int Uint32FromSeqIndex (PyObject* obj, Py_ssize_t _index, Uint32* val);
 static int IsValidRect (PyObject* rect);
-static int SDLRect_FromRect (PyObject* rect, SDL_Rect *sdlrect);
+static int SDLRectFromRect (PyObject* rect, SDL_Rect *sdlrect);
 
 typedef struct {
     int initialized : 1;
 }
 
 static int
-SDLRect_FromRect (PyObject* rect, SDL_Rect *sdlrect)
+SDLRectFromRect (PyObject* rect, SDL_Rect *sdlrect)
 {
     if (!rect || !sdlrect)
     {
     c_api[PYGAME_SDLBASE_FIRSTSLOT+6] = Sint16FromSeqIndex;
     c_api[PYGAME_SDLBASE_FIRSTSLOT+7] = Uint32FromSeqIndex;
     c_api[PYGAME_SDLBASE_FIRSTSLOT+8] = IsValidRect;
-    c_api[PYGAME_SDLBASE_FIRSTSLOT+9] = SDLRect_FromRect;
+    c_api[PYGAME_SDLBASE_FIRSTSLOT+9] = SDLRectFromRect;
    
     c_api_obj = PyCObject_FromVoidPtr ((void *) c_api, NULL);
     if (c_api_obj)

src/sdl/surface.c

         if (!PyArg_ParseTupleAndKeywords (args, kwds, "O|ilO", keys2, &size,
                 &depth, &flags, &masks))
             return -1;
-        if (!SizeFromObject (size, (pgint32*)&width, (pgint32*)&height))
+        if (!SizeFromObj (size, (pgint32*)&width, (pgint32*)&height))
             return -1;
     }
 
         SDL_SetClipRect (surface, NULL);
         return 0;
     }
-    if (!SDLRect_FromRect (value, &rect))
+    if (!SDLRectFromRect (value, &rect))
         return -1;
     SDL_SetClipRect (surface, &rect);
     return 0;
     SDL_Rect *rects, r;
     Py_ssize_t count, i;
     
-    if (SDLRect_FromRect (args, &r))
+    if (SDLRectFromRect (args, &r))
     {
         CLIP_RECT_TO_SURFACE (PySDLSurface_AsSDLSurface (self), &r);
 
         Py_RETURN_NONE;
     }
     else
-        PyErr_Clear (); /* From SDLRect_FromRect */
+        PyErr_Clear (); /* From SDLRectFromRect */
     
     if (!PySequence_Check (args))
     {
     {
         item = PySequence_ITEM (args, i);
 
-        if (!SDLRect_FromRect (item, &(rects[i])))
+        if (!SDLRectFromRect (item, &(rects[i])))
         {
             Py_XDECREF (item);
             PyMem_Free (rects);
         PyErr_Clear ();
         if (!PyArg_ParseTuple (args, "O", &pos))
             return NULL;
-        if (!PointFromObject (pos, &x, &y))
+        if (!PointFromObj (pos, &x, &y))
             return NULL;
     }
 
         PyErr_Clear ();
         if (!PyArg_ParseTuple (args, "OO", &pos, &color))
             return NULL;
-        if (!PointFromObject (pos, &x, &y))
+        if (!PointFromObj (pos, &x, &y))
             return NULL;
     }
 
         return NULL;
     }
 
-    if (srcr && !SDLRect_FromRect (srcr, &srcrect))
+    if (srcr && !SDLRectFromRect (srcr, &srcrect))
     {
         PyErr_Clear ();
         PyErr_SetString (PyExc_TypeError, "srcrect must be a Rect or FRect");
         return NULL;
     }
 
-    if (dstr && !PointFromObject (dstr, (int*)&(dstrect.x), (int*)&(dstrect.y)))
+    if (dstr && !PointFromObj (dstr, (int*)&(dstrect.x), (int*)&(dstrect.y)))
         return NULL;
 
     src = PySDLSurface_AsSDLSurface (srcsf);
         PyErr_SetString (PyExc_TypeError, "color must be a Color");
         return NULL;
     }
-    if (dstrect && !SDLRect_FromRect (dstrect, &rect))
+    if (dstrect && !SDLRectFromRect (dstrect, &rect))
     {
         PyErr_Clear ();
         PyErr_SetString (PyExc_TypeError, "rect must be a Rect");
         size_t len;
         PyObject *tmp;
 
-        if (!UTF8FromObject (file, &filename, &tmp))
+        if (!UTF8FromObj (file, &filename, &tmp))
             return NULL;
         Py_XDECREF (tmp);
 

src/sdl/videomod.c

         PyErr_Clear ();
         if (!PyArg_ParseTuple (args, "O|il:is_mode_ok", &size, &bpp, &flags))
             return NULL;
-        if (!SizeFromObject (size, (pgint32*)&width, (pgint32*)&height))
+        if (!SizeFromObj (size, (pgint32*)&width, (pgint32*)&height))
             return NULL;
     }
 
         if (!PyArg_ParseTupleAndKeywords (args, kwds, "O|il:set_mode", kwlist2,
                 &size, &bpp, &flags))
             return NULL;
-        if (!SizeFromObject (size, (pgint32*)&width, (pgint32*)&height))
+        if (!SizeFromObj (size, (pgint32*)&width, (pgint32*)&height))
             return NULL;
     }
 

src/sdlext/drawmod.c

     }
     else
     {
-        if (!PointFromObject (p1, &x1, &_y1) ||
-            !PointFromObject (p2, &x2, &y2))
+        if (!PointFromObj (p1, &x1, &_y1) ||
+            !PointFromObj (p2, &x2, &y2))
             return NULL;
     }
     
     }
     else
     {
-        if (!PointFromObject (p1, &x1, &_y1) ||
-            !PointFromObject (p2, &x2, &y2))
+        if (!PointFromObj (p1, &x1, &_y1) ||
+            !PointFromObj (p2, &x2, &y2))
             return NULL;
     }
     
     for (i = 0; i < count; i++)
     {
         item = PySequence_ITEM (list, i);
-        if (!PointFromObject (item, &x, &y))
+        if (!PointFromObj (item, &x, &y))
         {
             Py_XDECREF (item);
             PyMem_Free (xpts);
     for (i = 0; i < count; i++)
     {
         item = PySequence_ITEM (list, i);
-        if (!PointFromObject (item, &x, &y))
+        if (!PointFromObj (item, &x, &y))
         {
             Py_XDECREF (item);
             PyMem_Free (xpts);
     if (!SDLColorFromObj (colorobj, surface->format, &color))
         return NULL;
 
-    if (!SDLRect_FromRect (rectobj, &rect))
+    if (!SDLRectFromRect (rectobj, &rect))
         return NULL;
 
     if (width < 0)
     if (!SDLColorFromObj (colorobj, surface->format, &color))
         return NULL;
 
-    if (!SDLRect_FromRect (rectobj, &rect))
+    if (!SDLRectFromRect (rectobj, &rect))
         return NULL;
 
     if (width < 0)
     }
     else
     {
-        if (!PointFromObject (pt, &px, &py))
+        if (!PointFromObj (pt, &px, &py))
             return NULL;
     }
 
     for (i = 0; i < count; i++)
     {
         item = PySequence_ITEM (list, i);
-        if (!PointFromObject (item, &x, &y))
+        if (!PointFromObj (item, &x, &y))
         {
             Py_XDECREF (item);
             PyMem_Free (xpts);
     for (i = 0; i < count; i++)
     {
         item = PySequence_ITEM (list, i);
-        if (!PointFromObject (item, &x, &y))
+        if (!PointFromObj (item, &x, &y))
         {
             Py_XDECREF (item);
             PyMem_Free (xpts);
     if (!SDLColorFromObj (colorobj, surface->format,  &color))
         return NULL;
 
-    if (!SDLRect_FromRect (rectobj, &rect))
+    if (!SDLRectFromRect (rectobj, &rect))
         return NULL;
 
     xpts[0] = rect.x; ypts[0] = rect.y;

src/sdlext/numericsurfarraymod.c

 {
     int dim[2], loopy;
     Uint8* data;
-    PyObject *surfobj, *array;
+    PyObject *array;
     SDL_Surface* surf;
     int stridex, stridey;
     

src/sdlext/pixelarray.c

  */
 static PyMappingMethods _pixelarray_mapping =
 {
-    (inquiry) _pixelarray_length,              /*mp_length*/
+    (lenfunc) _pixelarray_length,              /*mp_length*/
     (binaryfunc) _pixelarray_subscript,        /*mp_subscript*/
     (objobjargproc) _pixelarray_ass_subscript, /*mp_ass_subscript*/
 };

src/sdlext/transformmod.c

     }
     else
     {
-        if (!SizeFromObject (size, (pgint32*)&width, (pgint32*)&height))
+        if (!SizeFromObj (size, (pgint32*)&width, (pgint32*)&height))
             return NULL;
     }
     
         PyErr_SetString (PyExc_TypeError, "surface must be a Surface");
         return NULL;
     }
-    if (!SDLRect_FromRect (rectobj, &rect))
+    if (!SDLRectFromRect (rectobj, &rect))
         return NULL;
 
     surface = ((PySDLSurface*)surfobj)->surface;
     }
     else
     {
-        if (!SizeFromObject (size, (pgint32*)&width, (pgint32*)&height))
+        if (!SizeFromObj (size, (pgint32*)&width, (pgint32*)&height))
             return NULL;
     }
     
         PyErr_SetString (PyExc_TypeError, "surface must be Surface");
         return NULL;
     }
-    if (rectobj && !SDLRect_FromRect (rectobj, &sdlrect))
+    if (rectobj && !SDLRectFromRect (rectobj, &sdlrect))
         return NULL;
 
     surface = ((PySDLSurface*)surfobj)->surface;

src/sdlgfx/primitivesmod.c

 {
     PyObject *surface, *color, *pt;
     int x, y;
-    Uint32 c;
+    pguint32 c;
 
     ASSERT_VIDEO_INIT (NULL);
 
     }
     else
     {
-        if (!PointFromObject (pt, &x, &y))
+        if (!PointFromObj (pt, &x, &y))
             return NULL;
     }
     
     if (!ColorFromObj (color, &c))
         return NULL;
 
-    if (pixelColor (((PySDLSurface*)surface)->surface, (Sint16)x, (Sint16)y, c)
-        == -1)
+    if (pixelColor (((PySDLSurface*)surface)->surface, (Sint16)x, (Sint16)y,
+            (Uint32)c)== -1)
     {
         PyErr_SetString (PyExc_PyGameError, SDL_GetError ());
         return NULL;
 {
     PyObject *surface, *color;
     int x1, x2, y;
-    Uint32 c;
+    pguint32 c;
 
     ASSERT_VIDEO_INIT (NULL);
 
         PyErr_SetString (PyExc_TypeError, "surface must be a Surface");
         return NULL;
     }
-    if (!PyColor_Check (color))
-    {
-        PyErr_SetString (PyExc_TypeError, "color must be a Color");
+
+    if (!ColorFromObj (color, &c))
         return NULL;
-    }
-
-    c = (Uint32) PyColor_AsNumber (color);
-    c = ARGB_2_RGBA (c);
 
     if (hlineColor (((PySDLSurface*)surface)->surface,
-            (Sint16)x1, (Sint16)x2, y, c) == -1)
+            (Sint16)x1, (Sint16)x2, y, (Uint32)c) == -1)
     {
         PyErr_SetString (PyExc_PyGameError, SDL_GetError ());
         return NULL;
 {
     PyObject *surface, *color;
     int x, _y1, y2;
-    Uint32 c;
+    pguint32 c;
 
     ASSERT_VIDEO_INIT (NULL);
 
         PyErr_SetString (PyExc_TypeError, "surface must be a Surface");
         return NULL;
     }
-    if (!PyColor_Check (color))
-    {
-        PyErr_SetString (PyExc_TypeError, "color must be a Color");
+
+    if (!ColorFromObj (color, &c))
         return NULL;
-    }
-
-    c = (Uint32) PyColor_AsNumber (color);
-    c = ARGB_2_RGBA (c);
 
     if (vlineColor (((PySDLSurface*)surface)->surface, (Sint16) x, (Sint16)_y1,
-            (Sint16)y2, c) == -1)
+            (Sint16)y2, (Uint32)c) == -1)
     {
         PyErr_SetString (PyExc_PyGameError, SDL_GetError ());
         return NULL;
     PyObject *surface, *color, *rect;
     SDL_Rect sdlrect;
     Sint16 x1, x2, _y1, y2;
-    Uint32 c;
+    pguint32 c;
 
     ASSERT_VIDEO_INIT (NULL);
 
         PyErr_SetString (PyExc_TypeError, "surface must be a Surface");
         return NULL;
     }
-    if (!SDLRect_FromRect (rect, &sdlrect))
+    if (!SDLRectFromRect (rect, &sdlrect))
         return NULL;
 
-    if (!PyColor_Check (color))
-    {
-        PyErr_SetString (PyExc_TypeError, "color must be a Color");
-        return NULL;
-    }
-
     x1 = sdlrect.x;
     _y1 = sdlrect.y;
     x2 = (Sint16) (sdlrect.x + sdlrect.w);
     y2 = (Sint16) (sdlrect.y + sdlrect.h);
-    c = (Uint32) PyColor_AsNumber (color);
-    c = ARGB_2_RGBA (c);
+    if (!ColorFromObj (color, &c))
+        return NULL;
 
-    if (rectangleColor (((PySDLSurface*)surface)->surface, x1, _y1, x2, y2, c)
-        == -1)
+    if (rectangleColor (((PySDLSurface*)surface)->surface, x1, _y1, x2, y2,
+            (Uint32)c) == -1)
     {
         PyErr_SetString (PyExc_PyGameError, SDL_GetError ());
         return NULL;
     PyObject *surface, *color, *rect;
     SDL_Rect sdlrect;
     Sint16 x1, x2, _y1, y2;
-    Uint32 c;
+    pguint32 c;
 
     ASSERT_VIDEO_INIT (NULL);
 
         PyErr_SetString (PyExc_TypeError, "surface must be a Surface");
         return NULL;
     }
-    if (!SDLRect_FromRect (rect, &sdlrect))
+    if (!SDLRectFromRect (rect, &sdlrect))
         return NULL;
 
-    if (!PyColor_Check (color))
-    {
-        PyErr_SetString (PyExc_TypeError, "color must be a Color");
-        return NULL;
-    }
-
     x1 = sdlrect.x;
     _y1 = sdlrect.y;
     x2 = (Sint16) (sdlrect.x + sdlrect.w);
     y2 = (Sint16) (sdlrect.y + sdlrect.h);
-    c = (Uint32) PyColor_AsNumber (color);
-    c = ARGB_2_RGBA (c);
-
-    if (boxColor (((PySDLSurface*)surface)->surface, x1, _y1, x2, y2, c) == -1)
+    if (!ColorFromObj (color, &c))
+        return NULL;
+ 
+    if (boxColor (((PySDLSurface*)surface)->surface, x1, _y1, x2, y2,
+            (Uint32)c) == -1)
     {
         PyErr_SetString (PyExc_PyGameError, SDL_GetError ());
         return NULL;
     PyObject *surface, *color;
     PyObject *p1, *p2;
     int x1, x2, _y1, y2;
-    Uint32 c;
+    pguint32 c;
 
     ASSERT_VIDEO_INIT (NULL);
 
     }
     else
     {
-        if (!PointFromObject (p1, &x1, &_y1) || !PointFromObject (p2, &x2, &y2))
+        if (!PointFromObj (p1, &x1, &_y1) || !PointFromObj (p2, &x2, &y2))
             return NULL;
     }
     
         PyErr_SetString (PyExc_TypeError, "surface must be a Surface");
         return NULL;
     }
-    if (!PyColor_Check (color))
-    {
-        PyErr_SetString (PyExc_TypeError, "color must be a Color");
+
+    if (!ColorFromObj (color, &c))
         return NULL;
-    }
-
-    c = (Uint32) PyColor_AsNumber (color);
-    c = ARGB_2_RGBA (c);
 
     if (aalineColor (((PySDLSurface*)surface)->surface, 
-            (Sint16)x1, (Sint16)_y1, (Sint16)x2, (Sint16)y2, c) == -1)
+            (Sint16)x1, (Sint16)_y1, (Sint16)x2, (Sint16)y2, (Uint32)c) == -1)
     {
         PyErr_SetString (PyExc_PyGameError, SDL_GetError ());
         return NULL;
     PyObject *surface, *color;
     PyObject *p1, *p2;
     int x1, x2, _y1, y2;
-    Uint32 c;
+    pguint32 c;
 
     ASSERT_VIDEO_INIT (NULL);
 
     }
     else
     {
-        if (!PointFromObject (p1, &x1, &_y1) || !PointFromObject (p2, &x2, &y2))
+        if (!PointFromObj (p1, &x1, &_y1) || !PointFromObj (p2, &x2, &y2))
             return NULL;
     }
     
         PyErr_SetString (PyExc_TypeError, "surface must be a Surface");
         return NULL;
     }
-    if (!PyColor_Check (color))
-    {
-        PyErr_SetString (PyExc_TypeError, "color must be a Color");
+
+    if (!ColorFromObj (color, &c))
         return NULL;
-    }
-
-    c = (Uint32) PyColor_AsNumber (color);
-    c = ARGB_2_RGBA (c);
 
     if (lineColor (((PySDLSurface*)surface)->surface, 
-            (Sint16)x1, (Sint16)_y1, (Sint16)x2, (Sint16)y2, c) == -1)
+            (Sint16)x1, (Sint16)_y1, (Sint16)x2, (Sint16)y2, (Uint32)c) == -1)
     {
         PyErr_SetString (PyExc_PyGameError, SDL_GetError ());
         return NULL;
 {
     PyObject *surface, *color, *pt;
     int x, y, r;
-    Uint32 c;
+    pguint32 c;
 
     ASSERT_VIDEO_INIT (NULL);
 
     }
     else
     {
-        if (!PointFromObject (pt, &x, &y))
+        if (!PointFromObj (pt, &x, &y))
             return NULL;
     }
     
         PyErr_SetString (PyExc_TypeError, "surface must be a Surface");
         return NULL;
     }
-    if (!PyColor_Check (color))
-    {
-        PyErr_SetString (PyExc_TypeError, "color must be a Color");
+
+    if (!ColorFromObj (color, &c))
         return NULL;
-    }
-
-    c = (Uint32) PyColor_AsNumber (color);
-    c = ARGB_2_RGBA (c);
 
     if (circleColor (((PySDLSurface*)surface)->surface,
-            (Sint16)x, (Sint16)y, (Sint16)r, c) == -1)
+            (Sint16)x, (Sint16)y, (Sint16)r, (Uint32)c) == -1)
     {
         PyErr_SetString (PyExc_PyGameError, SDL_GetError ());
         return NULL;
 {
     PyObject *surface, *color, *pt;
     int x, y, r, start, end;
-    Uint32 c;
+    pguint32 c;
 
     ASSERT_VIDEO_INIT (NULL);
 
     }
     else
     {
-        if (!PointFromObject (pt, &x, &y))
+        if (!PointFromObj (pt, &x, &y))
             return NULL;
     }
 
         PyErr_SetString (PyExc_TypeError, "surface must be a Surface");
         return NULL;
     }
-    if (!PyColor_Check (color))
-    {
-        PyErr_SetString (PyExc_TypeError, "color must be a Color");
+
+    if (!ColorFromObj (color, &c))
         return NULL;
-    }
-
-    c = (Uint32) PyColor_AsNumber (color);
-    c = ARGB_2_RGBA (c);
 
     if (arcColor (((PySDLSurface*)surface)->surface, (Sint16)x, (Sint16)y,
-            (Sint16)r, (Sint16)start, (Sint16)end, c) == -1)
+            (Sint16)r, (Sint16)start, (Sint16)end, (Uint32)c) == -1)
     {
         PyErr_SetString (PyExc_PyGameError, SDL_GetError ());
         return NULL;
 {
     PyObject *surface, *color, *pt;
     int x, y, r;
-    Uint32 c;
+    pguint32 c;
 
     ASSERT_VIDEO_INIT (NULL);
 
     }
     else
     {
-        if (!PointFromObject (pt, &x, &y))
+        if (!PointFromObj (pt, &x, &y))
             return NULL;
     }
 
         PyErr_SetString (PyExc_TypeError, "surface must be a Surface");
         return NULL;
     }
-    c = (Uint32) PyColor_AsNumber (color);
-    c = ARGB_2_RGBA (c);
+    if (!ColorFromObj (color, &c))
+        return NULL;
 
     if (aacircleColor (((PySDLSurface*)surface)->surface,
-            (Sint16)x, (Sint16)y, (Sint16)r, c) == -1)
+            (Sint16)x, (Sint16)y, (Sint16)r, (Uint32)c) == -1)
     {
         PyErr_SetString (PyExc_PyGameError, SDL_GetError ());
         return NULL;
 {
     PyObject *surface, *color, *pt;
     int x, y, r;
-    Uint32 c;
+    pguint32 c;
 
     ASSERT_VIDEO_INIT (NULL);
 
     }
     else
     {
-        if (!PointFromObject (pt, (int*)&x, (int*)&y))
+        if (!PointFromObj (pt, (int*)&x, (int*)&y))
             return NULL;
     }
     
         PyErr_SetString (PyExc_TypeError, "surface must be a Surface");
         return NULL;
     }
-    if (!PyColor_Check (color))
-    {
-        PyErr_SetString (PyExc_TypeError, "color must be a Color");
+    if (!ColorFromObj (color, &c))
         return NULL;
-    }
-    c = PyColor_AsNumber (color);
-    c = ARGB_2_RGBA (c);
 
     if (filledCircleColor (((PySDLSurface*)surface)->surface,
-            (Sint16)x, (Sint16)y, (Sint16)r, c) == -1)
+            (Sint16)x, (Sint16)y, (Sint16)r, (Uint32)c) == -1)
     {
         PyErr_SetString (PyExc_PyGameError, SDL_GetError ());
         return NULL;
 {
     PyObject *surface, *color, *pt, *rd;
     int x, y, rx, ry;
-    Uint32 c;
+    pguint32 c;
 
     ASSERT_VIDEO_INIT (NULL);
 
     }
     else
     {
-        if (!PointFromObject (pt, &x, &y) || !PointFromObject (rd, &rx, &ry))
+        if (!PointFromObj (pt, &x, &y) || !PointFromObj (rd, &rx, &ry))
             return NULL;
     }
     
         PyErr_SetString (PyExc_TypeError, "surface must be a Surface");
         return NULL;
     }
-    if (!PyColor_Check (color))
-    {
-        PyErr_SetString (PyExc_TypeError, "color must be a Color");
+    if (!ColorFromObj (color, &c))
         return NULL;
-    }
-
-    c = (Uint32) PyColor_AsNumber (color);
-    c = ARGB_2_RGBA (c);
 
     if (ellipseColor (((PySDLSurface*)surface)->surface, (Sint16)x, (Sint16)y,
-            (Sint16)rx, (Sint16)ry, c) == -1)
+            (Sint16)rx, (Sint16)ry, (Uint32)c) == -1)
     {
         PyErr_SetString (PyExc_PyGameError, SDL_GetError ());
         return NULL;
 {
     PyObject *surface, *color, *pt, *rd;
     int x, y, rx, ry;
-    Uint32 c;
+    pguint32 c;
 
     ASSERT_VIDEO_INIT (NULL);
 
     }
     else
     {
-        if (!PointFromObject (pt, &x, &y) || !PointFromObject (rd, &rx, &ry))
+        if (!PointFromObj (pt, &x, &y) || !PointFromObj (rd, &rx, &ry))
             return NULL;
     }
     
         PyErr_SetString (PyExc_TypeError, "surface must be a Surface");
         return NULL;
     }
-    if (!PyColor_Check (color))
-    {
-        PyErr_SetString (PyExc_TypeError, "color must be a Color");
+    if (!ColorFromObj (color, &c))
         return NULL;
-    }
-
-    c = (Uint32) PyColor_AsNumber (color);
-    c = ARGB_2_RGBA (c);
 
     if (aaellipseColor (((PySDLSurface*)surface)->surface,
-            (Sint16)x, (Sint16)y, (Sint16)rx, (Sint16)ry, c) == -1)
+            (Sint16)x, (Sint16)y, (Sint16)rx, (Sint16)ry, (Uint32)c) == -1)
     {
         PyErr_SetString (PyExc_PyGameError, SDL_GetError ());
         return NULL;
 {
     PyObject *surface, *color, *pt, *rd;
     int x, y, rx, ry;
-    Uint32 c;
+    pguint32 c;
 
     ASSERT_VIDEO_INIT (NULL);
 
     }
     else
     {
-        if (!PointFromObject (pt, &x, &y) || !PointFromObject (rd, &rx, &ry))
+        if (!PointFromObj (pt, &x, &y) || !PointFromObj (rd, &rx, &ry))
             return NULL;
     }
 
         PyErr_SetString (PyExc_TypeError, "surface must be a Surface");
         return NULL;
     }
-    if (!PyColor_Check (color))
-    {
-        PyErr_SetString (PyExc_TypeError, "color must be a Color");
+    if (!ColorFromObj (color, &c))
         return NULL;
-    }
-
-    c = (Uint32) PyColor_AsNumber (color);
-    c = ARGB_2_RGBA (c);
 
     if (filledEllipseColor (((PySDLSurface*)surface)->surface,
-            (Sint16)x, (Sint16)y, (Sint16)rx, (Sint16)ry, c) == -1)
+            (Sint16)x, (Sint16)y, (Sint16)rx, (Sint16)ry, (Uint32)c) == -1)
     {
         PyErr_SetString (PyExc_PyGameError, SDL_GetError ());
         return NULL;
 {
     PyObject *surface, *color, *pt;
     int x, y, r, start, end;
-    Uint32 c;
+    pguint32 c;
 
     ASSERT_VIDEO_INIT (NULL);
 
     }
     else
     {
-        if (!PointFromObject (pt, &x, &y))
+        if (!PointFromObj (pt, &x, &y))
             return NULL;
     }
     if (!PySDLSurface_Check (surface))
         PyErr_SetString (PyExc_TypeError, "surface must be a Surface");
         return NULL;
     }
-    if (!PyColor_Check (color))
-    {
-        PyErr_SetString (PyExc_TypeError, "color must be a Color");
+    if (!ColorFromObj (color, &c))
         return NULL;
-    }
-
-    c = (Uint32) PyColor_AsNumber (color);
-    c = ARGB_2_RGBA (c);
 
     if (pieColor (((PySDLSurface*)surface)->surface, (Sint16)x, (Sint16)y,
-            (Sint16)r, (Sint16)start, (Sint16)end, c) == -1)
+            (Sint16)r, (Sint16)start, (Sint16)end, (Uint32)c) == -1)
     {
         PyErr_SetString (PyExc_PyGameError, SDL_GetError ());
         return NULL;
 {
     PyObject *surface, *color, *pt;
     int x, y, r, start, end;
-    Uint32 c;
+    pguint32 c;
 
     ASSERT_VIDEO_INIT (NULL);
 
     }
     else
     {
-        if (!PointFromObject (pt, (int*)&x, (int*)&y))
+        if (!PointFromObj (pt, (int*)&x, (int*)&y))
             return NULL;
     }
     if (!PySDLSurface_Check (surface))
         PyErr_SetString (PyExc_TypeError, "surface must be a Surface");
         return NULL;
     }
-    if (!PyColor_Check (color))
-    {
-        PyErr_SetString (PyExc_TypeError, "color must be a Color");
+
+    if (!ColorFromObj (color, &c))
         return NULL;
-    }
-
-    c = (Uint32) PyColor_AsNumber (color);
-    c = ARGB_2_RGBA (c);
 
     if (filledPieColor (((PySDLSurface*)surface)->surface, (Sint16)x,
-            (Sint16)y, (Sint16)r, (Sint16)start, (Sint16)end, c) == -1)
+            (Sint16)y, (Sint16)r, (Sint16)start, (Sint16)end, (Uint32)c) == -1)
     {
         PyErr_SetString (PyExc_PyGameError, SDL_GetError ());
         return NULL;
 {
     PyObject *surface, *color, *p1, *p2, *p3;
     int x1, x2, x3, _y1, y2, y3;
-    Uint32 c;
+    pguint32 c;
 
     ASSERT_VIDEO_INIT (NULL);
 
     }
     else
     {
-        if (!PointFromObject (p1, &x1, &_y1) ||
-            !PointFromObject (p2, &x2, &y2) ||
-            !PointFromObject (p3, &x3, &y3))
+        if (!PointFromObj (p1, &x1, &_y1) ||
+            !PointFromObj (p2, &x2, &y2) ||
+            !PointFromObj (p3, &x3, &y3))
             return NULL;
     }
     
         PyErr_SetString (PyExc_TypeError, "surface must be a Surface");
         return NULL;
     }
-    if (!PyColor_Check (color))
-    {
-        PyErr_SetString (PyExc_TypeError, "color must be a Color");
+
+    if (!ColorFromObj (color, &c))
         return NULL;
-    }
-
-    c = (Uint32) PyColor_AsNumber (color);
-    c = ARGB_2_RGBA (c);
 
     if (trigonColor (((PySDLSurface*)surface)->surface,
             (Sint16)x1, (Sint16)_y1, (Sint16)x2, (Sint16)y2,
-            (Sint16)x3, (Sint16)y3, c) == -1)
+            (Sint16)x3, (Sint16)y3, (Uint32)c) == -1)
     {
         PyErr_SetString (PyExc_PyGameError, SDL_GetError ());
         return NULL;
 {
     PyObject *surface, *color, *p1, *p2, *p3;
     int x1, x2, x3, _y1, y2, y3;
-    Uint32 c;
+    pguint32 c;
 
     ASSERT_VIDEO_INIT (NULL);
 
     }
     else
     {
-        if (!PointFromObject (p1, &x1, &_y1) ||
-            !PointFromObject (p2, &x2, &y2) ||
-            !PointFromObject (p3, &x3, &y3))
+        if (!PointFromObj (p1, &x1, &_y1) ||
+            !PointFromObj (p2, &x2, &y2) ||
+            !PointFromObj (p3, &x3, &y3))
             return NULL;
     }
     
         PyErr_SetString (PyExc_TypeError, "surface must be a Surface");
         return NULL;
     }
-    if (!PyColor_Check (color))
-    {
-        PyErr_SetString (PyExc_TypeError, "color must be a Color");
+
+    if (!ColorFromObj (color, &c))
         return NULL;
-    }
-
-    c = (Uint32) PyColor_AsNumber (color);
-    c = ARGB_2_RGBA (c);
 
     if (aatrigonColor (((PySDLSurface*)surface)->surface,
             (Sint16)x1, (Sint16)_y1, (Sint16)x2, (Sint16)y2,
-            (Sint16)x3, (Sint16)y3, c) == -1)
+            (Sint16)x3, (Sint16)y3, (Uint32)c) == -1)
     {
         PyErr_SetString (PyExc_PyGameError, SDL_GetError ());
         return NULL;
 {
     PyObject *surface, *color, *p1, *p2, *p3;
     int x1, x2, x3, _y1, y2, y3;
-    Uint32 c;
+    pguint32 c;
 
     ASSERT_VIDEO_INIT (NULL);
 
     }
     else
     {
-        if (!PointFromObject (p1, &x1, &_y1) ||
-            !PointFromObject (p2, &x2, &y2) ||
-            !PointFromObject (p3, &x3, &y3))
+        if (!PointFromObj (p1, &x1, &_y1) ||
+            !PointFromObj (p2, &x2, &y2) ||
+            !PointFromObj (p3, &x3, &y3))
             return NULL;
     }
     
         PyErr_SetString (PyExc_TypeError, "surface must be a Surface");
         return NULL;
     }
-    if (!PyColor_Check (color))
-    {
-        PyErr_SetString (PyExc_TypeError, "color must be a Color");
+
+    if (!ColorFromObj (color, &c))
         return NULL;
-    }
-
-    c = (Uint32) PyColor_AsNumber (color);
-    c = ARGB_2_RGBA (c);
 
     if (filledTrigonColor (((PySDLSurface*)surface)->surface,
             (Sint16)x1, (Sint16)_y1, (Sint16)x2, (Sint16)y2,
-            (Sint16)x3, (Sint16)y3, c) == -1)
+            (Sint16)x3, (Sint16)y3, (Uint32)c) == -1)
     {
         PyErr_SetString (PyExc_PyGameError, SDL_GetError ());
         return NULL;
     int tmp1, tmp2;
     Py_ssize_t count, i;
     int ret;
-    Uint32 c;
+    pguint32 c;
 
     ASSERT_VIDEO_INIT (NULL);
 
         PyErr_SetString (PyExc_TypeError, "surface must be a Surface");
         return NULL;
     }
-    if (!PyColor_Check (color))
-    {
-        PyErr_SetString (PyExc_TypeError, "color must be a Color");
-        return NULL;
-    }
     if (!PySequence_Check (points))
     {
         PyErr_SetString (PyExc_TypeError, "points must be a sequence");
             "points must contain more than 2 points");
         return NULL;
     }
-    c = (Uint32) PyColor_AsNumber (color);
-    c = ARGB_2_RGBA (c);
+
+    if (!ColorFromObj (color, &c))
+        return NULL;
 
     vx = PyMem_New (Sint16, (size_t) count);
     vy = PyMem_New (Sint16, (size_t) count);
     for (i = 0; i < count; i++)
     {
         item = PySequence_ITEM (points, i);
-        if (!PointFromObject (item, &tmp1, &tmp2))
+        if (!PointFromObj (item, &tmp1, &tmp2))
         {
             PyMem_Free (vx);
             PyMem_Free (vy);
 
     Py_BEGIN_ALLOW_THREADS;
     ret = polygonColor (((PySDLSurface*)surface)->surface, vx, vy, (int)count,
-        c);
+        (Uint32)c);
     Py_END_ALLOW_THREADS;
 
     PyMem_Free (vx);
     int tmp1, tmp2;
     Py_ssize_t count, i;
     int ret;
-    Uint32 c;
+    pguint32 c;
 
     ASSERT_VIDEO_INIT (NULL);
 
         PyErr_SetString (PyExc_TypeError, "surface must be a Surface");
         return NULL;
     }
-    if (!PyColor_Check (color))
-    {
-        PyErr_SetString (PyExc_TypeError, "color must be a Color");
-        return NULL;
-    }
     if (!PySequence_Check (points))
     {
         PyErr_SetString (PyExc_TypeError, "points must be a sequence");
             "points must contain more than 2 points");
         return NULL;
     }
-    c = (Uint32) PyColor_AsNumber (color);
-    c = ARGB_2_RGBA (c);
+
+    if (!ColorFromObj (color, &c))
+        return NULL;
 
     vx = PyMem_New (Sint16, (size_t) count);
     vy = PyMem_New (Sint16, (size_t) count);
     for (i = 0; i < count; i++)
     {
         item = PySequence_ITEM (points, i);
-        if (!PointFromObject (item, &tmp1, &tmp2))
+        if (!PointFromObj (item, &tmp1, &tmp2))
         {
             PyMem_Free (vx);
             PyMem_Free (vy);
 
     Py_BEGIN_ALLOW_THREADS;
     ret = aapolygonColor (((PySDLSurface*)surface)->surface, vx, vy, (int)count,
-        c);
+        (Uint32)c);
     Py_END_ALLOW_THREADS;
 
     PyMem_Free (vx);
     int tmp1, tmp2;
     Py_ssize_t count, i;
     int ret;
-    Uint32 c;
+    pguint32 c;
 
     ASSERT_VIDEO_INIT (NULL);
 
         PyErr_SetString (PyExc_TypeError, "surface must be a Surface");
         return NULL;
     }
-    if (!PyColor_Check (color))
-    {
-        PyErr_SetString (PyExc_TypeError, "color must be a Color");
-        return NULL;
-    }
     if (!PySequence_Check (points))
     {
         PyErr_SetString (PyExc_TypeError, "points must be a sequence");
             "points must contain more than 2 points");
         return NULL;
     }
-    c = (Uint32) PyColor_AsNumber (color);
-    c = ARGB_2_RGBA (c);
+
+    if (!ColorFromObj (color, &c))
+        return NULL;
 
     vx = PyMem_New (Sint16, (size_t) count);
     vy = PyMem_New (Sint16, (size_t) count);
     for (i = 0; i < count; i++)
     {
         item = PySequence_ITEM (points, i);
-        if (!PointFromObject (item, &tmp1, &tmp2))
+        if (!PointFromObj (item, &tmp1, &tmp2))
         {
             PyMem_Free (vx);
             PyMem_Free (vy);
 
     Py_BEGIN_ALLOW_THREADS;
     ret = filledPolygonColor (((PySDLSurface*)surface)->surface, vx, vy,
-        (int)count, c);
+        (int)count, (Uint32)c);
     Py_END_ALLOW_THREADS;
 
     PyMem_Free (vx);
     }
     else
     {
-        if (!PointFromObject (pt, &tdx, &tdy))
+        if (!PointFromObj (pt, &tdx, &tdy))
             return NULL;
     }
     
     for (i = 0; i < count; i++)
     {
         item = PySequence_ITEM (points, i);
-        if (!PointFromObject (item, &tmp1, &tmp2))
+        if (!PointFromObj (item, &tmp1, &tmp2))
         {
             PyMem_Free (vx);
             PyMem_Free (vy);
     int x, y;
     Py_ssize_t count, i;
     int ret, steps;
-    Uint32 c;
+    pguint32 c;
 
     ASSERT_VIDEO_INIT (NULL);
 
         PyErr_SetString (PyExc_TypeError, "surface must be a Surface");
         return NULL;
     }
-    if (!PyColor_Check (color))
-    {
-        PyErr_SetString (PyExc_TypeError, "color must be a Color");
-        return NULL;
-    }
     if (!PySequence_Check (points))
     {
         PyErr_SetString (PyExc_TypeError, "points must be a sequence");
             "points must contain more than 2 points");
         return NULL;
     }
-    c = (Uint32) PyColor_AsNumber (color);
-    c = ARGB_2_RGBA (c);
+
+    if (!ColorFromObj (color, &c))
+        return NULL;
 
     vx = PyMem_New (Sint16, (size_t) count);
     vy = PyMem_New (Sint16, (size_t) count);
     for (i = 0; i < count; i++)
     {
         item = PySequence_ITEM (points, i);
-        if (!PointFromObject (item, &x, &y))
+        if (!PointFromObj (item, &x, &y))
         {
             PyMem_Free (vx);
             PyMem_Free (vy);
 
     Py_BEGIN_ALLOW_THREADS;
     ret = bezierColor (((PySDLSurface*)surface)->surface, vx, vy, (int)count,
-        steps, c);
+        steps, (Uint32)c);
     Py_END_ALLOW_THREADS;
 
     PyMem_Free (vx);

src/sdlgfx/rotozoommod.c

             }
             else
             {
-                if (!SizeFromObject (obj, (pgint32*)&w, (pgint32*)&h))
+                if (!SizeFromObj (obj, (pgint32*)&w, (pgint32*)&h))
                     return NULL;
             }
         }
             }
             else
             {
-                if (!SizeFromObject (obj, (pgint32*)&w, (pgint32*)&h))
+                if (!SizeFromObj (obj, (pgint32*)&w, (pgint32*)&h))
                     return NULL;
             }
         }
             }
             else
             {
-                if (!SizeFromObject (obj, (pgint32*)&w, (pgint32*)&h))
+                if (!SizeFromObj (obj, (pgint32*)&w, (pgint32*)&h))
                     return NULL;
             }
         }

src/sdlimage/imagemod.c

 
 static PyMethodDef _image_methods[] = {
     { "init", _image_init, METH_VARARGS, DOC_BASE_INIT },
-    { "quit", _image_quit, METH_VARARGS, DOC_BASE_QUIT },
+    { "quit", (PyCFunction)_image_quit, METH_NOARGS, DOC_BASE_QUIT },
     { "get_error", (PyCFunction) _image_geterror, METH_NOARGS,
       DOC_BASE_GET_ERROR },
     { "load", _image_load, METH_VARARGS, DOC_BASE_LOAD },
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.