chickadee » sdl2 » make-surface*

make-surface width height depth/formatprocedure
make-surface* width height depth/formatprocedure

Create a new sdl2:surface with the given width, height, and color depth (bits per pixel) or pixel format. This is a more convenient interface for create-rgb-surface*.

If depth/format is an integer 64 or less, a surface of that color depth is created. The sdl2:surface's pixel format and masks will be chosen automatically based on the requested depth and the current platform's byte order (little endian or big endian).

If depth/format is a pixel format enum symbol or equivalent integer, a surface of that pixel format is created.

  • make-surface returns a memory-managed sdl2:surface.
  • make-surface* returns an unmanaged sdl2:surface, which should be freed with free-surface! when you are done with it.

These procedures signal an exception of kind (exn sdl2) if the sdl2:surface could not be created (e.g. because the color depth is unsupported).