##### pygame documentation | Pygame Home || Help Contents || Reference Index Most useful stuff: Color | display | draw | event | font | image | key | locals | mixer | mouse | Rect | Surface | time | music | pygame Advanced stuff: cursors | joystick | mask | sprite | transform | BufferProxy | freetype | gfxdraw | midi | PixelArray | pixelcopy | sndarray | surfarray | math Other: camera | controller | examples | fastevent | scrap | tests | touch | version

## src_c/surface.c

This extension module defines Python type `pygame.Surface` pygame object for representing images.

Header file: src_c/include/pygame.h

type pgSurfaceObject

  A `pygame.Surface` instance.

PyTypeObject *pgSurface_Type

  The `pygame.Surface` Python type.

int pgSurface_Check(PyObject *x)

  Return true if x is a `pygame.Surface` instance

  Will return false if x is a subclass of Surface. This is a macro. No check is made that x is not NULL.

pgSurfaceObject *pgSurface_New(SDL_Surface *s)

  Return a new new pygame surface instance for SDL surface s. Return NULL on error.

SDL_Surface *pgSurface_AsSurface(PyObject *x)

  Return a pointer the SDL surface represented by the pygame Surface instance x.

  This is a macro. Argument x is assumed to be a Surface, or subclass of Surface, instance.

int pgSurface_Blit(PyObject *dstobj, PyObject *srcobj, SDL_Rect *dstrect, SDL_Rect *srcrect, int the_args)

  Blit the srcrect portion of Surface srcobj onto Surface dstobj at srcobj

  Argument the_args indicates the type of blit to perform: Normal blit (`0`), `PYGAME_BLEND_ADD`, `PYGAME_BLEND_SUB`, `PYGAME_BLEND_SUB`, `PYGAME_BLEND_MULT`, `PYGAME_BLEND_MIN`, `PYGAME_BLEND_MAX`, `PYGAME_BLEND_RGBA_ADD`, `PYGAME_BLEND_RGBA_SUB`, `PYGAME_BLEND_RGBA_MULT`, `PYGAME_BLEND_RGBA_MIN`, `PYGAME_BLEND_RGBA_MAX`, `PYGAME_BLEND_ALPHA_SDL2` and `PYGAME_BLEND_PREMULTIPLIED`. Argument dstrect is updated to the actual area on dstobj affected by the blit.

  The C version of the `pygame.Surface.blit()` method. Return `1` on success, `0` on an exception.

Edit on GitHub