@@ -196,6 +196,8 @@ surf_get_pitch(PyObject *self, PyObject *args);
196196static PyObject *
197197surf_get_rect (PyObject * self , PyObject * args , PyObject * kwargs );
198198static PyObject *
199+ surf_get_frect (PyObject * self , PyObject * args , PyObject * kwargs );
200+ static PyObject *
199201surf_get_width (PyObject * self , PyObject * args );
200202static PyObject *
201203surf_get_shifts (PyObject * self , PyObject * args );
@@ -356,6 +358,8 @@ static struct PyMethodDef surface_methods[] = {
356358 {"get_height" , surf_get_height , METH_NOARGS , DOC_SURFACE_GETHEIGHT },
357359 {"get_rect" , (PyCFunction )surf_get_rect , METH_VARARGS | METH_KEYWORDS ,
358360 DOC_SURFACE_GETRECT },
361+ {"get_frect" , (PyCFunction )surf_get_frect , METH_VARARGS | METH_KEYWORDS ,
362+ DOC_SURFACE_GETFRECT },
359363 {"get_pitch" , surf_get_pitch , METH_NOARGS , DOC_SURFACE_GETPITCH },
360364 {"get_bitsize" , surf_get_bitsize , METH_NOARGS , DOC_SURFACE_GETBITSIZE },
361365 {"get_bytesize" , surf_get_bytesize , METH_NOARGS , DOC_SURFACE_GETBYTESIZE },
@@ -2557,6 +2561,34 @@ surf_get_rect(PyObject *self, PyObject *args, PyObject *kwargs)
25572561 return rect ;
25582562}
25592563
2564+ static PyObject *
2565+ surf_get_frect (PyObject * self , PyObject * args , PyObject * kwargs )
2566+ {
2567+ PyObject * rect ;
2568+ SDL_Surface * surf = pgSurface_AsSurface (self );
2569+
2570+ if (PyTuple_GET_SIZE (args ) > 0 ) {
2571+ return RAISE (PyExc_TypeError ,
2572+ "get_frect only accepts keyword arguments" );
2573+ }
2574+
2575+ SURF_INIT_CHECK (surf )
2576+
2577+ rect = pgFRect_New4 (0.f , 0.f , (float )surf -> w , (float )surf -> h );
2578+ if (rect && kwargs ) {
2579+ PyObject * key , * value ;
2580+ Py_ssize_t pos = 0 ;
2581+
2582+ while (PyDict_Next (kwargs , & pos , & key , & value )) {
2583+ if ((PyObject_SetAttr (rect , key , value ) == -1 )) {
2584+ Py_DECREF (rect );
2585+ return NULL ;
2586+ }
2587+ }
2588+ }
2589+ return rect ;
2590+ }
2591+
25602592static PyObject *
25612593surf_get_bitsize (PyObject * self , PyObject * _null )
25622594{
0 commit comments