chickadee » sdl2-image » load-rw*

load-rw rwops #!optional close?procedure
load-rw* rwops #!optional close?procedure

Attempts to load an image from an sdl2:rwops. This procedure allows you to load an image from a variety of sources, such as a blob, string, memory pointer, or file. See IMG_Load_RW.

The image may be any format supported by SDL_image, except TGA. If you want to load a TGA image from an sdl2:rwops, you should use load-typed-rw instead.

If close? is #t, the sdl2:rwops will be automatically closed after the image is loaded. See rw-close! in the sdl2 egg. If close? is #f (the default), the sdl2:rwops will not be closed.

Returns a sdl2:surface with the image contents. Signals an exception of kind (exn sdl2) if the image could not be loaded.

  • load-rw returns a managed sdl2:surface.
  • load-rw* returns an unmanaged sdl2:surface, which must be freed with free-surface! (from the sdl2 egg) when you are done with it.