Skip to content

Commit

Permalink
Fixed docs for review
Browse files Browse the repository at this point in the history
  • Loading branch information
oddbookworm committed May 20, 2024
1 parent cf91362 commit ea49ccf
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 6 deletions.
33 changes: 30 additions & 3 deletions docs/reST/ref/surface.rst
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@
| :sl:`get the dimensions of the Surface`
| :sg:`get_size() -> (width, height)`
Return the width and height of the Surface in pixels.
Return the width and height of the Surface in pixels. Can also be accessed with :attr:`size`

.. ## Surface.get_size ##
Expand All @@ -737,7 +737,7 @@
| :sl:`get the width of the Surface`
| :sg:`get_width() -> width`
Return the width of the Surface in pixels.
Return the width of the Surface in pixels. Can also be accessed with :attr:`width`

.. ## Surface.get_width ##
Expand All @@ -746,7 +746,7 @@
| :sl:`get the height of the Surface`
| :sg:`get_height() -> height`
Return the height of the Surface in pixels.
Return the height of the Surface in pixels. Can also be accessed with :attr:`height`

.. ## Surface.get_height ##
Expand Down Expand Up @@ -1039,6 +1039,33 @@

.. ## Surface.premul_alpha ##
.. attribute:: width

| :sl:`Surface width in pixels (read-only)`
| :sg:`width -> int`
Read-only attribute. Same as :meth:`get_width()`

.. versionadded:: 2.5.0

.. attribute:: height

| :sl:`Surface height in pixels (read-only)`
| :sg:`height->int`
Read-only attribute. Same as :meth:`get_height()`

.. versionadded:: 2.5.0

.. attribute:: size

| :sl:`Surface size in pixels (read-only)`
| :sg:`height->tuple[int, int]`
Read-only attribute. Same as :meth:`get_size()`

.. versionadded:: 2.5.0

.. ## pygame.Surface ##
3 changes: 3 additions & 0 deletions src_c/doc/surface_doc.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,6 @@
#define DOC_SURFACE_GETBUFFER "get_buffer() -> BufferProxy\nacquires a buffer object for the pixels of the Surface."
#define DOC_SURFACE_PIXELSADDRESS "_pixels_address -> int\npixel buffer address"
#define DOC_SURFACE_PREMULALPHA "premul_alpha() -> Surface\nreturns a copy of the surface with the RGB channels pre-multiplied by the alpha channel."
#define DOC_SURFACE_WIDTH "width -> int\nSurface width in pixels (read-only)"
#define DOC_SURFACE_HEIGHT "height->int\nSurface height in pixels (read-only)"
#define DOC_SURFACE_SIZE "height->tuple[int, int]\nSurface size in pixels (read-only)"
6 changes: 3 additions & 3 deletions src_c/surface.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,9 @@ _PgSurface_SrcAlpha(SDL_Surface *surf);
static PyGetSetDef surface_getsets[] = {
{"_pixels_address", (getter)surf_get_pixels_address, NULL,
"pixel buffer address (readonly)", NULL},
{"width", (getter)surf_get_width, NULL, NULL, NULL},
{"height", (getter)surf_get_height, NULL, NULL, NULL},
{"size", (getter)surf_get_size, NULL, NULL, NULL},
{"width", (getter)surf_get_width, NULL, DOC_SURFACE_WIDTH, NULL},
{"height", (getter)surf_get_height, NULL, DOC_SURFACE_HEIGHT, NULL},
{"size", (getter)surf_get_size, NULL, DOC_SURFACE_SIZE, NULL},
{NULL, NULL, NULL, NULL, NULL}};

static struct PyMethodDef surface_methods[] = {
Expand Down

0 comments on commit ea49ccf

Please sign in to comment.