|
SDL3pp
A slim C++ wrapper for SDL3
|
SDL surfaces are buffers of pixels in system RAM. More...
Namespaces | |
| namespace | SDL::prop |
| Constants for Properties keys. | |
| namespace | SDL::prop::Surface |
| Properties for Surface. | |
Classes | |
| struct | SDL::Surface |
| A collection of pixels used in software blitting. More... | |
| class | SDL::SurfaceLock |
| Set up a surface for directly accessing the pixels. More... | |
Typedefs | |
| using | SDL::SurfaceRaw = SDL_Surface* |
| Alias to raw representation for Surface. | |
| using | SDL::SurfaceRawConst = const SDL_Surface* |
| Alias to const raw representation for Surface. | |
| using | SDL::SurfaceRef = ResourceRef<Surface> |
| Reference for Surface. | |
| using | SDL::SurfaceConstRef = ResourceConstRef<SurfaceRaw, SurfaceRawConst> |
| Safely wrap Surface for non owning const parameters. | |
| using | SDL::SurfaceFlags = Uint32 |
| The flags on an Surface. | |
| using | SDL::ScaleMode = SDL_ScaleMode |
| The scaling mode. | |
| using | SDL::FlipMode = SDL_FlipMode |
| The flip mode. | |
Functions | |
| constexpr bool | SDL::MustLock (SurfaceConstRef S) |
| Evaluates to true if the surface needs to be locked before access. | |
| Surface | SDL::CreateSurface (const PointRaw &size, PixelFormat format) |
| Allocate a new surface with a specific pixel format. | |
| Surface | SDL::CreateSurfaceFrom (const PointRaw &size, PixelFormat format, void *pixels, int pitch) |
| Allocate a new surface with a specific pixel format and existing pixel data. | |
| void | SDL::DestroySurface (SurfaceRaw surface) |
| Free a surface. | |
| PropertiesRef | SDL::GetSurfaceProperties (SurfaceConstRef surface) |
| Get the properties associated with a surface. | |
| void | SDL::SetSurfaceColorspace (SurfaceRef surface, Colorspace colorspace) |
| Set the colorspace used by a surface. | |
| Colorspace | SDL::GetSurfaceColorspace (SurfaceConstRef surface) |
| Get the colorspace used by a surface. | |
| Palette | SDL::CreateSurfacePalette (SurfaceRef surface) |
| Create a palette and associate it with a surface. | |
| void | SDL::SetSurfacePalette (SurfaceRef surface, PaletteRef palette) |
| Set the palette used by a surface. | |
| Palette | SDL::GetSurfacePalette (SurfaceConstRef surface) |
| Get the palette used by a surface. | |
| void | SDL::AddSurfaceAlternateImage (SurfaceRef surface, SurfaceRef image) |
| Add an alternate version of a surface. | |
| bool | SDL::SurfaceHasAlternateImages (SurfaceConstRef surface) |
| Return whether a surface has alternate versions available. | |
| OwnArray< SurfaceRaw > | SDL::GetSurfaceImages (SurfaceConstRef surface) |
| Get an array including all versions of a surface. | |
| void | SDL::RemoveSurfaceAlternateImages (SurfaceRef surface) |
| Remove all alternate versions of a surface. | |
| void | SDL::LockSurface (SurfaceRef surface) |
| Set up a surface for directly accessing the pixels. | |
| void | SDL::UnlockSurface (SurfaceRef surface) |
| Release a surface after directly accessing the pixels. | |
| Surface | SDL::LoadBMP_IO (IOStreamRef src, bool closeio=false) |
| Load a BMP image from a seekable SDL data stream. | |
| Surface | SDL::LoadBMP (StringParam file) |
| Load a BMP image from a file. | |
| void | SDL::SaveBMP_IO (SurfaceConstRef surface, IOStreamRef dst, bool closeio=false) |
| Save a surface to a seekable SDL data stream in BMP format. | |
| void | SDL::SaveBMP (SurfaceConstRef surface, StringParam file) |
| Save a surface to a file in BMP format. | |
| Surface | SDL::LoadTrustedPNG_IO (IOStreamRef src, bool closeio=false) |
| Load a PNG image from a seekable SDL data stream. | |
| Surface | SDL::LoadTrustedPNG (StringParam file) |
| Load a PNG image from a file. | |
| void | SDL::SaveTrustedPNG_IO (SurfaceConstRef surface, IOStreamRef dst, bool closeio=false) |
| Save a surface to a seekable SDL data stream in PNG format. | |
| void | SDL::SaveTrustedPNG (SurfaceConstRef surface, StringParam file) |
| Save a surface to a file in PNG format. | |
| void | SDL::SetSurfaceRLE (SurfaceRef surface, bool enabled) |
| Set the RLE acceleration hint for a surface. | |
| bool | SDL::SurfaceHasRLE (SurfaceConstRef surface) |
| Returns whether the surface is RLE enabled. | |
| void | SDL::SetSurfaceColorKey (SurfaceRef surface, std::optional< Uint32 > key) |
| Set the color key (transparent pixel) in a surface. | |
| void | SDL::ClearSurfaceColorKey (SurfaceRef surface) |
| Unset the color key (transparent pixel) in a surface. | |
| bool | SDL::SurfaceHasColorKey (SurfaceConstRef surface) |
| Returns whether the surface has a color key. | |
| std::optional< Uint32 > | SDL::GetSurfaceColorKey (SurfaceConstRef surface) |
| Get the color key (transparent pixel) for a surface. | |
| void | SDL::SetSurfaceColorMod (SurfaceRef surface, Uint8 r, Uint8 g, Uint8 b) |
| Set an additional color value multiplied into blit operations. | |
| void | SDL::GetSurfaceColorMod (SurfaceConstRef surface, Uint8 *r, Uint8 *g, Uint8 *b) |
| Get the additional color value multiplied into blit operations. | |
| void | SDL::SetSurfaceAlphaMod (SurfaceRef surface, Uint8 alpha) |
| Set an additional alpha value used in blit operations. | |
| Uint8 | SDL::GetSurfaceAlphaMod (SurfaceConstRef surface) |
| Get the additional alpha value used in blit operations. | |
| void | SDL::SetSurfaceMod (SurfaceRef surface, Color color) |
| Set an additional color and alpha value multiplied into blit operations. | |
| Color | SDL::GetSurfaceMod (SurfaceConstRef surface) |
| Get the additional color and alpha value multiplied into blit operations. | |
| void | SDL::SetSurfaceBlendMode (SurfaceRef surface, BlendMode blendMode) |
| Set the blend mode used for blit operations. | |
| BlendMode | SDL::GetSurfaceBlendMode (SurfaceConstRef surface) |
| Get the blend mode used for blit operations. | |
| bool | SDL::SetSurfaceClipRect (SurfaceRef surface, OptionalRef< const RectRaw > rect) |
| Set the clipping rectangle for a surface. | |
| void | SDL::ResetSurfaceClipRect (SurfaceRef surface) |
| Disable the clipping rectangle for a surface. | |
| Rect | SDL::GetSurfaceClipRect (SurfaceConstRef surface) |
| Get the clipping rectangle for a surface. | |
| void | SDL::FlipSurface (SurfaceRef surface, FlipMode flip) |
| Flip a surface vertically or horizontally. | |
| Surface | SDL::RotateSurface (SurfaceRef surface, float angle) |
| Return a copy of a surface rotated clockwise a number of degrees. | |
| Surface | SDL::DuplicateSurface (SurfaceConstRef surface) |
| Creates a new surface identical to the existing surface. | |
| Surface | SDL::ScaleSurface (SurfaceConstRef surface, const PointRaw &size, ScaleMode scaleMode) |
| Creates a new surface identical to the existing surface, scaled to the desired size. | |
| Surface | SDL::ConvertSurface (SurfaceConstRef surface, PixelFormat format) |
| Copy an existing surface to a new surface of the specified format. | |
| Surface | SDL::ConvertSurfaceAndColorspace (SurfaceConstRef surface, PixelFormat format, PaletteRef palette, Colorspace colorspace, PropertiesRef props) |
| Copy an existing surface to a new surface of the specified format and colorspace. | |
| void | SDL::ConvertPixels (const PointRaw &size, PixelFormat src_format, const void *src, int src_pitch, PixelFormat dst_format, void *dst, int dst_pitch) |
| Copy a block of pixels of one format to another format. | |
| void | SDL::ConvertPixelsAndColorspace (const PointRaw &size, PixelFormat src_format, Colorspace src_colorspace, PropertiesRef src_properties, const void *src, int src_pitch, PixelFormat dst_format, Colorspace dst_colorspace, PropertiesRef dst_properties, void *dst, int dst_pitch) |
| Copy a block of pixels of one format and colorspace to another format and colorspace. | |
| void | SDL::PremultiplyAlpha (const PointRaw &size, PixelFormat src_format, const void *src, int src_pitch, PixelFormat dst_format, void *dst, int dst_pitch, bool linear) |
| Premultiply the alpha on a block of pixels. | |
| void | SDL::PremultiplySurfaceAlpha (SurfaceRef surface, bool linear) |
| Premultiply the alpha in a surface. | |
| void | SDL::ClearSurface (SurfaceRef surface, const FColorRaw &c) |
| Clear a surface with a specific color, with floating point precision. | |
| void | SDL::FillSurfaceRect (SurfaceRef dst, OptionalRef< const RectRaw > rect, Uint32 color) |
| Perform a fast fill of a rectangle with a specific color. | |
| void | SDL::FillSurface (SurfaceRef dst, Uint32 color) |
| Perform a fast fill of a rectangle with a specific color. | |
| void | SDL::FillSurfaceRects (SurfaceRef dst, SpanRef< const RectRaw > rects, Uint32 color) |
| Perform a fast fill of a set of rectangles with a specific color. | |
| void | SDL::BlitSurface (SurfaceRef src, OptionalRef< const RectRaw > srcrect, SurfaceRef dst, OptionalRef< const RectRaw > dstrect) |
| Performs a fast blit from the source surface to the destination surface with clipping. | |
| void | SDL::BlitSurfaceAt (SurfaceRef src, OptionalRef< const RectRaw > srcrect, SurfaceRef dst, const PointRaw &dstpos) |
| Performs a fast blit from the source surface to the destination surface with clipping. | |
| void | SDL::BlitSurfaceUnchecked (SurfaceRef src, const RectRaw &srcrect, SurfaceRef dst, const RectRaw &dstrect) |
| Perform low-level surface blitting only. | |
| void | SDL::BlitSurfaceScaled (SurfaceRef src, OptionalRef< const RectRaw > srcrect, SurfaceRef dst, OptionalRef< const RectRaw > dstrect, ScaleMode scaleMode) |
| Perform a scaled blit to a destination surface, which may be of a different format. | |
| void | SDL::BlitSurfaceUncheckedScaled (SurfaceRef src, const RectRaw &srcrect, SurfaceRef dst, const RectRaw &dstrect, ScaleMode scaleMode) |
| Perform low-level surface scaled blitting only. | |
| void | SDL::StretchSurface (SurfaceRef src, OptionalRef< RectRaw > srcrect, SurfaceRef dst, OptionalRef< RectRaw > dstrect, ScaleMode scaleMode) |
| Perform a stretched pixel copy from one surface to another. | |
| void | SDL::BlitSurfaceTiled (SurfaceRef src, OptionalRef< const RectRaw > srcrect, SurfaceRef dst, OptionalRef< const RectRaw > dstrect) |
| Perform a tiled blit to a destination surface, which may be of a different format. | |
| void | SDL::BlitSurfaceTiledWithScale (SurfaceRef src, OptionalRef< const RectRaw > srcrect, float scale, ScaleMode scaleMode, SurfaceRef dst, OptionalRef< const RectRaw > dstrect) |
| Perform a scaled and tiled blit to a destination surface, which may be of a different format. | |
| void | SDL::BlitSurface9Grid (SurfaceRef src, OptionalRef< const RectRaw > srcrect, int left_width, int right_width, int top_height, int bottom_height, SurfaceRef dst, OptionalRef< const RectRaw > dstrect, float scale=1, ScaleMode scaleMode=SCALEMODE_NEAREST) |
| Perform a scaled blit using the 9-grid algorithm to a destination surface, which may be of a different format. | |
| Uint32 | SDL::MapSurfaceRGB (SurfaceConstRef surface, Uint8 r, Uint8 g, Uint8 b) |
| Map an RGB triple to an opaque pixel value for a surface. | |
| Uint32 | SDL::MapSurfaceRGBA (SurfaceConstRef surface, ColorRaw c) |
| Map an RGBA quadruple to a pixel value for a surface. | |
| void | SDL::ReadSurfacePixel (SurfaceConstRef surface, const PointRaw &p, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a) |
| Retrieves a single pixel from a surface. | |
| Color | SDL::ReadSurfacePixel (SurfaceConstRef surface, const PointRaw &p) |
| Retrieves a single pixel from a surface. | |
| void | SDL::ReadSurfacePixel (const SurfaceLock &lock, const PointRaw &p, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a) |
| Retrieves a single pixel from a surface. | |
| Color | SDL::ReadSurfacePixel (const SurfaceLock &lock, const PointRaw &p) |
| Retrieves a single pixel from a surface. | |
| void | SDL::ReadSurfacePixelFloat (SurfaceConstRef surface, const PointRaw &p, float *r, float *g, float *b, float *a) |
| Retrieves a single pixel from a surface. | |
| FColor | SDL::ReadSurfacePixelFloat (SurfaceConstRef surface, const PointRaw &p) |
| Retrieves a single pixel from a surface. | |
| void | SDL::ReadSurfacePixelFloat (const SurfaceLock &lock, const PointRaw &p, float *r, float *g, float *b, float *a) |
| Retrieves a single pixel from a surface. | |
| FColor | SDL::ReadSurfacePixelFloat (const SurfaceLock &lock, const PointRaw &p) |
| Retrieves a single pixel from a surface. | |
| void | SDL::WriteSurfacePixel (SurfaceRef surface, const PointRaw &p, ColorRaw c) |
| Writes a single pixel to a surface. | |
| void | SDL::WriteSurfacePixel (SurfaceLock &lock, const PointRaw &p, ColorRaw c) |
| Writes a single pixel to a surface. | |
| void | SDL::WriteSurfacePixelFloat (SurfaceRef surface, const PointRaw &p, const FColorRaw &c) |
| Writes a single pixel to a surface. | |
| void | SDL::WriteSurfacePixelFloat (SurfaceLock &lock, const PointRaw &p, const FColorRaw &c) |
| Writes a single pixel to a surface. | |
| constexpr int | SDL::GetSurfaceWidth (SurfaceConstRef surface) |
| Get the width in pixels. | |
| constexpr int | SDL::GetSurfaceWidth (const SurfaceLock &lock) |
| Get the width in pixels. | |
| constexpr int | SDL::GetSurfaceHeight (SurfaceConstRef surface) |
| Get the height in pixels. | |
| constexpr int | SDL::GetSurfaceHeight (const SurfaceLock &lock) |
| Get the height in pixels. | |
| constexpr Point | SDL::GetSurfaceSize (SurfaceConstRef surface) |
| Get the size in pixels. | |
| constexpr Point | SDL::GetSurfaceSize (const SurfaceLock &lock) |
| Get the size in pixels. | |
| constexpr int | SDL::GetSurfacePitch (SurfaceConstRef surface) |
| Get pitch in bytes. | |
| constexpr int | SDL::GetSurfacePitch (const SurfaceLock &lock) |
| Get pitch in bytes. | |
| constexpr PixelFormat | SDL::GetSurfaceFormat (SurfaceConstRef surface) |
| Get the pixel format. | |
| constexpr PixelFormat | SDL::GetSurfaceFormat (const SurfaceLock &lock) |
| Get the pixel format. | |
| constexpr void * | SDL::GetSurfacePixels (SurfaceConstRef surface) |
| Get the pixels. | |
| constexpr void * | SDL::GetSurfacePixels (const SurfaceLock &lock) |
| Get the pixels. | |
| SDL::Surface::Surface (const PointRaw &size, PixelFormat format) | |
| Allocate a new surface with a specific pixel format. | |
| SDL::Surface::Surface (const PointRaw &size, PixelFormat format, void *pixels, int pitch) | |
| Allocate a new surface with a specific pixel format and existing pixel data. | |
| void | SDL::Surface::Destroy () |
| Free this surface. | |
| PropertiesRef | SDL::Surface::GetProperties () const |
| Get the properties associated with a surface. | |
| void | SDL::Surface::SetColorspace (Colorspace colorspace) |
| Set the colorspace used by a surface. | |
| Colorspace | SDL::Surface::GetColorspace () const |
| Get the colorspace used by a surface. | |
| Palette | SDL::Surface::CreatePalette () |
| Create a palette and associate it with a surface. | |
| void | SDL::Surface::SetPalette (PaletteRef palette) |
| Set the palette used by a surface. | |
| Palette | SDL::Surface::GetPalette () const |
| Get the palette used by a surface. | |
| void | SDL::Surface::AddAlternateImage (SurfaceRef image) |
| Add an alternate version of a surface. | |
| bool | SDL::Surface::HasAlternateImages () const |
| Return whether a surface has alternate versions available. | |
| OwnArray< SurfaceRaw > | SDL::Surface::GetImages () const |
| Get an array including all versions of a surface. | |
| void | SDL::Surface::RemoveAlternateImages () |
| Remove all alternate versions of a surface. | |
| SurfaceLock | SDL::Surface::Lock () |
| Set up a surface for directly accessing the pixels. | |
| SDL::SurfaceLock::SurfaceLock (SurfaceRef resource) | |
| Set up a surface for directly accessing the pixels. | |
| void | SDL::Surface::Unlock (SurfaceLock &&lock) |
| Release a surface after directly accessing the pixels. | |
| void | SDL::SurfaceLock::reset () |
| Release a surface after directly accessing the pixels. | |
| void | SDL::Surface::SaveBMP_IO (IOStreamRef dst, bool closeio=false) const |
| Save a surface to a seekable SDL data stream in BMP format. | |
| void | SDL::Surface::SaveBMP (StringParam file) const |
| Save a surface to a file in BMP format. | |
| void | SDL::Surface::SetRLE (bool enabled) |
| Set the RLE acceleration hint for a surface. | |
| bool | SDL::Surface::HasRLE () const |
| Returns whether the surface is RLE enabled. | |
| void | SDL::Surface::SetColorKey (std::optional< Uint32 > key) |
| Set the color key (transparent pixel) in a surface. | |
| void | SDL::Surface::ClearColorKey () |
| Unset the color key (transparent pixel) in a surface. | |
| bool | SDL::Surface::HasColorKey () const |
| Returns whether the surface has a color key. | |
| std::optional< Uint32 > | SDL::Surface::GetColorKey () const |
| Get the color key (transparent pixel) for a surface. | |
| void | SDL::Surface::SetColorMod (Uint8 r, Uint8 g, Uint8 b) |
| Set an additional color value multiplied into blit operations. | |
| void | SDL::Surface::GetColorMod (Uint8 *r, Uint8 *g, Uint8 *b) const |
| Get the additional color value multiplied into blit operations. | |
| void | SDL::Surface::SetAlphaMod (Uint8 alpha) |
| Set an additional alpha value used in blit operations. | |
| Uint8 | SDL::Surface::GetAlphaMod () const |
| Get the additional alpha value used in blit operations. | |
| void | SDL::Surface::SetMod (Color color) |
| Set an additional color and alpha value multiplied into blit operations. | |
| Color | SDL::Surface::GetMod () const |
| Get the additional color and alpha value multiplied into blit operations. | |
| void | SDL::Surface::SetBlendMode (BlendMode blendMode) |
| Set the blend mode used for blit operations. | |
| BlendMode | SDL::Surface::GetBlendMode () const |
| Get the blend mode used for blit operations. | |
| bool | SDL::Surface::SetClipRect (OptionalRef< const RectRaw > rect) |
| Set the clipping rectangle for a surface. | |
| void | SDL::Surface::ResetClipRect () |
| Disable the clipping rectangle for a surface. | |
| Rect | SDL::Surface::GetClipRect () const |
| Get the clipping rectangle for a surface. | |
| void | SDL::Surface::Flip (FlipMode flip) |
| Flip a surface vertically or horizontally. | |
| Surface | SDL::Surface::Rotate (float angle) |
| Return a copy of a surface rotated clockwise a number of degrees. | |
| Surface | SDL::Surface::Duplicate () const |
| Creates a new surface identical to the existing surface. | |
| Surface | SDL::Surface::Scale (const PointRaw &size, ScaleMode scaleMode) const |
| Creates a new surface identical to the existing surface, scaled to the desired size. | |
| Surface | SDL::Surface::Convert (PixelFormat format) const |
| Copy an existing surface to a new surface of the specified format. | |
| Surface | SDL::Surface::Convert (PixelFormat format, PaletteRef palette, Colorspace colorspace, PropertiesRef props) const |
| Copy an existing surface to a new surface of the specified format and colorspace. | |
| void | SDL::Surface::PremultiplyAlpha (bool linear) |
| Premultiply the alpha in a surface. | |
| void | SDL::Surface::Clear (const FColorRaw &c) |
| Clear a surface with a specific color, with floating point precision. | |
| void | SDL::Surface::FillRect (OptionalRef< const RectRaw > rect, Uint32 color) |
| Perform a fast fill of a rectangle with a specific color. | |
| void | SDL::Surface::Fill (Uint32 color) |
| Perform a fast fill of a rectangle with a specific color. | |
| void | SDL::Surface::FillRects (SpanRef< const RectRaw > rects, Uint32 color) |
| Perform a fast fill of a set of rectangles with a specific color. | |
| void | SDL::Surface::Blit (SurfaceRef src, OptionalRef< const RectRaw > srcrect, OptionalRef< const RectRaw > dstrect) |
| Performs a fast blit from the source surface to the destination surface with clipping. | |
| void | SDL::Surface::BlitAt (SurfaceRef src, OptionalRef< const RectRaw > srcrect, const PointRaw &dstpos) |
| Performs a fast blit from the source surface to the destination surface with clipping. | |
| void | SDL::Surface::BlitUnchecked (SurfaceRef src, const RectRaw &srcrect, const RectRaw &dstrect) |
| Perform low-level surface blitting only. | |
| void | SDL::Surface::BlitScaled (SurfaceRef src, OptionalRef< const RectRaw > srcrect, OptionalRef< const RectRaw > dstrect, ScaleMode scaleMode) |
| Perform a scaled blit to a destination surface, which may be of a different format. | |
| void | SDL::Surface::BlitUncheckedScaled (SurfaceRef src, const RectRaw &srcrect, const RectRaw &dstrect, ScaleMode scaleMode) |
| Perform low-level surface scaled blitting only. | |
| void | SDL::Surface::Stretch (SurfaceRef src, OptionalRef< RectRaw > srcrect, OptionalRef< RectRaw > dstrect, ScaleMode scaleMode) |
| Perform a stretched pixel copy from one surface to another. | |
| void | SDL::Surface::BlitTiled (SurfaceRef src, OptionalRef< const RectRaw > srcrect, OptionalRef< const RectRaw > dstrect) |
| Perform a tiled blit to a destination surface, which may be of a different format. | |
| void | SDL::Surface::BlitTiledWithScale (SurfaceRef src, OptionalRef< const RectRaw > srcrect, float scale, ScaleMode scaleMode, OptionalRef< const RectRaw > dstrect) |
| Perform a scaled and tiled blit to a destination surface, which may be of a different format. | |
| void | SDL::Surface::Blit9Grid (SurfaceRef src, OptionalRef< const RectRaw > srcrect, int left_width, int right_width, int top_height, int bottom_height, OptionalRef< const RectRaw > dstrect, float scale=1, ScaleMode scaleMode=SCALEMODE_NEAREST) |
| Perform a scaled blit using the 9-grid algorithm to a destination surface, which may be of a different format. | |
| Uint32 | SDL::Surface::MapRGB (Uint8 r, Uint8 g, Uint8 b) const |
| Map an RGB triple to an opaque pixel value for a surface. | |
| Uint32 | SDL::Surface::MapRGBA (ColorRaw c) const |
| Map an RGBA quadruple to a pixel value for a surface. | |
| void | SDL::Surface::ReadPixel (const PointRaw &p, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a) const |
| Retrieves a single pixel from a surface. | |
| Color | SDL::Surface::ReadPixel (const PointRaw &p) const |
| Retrieves a single pixel from a surface. | |
| void | SDL::Surface::ReadPixelFloat (const PointRaw &p, float *r, float *g, float *b, float *a) const |
| Retrieves a single pixel from a surface. | |
| FColor | SDL::Surface::ReadPixelFloat (const PointRaw &p) const |
| Retrieves a single pixel from a surface. | |
| void | SDL::Surface::WritePixel (const PointRaw &p, ColorRaw c) |
| Writes a single pixel to a surface. | |
| void | SDL::Surface::WritePixelFloat (const PointRaw &p, const FColorRaw &c) |
| Writes a single pixel to a surface. | |
| constexpr int | SDL::Surface::GetWidth () const |
| Get the width in pixels. | |
| constexpr int | SDL::Surface::GetHeight () const |
| Get the height in pixels. | |
| constexpr Point | SDL::Surface::GetSize () const |
| Get the size in pixels. | |
| constexpr int | SDL::Surface::GetPitch () const |
| Get pitch in bytes. | |
| constexpr PixelFormat | SDL::Surface::GetFormat () const |
| Get the pixel format. | |
| constexpr void * | SDL::Surface::GetPixels () const |
| Get the pixels. | |
Variables | |
| constexpr SurfaceFlags | SDL::SURFACE_PREALLOCATED |
| Surface uses preallocated pixel memory. | |
| constexpr SurfaceFlags | SDL::SURFACE_LOCK_NEEDED |
| Surface needs to be locked to access pixels. | |
| constexpr SurfaceFlags | SDL::SURFACE_LOCKED |
| Surface is currently locked. | |
| constexpr SurfaceFlags | SDL::SURFACE_SIMD_ALIGNED = SDL_SURFACE_SIMD_ALIGNED |
| Surface uses pixel memory allocated with aligned_alloc(). | |
| constexpr ScaleMode | SDL::SCALEMODE_INVALID = SDL_SCALEMODE_INVALID |
| INVALID. | |
| constexpr ScaleMode | SDL::SCALEMODE_NEAREST |
| nearest pixel sampling | |
| constexpr ScaleMode | SDL::SCALEMODE_LINEAR |
| linear filtering | |
| constexpr ScaleMode | SDL::SCALEMODE_PIXELART = SDL_SCALEMODE_PIXELART |
| nearest pixel sampling with improved scaling for pixel art, available since SDL 3.4.0 | |
| constexpr FlipMode | SDL::FLIP_NONE = SDL_FLIP_NONE |
| Do not flip. | |
| constexpr FlipMode | SDL::FLIP_HORIZONTAL = SDL_FLIP_HORIZONTAL |
| flip horizontally | |
| constexpr FlipMode | SDL::FLIP_VERTICAL = SDL_FLIP_VERTICAL |
| flip vertically | |
| constexpr FlipMode | SDL::FLIP_HORIZONTAL_AND_VERTICAL |
| flip horizontally and vertically (not a diagonal flip) | |
SDL surfaces are buffers of pixels in system RAM.
These are useful for passing around and manipulating images that are not stored in GPU memory.
Surface makes serious efforts to manage images in various formats, and provides a reasonable toolbox for transforming the data, including copying between surfaces, filling rectangles in the image data, etc.
There is also a simple .bmp loader, LoadBMP(), and a simple .png loader, LoadTrustedPNG(). SDL itself does not provide loaders for other file formats, but there are several excellent external libraries that do, including its own satellite library, SDL_image .
In general these functions are thread-safe in that they can be called on different threads with different surfaces. You should not try to modify any surface from two threads simultaneously.
| using SDL::FlipMode = SDL_FlipMode |
The flip mode.
| using SDL::ScaleMode = SDL_ScaleMode |
The scaling mode.
| using SDL::SurfaceFlags = Uint32 |
| using SDL::SurfaceRef = ResourceRef<Surface> |
Reference for Surface.
This does not take ownership!
|
inline |
Add an alternate version of a surface.
This function adds an alternate version of this surface, usually used for content with high DPI representations like cursors or icons. The size, format, and content do not need to match the original surface, and these alternate versions will not be updated when the original surface changes.
This function adds a reference to the alternate version, so you should call Surface.Destroy() on the image after this call.
| image | an alternate Surface to associate with this surface. |
| Error | on failure. |
|
inline |
Add an alternate version of a surface.
This function adds an alternate version of this surface, usually used for content with high DPI representations like cursors or icons. The size, format, and content do not need to match the original surface, and these alternate versions will not be updated when the original surface changes.
This function adds a reference to the alternate version, so you should call Surface.Destroy() on the image after this call.
| surface | the Surface structure to update. |
| image | a pointer to an alternate Surface to associate with this surface. |
| Error | on failure. |
|
inline |
Performs a fast blit from the source surface to the destination surface with clipping.
If either srcrect or dstrect are nullptr, the entire surface (src or dst) is copied while ensuring clipping to dst->clip_rect.
The blit function should not be called on a locked surface.
The blit semantics for surfaces with and without blending and colorkey are defined as follows:
| src | the SurfaceRaw structure to be copied from. |
| srcrect | the Rect structure representing the rectangle to be copied, or nullptr to copy the entire surface. |
| dstrect | the Rect structure representing the x and y position in the destination surface, or nullptr for (0,0). The width and height are ignored, and are copied from srcrect. If you want a specific width and height, you should use Surface.BlitScaled(). |
| Error | on failure. |
|
inline |
Perform a scaled blit using the 9-grid algorithm to a destination surface, which may be of a different format.
The pixels in the source surface are split into a 3x3 grid, using the different corner sizes for each corner, and the sides and center making up the remaining pixels. The corners are then scaled using scale and fit into the corners of the destination rectangle. The sides and center are then stretched into place to cover the remaining destination rectangle.
| src | the SDL_Surface structure to be copied from. |
| srcrect | the Rect structure representing the rectangle to be used for the 9-grid, or nullptr to use the entire surface. |
| left_width | the width, in pixels, of the left corners in srcrect. |
| right_width | the width, in pixels, of the right corners in srcrect. |
| top_height | the height, in pixels, of the top corners in srcrect. |
| bottom_height | the height, in pixels, of the bottom corners in srcrect. |
| dstrect | the Rect structure representing the target rectangle in the destination surface, or nullptr to fill the entire surface. |
| scale | the scale used to transform the corner of srcrect into the corner of dstrect, or 0.0f for an unscaled blit. |
| scaleMode | scale algorithm to be used. |
| Error | on failure. |
|
inline |
Performs a fast blit from the source surface to the destination surface with clipping.
If either srcrect or dstrect are nullptr, the entire surface (src or dst) is copied while ensuring clipping to dst->clip_rect.
The blit function should not be called on a locked surface.
The blit semantics for surfaces with and without blending and colorkey are defined as follows:
| src | the SurfaceRaw structure to be copied from. |
| srcrect | the Rect structure representing the rectangle to be copied, or nullptr to copy the entire surface. |
| dstpos | the Point structure representing the x and y position in the destination surface, or nullptr for (0,0). The width and height are ignored, and are copied from srcrect. If you want a specific width and height, you should use Surface.BlitScaled(). |
| Error | on failure. |
|
inline |
Perform a scaled blit to a destination surface, which may be of a different format.
| src | the Surface structure to be copied from. |
| srcrect | the Rect structure representing the rectangle to be copied, or nullptr to copy the entire surface. |
| dstrect | the Rect structure representing the target rectangle in the destination surface, or nullptr to fill the entire destination surface. |
| scaleMode | the ScaleMode to be used. |
| Error | on failure. |
|
inline |
Performs a fast blit from the source surface to the destination surface with clipping.
If either srcrect or dstrect are nullptr, the entire surface (src or dst) is copied while ensuring clipping to dst->clip_rect.
The blit function should not be called on a locked surface.
The blit semantics for surfaces with and without blending and colorkey are defined as follows:
| src | the Surface structure to be copied from. |
| srcrect | the Rect structure representing the rectangle to be copied, or nullptr to copy the entire surface. |
| dst | the Surface structure that is the blit target. |
| dstrect | the Rect structure representing the x and y position in the destination surface, or nullptr for (0,0). The width and height are ignored, and are copied from srcrect. If you want a specific width and height, you should use Surface.BlitScaled(). |
| Error | on failure. |
|
inline |
Perform a scaled blit using the 9-grid algorithm to a destination surface, which may be of a different format.
The pixels in the source surface are split into a 3x3 grid, using the different corner sizes for each corner, and the sides and center making up the remaining pixels. The corners are then scaled using scale and fit into the corners of the destination rectangle. The sides and center are then stretched into place to cover the remaining destination rectangle.
| src | the Surface structure to be copied from. |
| srcrect | the Rect structure representing the rectangle to be used for the 9-grid, or nullptr to use the entire surface. |
| left_width | the width, in pixels, of the left corners in srcrect. |
| right_width | the width, in pixels, of the right corners in srcrect. |
| top_height | the height, in pixels, of the top corners in srcrect. |
| bottom_height | the height, in pixels, of the bottom corners in srcrect. |
| dst | the Surface structure that is the blit target. |
| dstrect | the Rect structure representing the target rectangle in the destination surface, or nullptr to fill the entire surface. |
| scale | the scale used to transform the corner of srcrect into the corner of dstrect, or 0.0f for an unscaled blit. |
| scaleMode | scale algorithm to be used. |
| Error | on failure. |
|
inline |
Performs a fast blit from the source surface to the destination surface with clipping.
If either srcrect or dstrect are nullptr, the entire surface (src or dst) is copied while ensuring clipping to dst->clip_rect.
The blit function should not be called on a locked surface.
The blit semantics for surfaces with and without blending and colorkey are defined as follows:
| src | the Surface structure to be copied from. |
| srcrect | the Rect structure representing the rectangle to be copied, or nullptr to copy the entire surface. |
| dst | the Surface structure that is the blit target. |
| dstpos | the Point structure representing the x and y position in the destination surface. |
| Error | on failure. |
|
inline |
Perform a scaled blit to a destination surface, which may be of a different format.
| src | the Surface structure to be copied from. |
| srcrect | the Rect structure representing the rectangle to be copied, or nullptr to copy the entire surface. |
| dst | the Surface structure that is the blit target. |
| dstrect | the Rect structure representing the target rectangle in the destination surface, or nullptr to fill the entire destination surface. |
| scaleMode | the ScaleMode to be used. |
| Error | on failure. |
|
inline |
Perform a tiled blit to a destination surface, which may be of a different format.
The pixels in srcrect will be repeated as many times as needed to completely fill dstrect.
| src | the Surface structure to be copied from. |
| srcrect | the Rect structure representing the rectangle to be copied, or nullptr to copy the entire surface. |
| dst | the Surface structure that is the blit target. |
| dstrect | the Rect structure representing the target rectangle in the destination surface, or nullptr to fill the entire surface. |
| Error | on failure. |
|
inline |
Perform a scaled and tiled blit to a destination surface, which may be of a different format.
The pixels in srcrect will be scaled and repeated as many times as needed to completely fill dstrect.
| src | the Surface structure to be copied from. |
| srcrect | the Rect structure representing the rectangle to be copied, or nullptr to copy the entire surface. |
| scale | the scale used to transform srcrect into the destination rectangle, e.g. a 32x32 texture with a scale of 2 would fill 64x64 tiles. |
| scaleMode | scale algorithm to be used. |
| dst | the Surface structure that is the blit target. |
| dstrect | the Rect structure representing the target rectangle in the destination surface, or nullptr to fill the entire surface. |
| Error | on failure. |
|
inline |
Perform low-level surface blitting only.
This is a semi-private blit function and it performs low-level surface blitting, assuming the input rectangles have already been clipped.
| src | the Surface structure to be copied from. |
| srcrect | the Rect structure representing the rectangle to be copied, may not be nullptr. |
| dst | the Surface structure that is the blit target. |
| dstrect | the Rect structure representing the target rectangle in the destination surface, may not be nullptr. |
| Error | on failure. |
|
inline |
Perform low-level surface scaled blitting only.
This is a semi-private function and it performs low-level surface blitting, assuming the input rectangles have already been clipped.
| src | the Surface structure to be copied from. |
| srcrect | the Rect structure representing the rectangle to be copied, may not be nullptr. |
| dst | the Surface structure that is the blit target. |
| dstrect | the Rect structure representing the target rectangle in the destination surface, may not be nullptr. |
| scaleMode | the ScaleMode to be used. |
| Error | on failure. |
|
inline |
Perform a tiled blit to a destination surface, which may be of a different format.
The pixels in srcrect will be repeated as many times as needed to completely fill dstrect.
| src | the SDL_Surface structure to be copied from. |
| srcrect | the Rect structure representing the rectangle to be copied, or nullptr to copy the entire surface. |
| dstrect | the Rect structure representing the target rectangle in the destination surface, or nullptr to fill the entire surface. |
| Error | on failure. |
|
inline |
Perform a scaled and tiled blit to a destination surface, which may be of a different format.
The pixels in srcrect will be scaled and repeated as many times as needed to completely fill dstrect.
| src | the SDL_Surface structure to be copied from. |
| srcrect | the Rect structure representing the rectangle to be copied, or nullptr to copy the entire surface. |
| scale | the scale used to transform srcrect into the destination rectangle, e.g. a 32x32 texture with a scale of 2 would fill 64x64 tiles. |
| scaleMode | scale algorithm to be used. |
| dstrect | the Rect structure representing the target rectangle in the destination surface, or nullptr to fill the entire surface. |
| Error | on failure. |
|
inline |
Perform low-level surface blitting only.
This is a semi-private blit function and it performs low-level surface blitting, assuming the input rectangles have already been clipped.
| src | the Surface structure to be copied from. |
| srcrect | the Rect structure representing the rectangle to be copied, may not be nullptr. |
| dstrect | the Rect structure representing the target rectangle in the destination surface, may not be nullptr. |
| Error | on failure. |
|
inline |
Perform low-level surface scaled blitting only.
This is a semi-private function and it performs low-level surface blitting, assuming the input rectangles have already been clipped.
| src | the Surface structure to be copied from. |
| srcrect | the Rect structure representing the rectangle to be copied, may not be nullptr. |
| dstrect | the Rect structure representing the target rectangle in the destination surface, may not be nullptr. |
| scaleMode | the ScaleMode to be used. |
| Error | on failure. |
|
inline |
Clear a surface with a specific color, with floating point precision.
This function handles all surface formats, and ignores any clip rectangle.
If the surface is YUV, the color is assumed to be in the sRGB colorspace, otherwise the color is assumed to be in the colorspace of the surface.
| c | the color components of the pixel, normally in the range 0-1. |
| Error | on failure. |
|
inline |
Unset the color key (transparent pixel) in a surface.
The color key defines a pixel value that will be treated as transparent in a blit. For example, one can use this to specify that cyan pixels should be considered transparent, and therefore not rendered.
| Error | on failure. |
|
inline |
Clear a surface with a specific color, with floating point precision.
This function handles all surface formats, and ignores any clip rectangle.
If the surface is YUV, the color is assumed to be in the sRGB colorspace, otherwise the color is assumed to be in the colorspace of the surface.
| surface | the Surface to clear. |
| c | the color components of the pixel, normally in the range 0-1. |
| Error | on failure. |
|
inline |
Unset the color key (transparent pixel) in a surface.
The color key defines a pixel value that will be treated as transparent in a blit. For example, one can use this to specify that cyan pixels should be considered transparent, and therefore not rendered.
| surface | the Surface structure to update. |
| Error | on failure. |
|
inline |
Copy an existing surface to a new surface of the specified format.
This function is used to optimize images for faster repeat blitting. This is accomplished by converting the original and storing the result as a new surface. The new, optimized surface can then be used as the source for future blits, making them faster.
If you are converting to an indexed surface and want to map colors to a palette, you can use Surface.Convert() instead.
If the original surface has alternate images, the new surface will have a reference to them as well.
| format | the new pixel format. |
|
inline |
Copy an existing surface to a new surface of the specified format and colorspace.
This function converts an existing surface to a new format and colorspace and returns the new surface. This will perform any pixel format and colorspace conversion needed.
If the original surface has alternate images, the new surface will have a reference to them as well.
| format | the new pixel format. |
| palette | an optional palette to use for indexed formats, may be nullptr. |
| colorspace | the new colorspace. |
| props | an Properties with additional color properties, or 0. |
|
inline |
Copy a block of pixels of one format to another format.
| size | the width and height of the surface. |
| src_format | an PixelFormat value of the src pixels format. |
| src | a pointer to the source pixels. |
| src_pitch | the pitch of the source pixels, in bytes. |
| dst_format | an PixelFormat value of the dst pixels format. |
| dst | a pointer to be filled in with new pixel data. |
| dst_pitch | the pitch of the destination pixels, in bytes. |
| Error | on failure. |
|
inline |
Copy a block of pixels of one format and colorspace to another format and colorspace.
| size | the width and height of the block to copy, in pixels. |
| src_format | an PixelFormat value of the src pixels format. |
| src_colorspace | an Colorspace value describing the colorspace of the src pixels. |
| src_properties | an Properties with additional source color properties, or 0. |
| src | a pointer to the source pixels. |
| src_pitch | the pitch of the source pixels, in bytes. |
| dst_format | an PixelFormat value of the dst pixels format. |
| dst_colorspace | an Colorspace value describing the colorspace of the dst pixels. |
| dst_properties | an Properties with additional destination color properties, or 0. |
| dst | a pointer to be filled in with new pixel data. |
| dst_pitch | the pitch of the destination pixels, in bytes. |
| Error | on failure. |
|
inline |
Copy an existing surface to a new surface of the specified format.
This function is used to optimize images for faster repeat blitting. This is accomplished by converting the original and storing the result as a new surface. The new, optimized surface can then be used as the source for future blits, making them faster.
If you are converting to an indexed surface and want to map colors to a palette, you can use Surface.Convert() instead.
If the original surface has alternate images, the new surface will have a reference to them as well.
| surface | the existing Surface structure to convert. |
| format | the new pixel format. |
|
inline |
Copy an existing surface to a new surface of the specified format and colorspace.
This function converts an existing surface to a new format and colorspace and returns the new surface. This will perform any pixel format and colorspace conversion needed.
If the original surface has alternate images, the new surface will have a reference to them as well.
| surface | the existing Surface structure to convert. |
| format | the new pixel format. |
| palette | an optional palette to use for indexed formats, may be nullptr. |
| colorspace | the new colorspace. |
| props | an Properties with additional color properties, or 0. |
|
inline |
Create a palette and associate it with a surface.
This function creates a palette compatible with the provided surface. The palette is then returned for you to modify, and the surface will automatically use the new palette in future operations. You do not need to destroy the returned palette, it will be freed when the reference count reaches 0, usually when the surface is destroyed.
Bitmap surfaces (with format PIXELFORMAT_INDEX1LSB or PIXELFORMAT_INDEX1MSB) will have the palette initialized with 0 as white and 1 as black. Other surfaces will get a palette initialized with white in every entry.
If this function is called for a surface that already has a palette, a new palette will be created to replace it.
| Error | on failure. |
|
inline |
Allocate a new surface with a specific pixel format.
The pixels of the new surface are initialized to zero.
| size | the width and height of the surface. |
| format | the PixelFormat for the new surface's pixel format. |
|
inline |
Allocate a new surface with a specific pixel format and existing pixel data.
No copy is made of the pixel data. Pixel data is not managed automatically; you must free the surface before you free the pixel data.
Pitch is the offset in bytes from one row of pixels to the next, e.g. width*4 for PIXELFORMAT_RGBA8888.
You may pass nullptr for pixels and 0 for pitch to create a surface that you will fill in with valid values later.
| size | the width and height of the surface. |
| format | the PixelFormat for the new surface's pixel format. |
| pixels | a pointer to existing pixel data. |
| pitch | the number of bytes between each row, including padding. |
|
inline |
Create a palette and associate it with a surface.
This function creates a palette compatible with the provided surface. The palette is then returned for you to modify, and the surface will automatically use the new palette in future operations. You do not need to destroy the returned palette, it will be freed when the reference count reaches 0, usually when the surface is destroyed.
Bitmap surfaces (with format PIXELFORMAT_INDEX1LSB or PIXELFORMAT_INDEX1MSB) will have the palette initialized with 0 as white and 1 as black. Other surfaces will get a palette initialized with white in every entry.
If this function is called for a surface that already has a palette, a new palette will be created to replace it.
| surface | the Surface structure to update. |
| Error | on failure. |
|
inline |
Free this surface.
It is safe to call on a nullptr surface.
|
inline |
Free a surface.
It is safe to pass nullptr to this function.
| surface | the Surface to free. |
|
inline |
Creates a new surface identical to the existing surface.
If the original surface has alternate images, the new surface will have a reference to them as well.
|
inline |
Creates a new surface identical to the existing surface.
If the original surface has alternate images, the new surface will have a reference to them as well.
The returned surface should be freed with Surface.Destroy().
| surface | the surface to duplicate. |
|
inline |
Perform a fast fill of a rectangle with a specific color.
If there is a clip rectangle set on the destination (set via Surface.SetClipRect()), then this function will fill based on the intersection of the clip rectangle and rect.
| color | the color to fill with. |
| Error | on failure. |
|
inline |
Perform a fast fill of a rectangle with a specific color.
color should be a pixel of the format used by the surface, and can be generated by MapRGB() or MapColor(). If the color value contains an alpha component then the destination is simply filled with that alpha information, no blending takes place.
If there is a clip rectangle set on the destination (set via Surface.SetClipRect()), then this function will fill based on the intersection of the clip rectangle and rect.
| rect | the Rect structure representing the rectangle to fill, or nullptr to fill the entire surface. |
| color | the color to fill with. |
| Error | on failure. |
Perform a fast fill of a set of rectangles with a specific color.
color should be a pixel of the format used by the surface, and can be generated by MapRGB() or MapColor(). If the color value contains an alpha component then the destination is simply filled with that alpha information, no blending takes place.
If there is a clip rectangle set on the destination (set via Surface.SetClipRect()), then this function will fill based on the intersection of the clip rectangle and rect.
| rects | an array of SDL_Rects representing the rectangles to fill. |
| color | the color to fill with. |
| Error | on failure. |
|
inline |
Perform a fast fill of a rectangle with a specific color.
If there is a clip rectangle set on the destination (set via Surface.SetClipRect()), then this function will fill based on the intersection of the clip rectangle and rect.
| dst | the Surface structure that is the drawing target. |
| color | the color to fill with. |
| Error | on failure. |
|
inline |
Perform a fast fill of a rectangle with a specific color.
color should be a pixel of the format used by the surface, and can be generated by MapRGB() or MapColor(). If the color value contains an alpha component then the destination is simply filled with that alpha information, no blending takes place.
If there is a clip rectangle set on the destination (set via Surface.SetClipRect()), then this function will fill based on the intersection of the clip rectangle and rect.
| dst | the Surface structure that is the drawing target. |
| rect | the Rect structure representing the rectangle to fill, or nullptr to fill the entire surface. |
| color | the color to fill with. |
| Error | on failure. |
|
inline |
Perform a fast fill of a set of rectangles with a specific color.
color should be a pixel of the format used by the surface, and can be generated by MapRGB() or MapColor(). If the color value contains an alpha component then the destination is simply filled with that alpha information, no blending takes place.
If there is a clip rectangle set on the destination (set via Surface.SetClipRect()), then this function will fill based on the intersection of the clip rectangle and rect.
| dst | the Surface structure that is the drawing target. |
| rects | an array of SDL_Rects representing the rectangles to fill. |
| color | the color to fill with. |
| Error | on failure. |
|
inline |
|
inline |
|
inline |
|
inline |
Get the blend mode used for blit operations.
| Error | on failure. |
|
inline |
Get the clipping rectangle for a surface.
When surface is the destination of a blit, only the area within the clip rectangle is drawn into.
| Error | on failure. |
|
inline |
Get the color key (transparent pixel) for a surface.
The color key is a pixel of the format used by the surface, as generated by MapRGB().
If the surface doesn't have color key enabled this function returns false.
| Error | on failure. |
Get the additional color value multiplied into blit operations.
| r | a pointer filled in with the current red color value. |
| g | a pointer filled in with the current green color value. |
| b | a pointer filled in with the current blue color value. |
| Error | on failure. |
|
inline |
Get the colorspace used by a surface.
The colorspace defaults to COLORSPACE_SRGB_LINEAR for floating point formats, COLORSPACE_HDR10 for 10-bit formats, COLORSPACE_SRGB for other RGB surfaces and COLORSPACE_BT709_FULL for YUV textures.
|
inline |
Get an array including all versions of a surface.
This returns all versions of a surface, with the surface being queried as the first element in the returned array.
|
inline |
Get the additional color and alpha value multiplied into blit operations.
|
inline |
Get the palette used by a surface.
|
inline |
Get the properties associated with a surface.
The following properties are understood by SDL:
| Error | on failure. |
|
inline |
|
inline |
Get the blend mode used for blit operations.
| surface | the Surface structure to query. |
| Error | on failure. |
|
inline |
Get the clipping rectangle for a surface.
When surface is the destination of a blit, only the area within the clip rectangle is drawn into.
| surface | the Surface structure representing the surface to be clipped. |
| Error | on failure. |
|
inline |
Get the color key (transparent pixel) for a surface.
The color key is a pixel of the format used by the surface, as generated by MapRGB().
If the surface doesn't have color key enabled this function returns false.
| surface | the Surface structure to query. |
| Error | on failure. |
|
inline |
Get the additional color value multiplied into blit operations.
| surface | the Surface structure to query. |
| r | a pointer filled in with the current red color value. |
| g | a pointer filled in with the current green color value. |
| b | a pointer filled in with the current blue color value. |
| Error | on failure. |
|
inline |
Get the colorspace used by a surface.
The colorspace defaults to COLORSPACE_SRGB_LINEAR for floating point formats, COLORSPACE_HDR10 for 10-bit formats, COLORSPACE_SRGB for other RGB surfaces and COLORSPACE_BT709_FULL for YUV textures.
| surface | the Surface structure to query. |
|
inline |
Get an array including all versions of a surface.
This returns all versions of a surface, with the surface being queried as the first element in the returned array.
Freeing the array of surfaces does not affect the surfaces in the array. They are still referenced by the surface being queried and will be cleaned up normally.
| surface | the Surface structure to query. |
|
inline |
Get the additional color and alpha value multiplied into blit operations.
| surface | the Surface structure to query. |
|
inline |
Get the palette used by a surface.
| surface | the Surface structure to query. |
|
inline |
Get the properties associated with a surface.
The following properties are understood by SDL:
| surface | the Surface structure to query. |
| Error | on failure. |
|
inline |
Return whether a surface has alternate versions available.
|
inline |
Returns whether the surface has a color key.
|
inline |
Returns whether the surface is RLE enabled.
It is safe to pass a nullptr surface here; it will return false.
|
inline |
Load a BMP image from a file.
The new surface should be freed with Surface.Destroy(). Not doing so will result in a memory leak.
| file | the BMP file to load. |
|
inline |
Load a BMP image from a seekable SDL data stream.
The new surface should be freed with Surface.Destroy(). Not doing so will result in a memory leak.
| src | the data stream for the surface. |
| closeio | if true, calls IOStream.Close() on src before returning, even in the case of an error. |
|
inline |
Load a PNG image from a file.
This is intended as a convenience function for loading images from trusted sources. If you want to load arbitrary images you should use libpng or another image loading library designed with security in mind.
The new surface should be freed with Surface.Destroy(). Not doing so will result in a memory leak.
| file | the PNG file to load. |
|
inline |
Load a PNG image from a seekable SDL data stream.
This is intended as a convenience function for loading images from trusted sources. If you want to load arbitrary images you should use libpng or another image loading library designed with security in mind.
| src | the data stream for the surface. |
| closeio | if true, calls IOStream.Close() on src before returning, even in the case of an error. |
|
inline |
Set up a surface for directly accessing the pixels.
Between calls to Surface.Lock() / Surface.Unlock(), you can write to and read from surface->pixels, using the pixel format stored in surface->format. Once you are done accessing the surface, you should use Surface.Unlock() to release it.
Not all surfaces require locking. If Surface.MustLock(surface) evaluates to 0, then you can read and write to the surface at any time, and the pixel format of the surface will not change.
| Error | on failure. |
|
inline |
Set up a surface for directly accessing the pixels.
Between calls to Surface.Lock() / Surface.Unlock(), you can write to and read from surface->pixels, using the pixel format stored in surface->format. Once you are done accessing the surface, you should use Surface.Unlock() to release it.
Not all surfaces require locking. If Surface.MustLock() evaluates to 0, then you can read and write to the surface at any time, and the pixel format of the surface will not change.
| surface | the Surface structure to be locked. |
| Error | on failure. |
Map an RGB triple to an opaque pixel value for a surface.
This function maps the RGB color value to the specified pixel format and returns the pixel value best approximating the given RGB color value for the given pixel format.
If the surface has a palette, the index of the closest matching color in the palette will be returned.
If the surface pixel format has an alpha component it will be returned as all 1 bits (fully opaque).
If the pixel format bpp (color depth) is less than 32-bpp then the unused upper bits of the return value can safely be ignored (e.g., with a 16-bpp format the return value can be assigned to a Uint16, and similarly a Uint8 for an 8-bpp format).
| r | the red component of the pixel in the range 0-255. |
| g | the green component of the pixel in the range 0-255. |
| b | the blue component of the pixel in the range 0-255. |
Map an RGBA quadruple to a pixel value for a surface.
This function maps the RGBA color value to the specified pixel format and returns the pixel value best approximating the given RGBA color value for the given pixel format.
If the surface pixel format has no alpha component the alpha value will be ignored (as it will be in formats with a palette).
If the surface has a palette, the index of the closest matching color in the palette will be returned.
If the pixel format bpp (color depth) is less than 32-bpp then the unused upper bits of the return value can safely be ignored (e.g., with a 16-bpp format the return value can be assigned to a Uint16, and similarly a Uint8 for an 8-bpp format).
| c | the color components of the pixel in the range 0-255. |
|
inline |
Map an RGB triple to an opaque pixel value for a surface.
This function maps the RGB color value to the specified pixel format and returns the pixel value best approximating the given RGB color value for the given pixel format.
If the surface has a palette, the index of the closest matching color in the palette will be returned.
If the surface pixel format has an alpha component it will be returned as all 1 bits (fully opaque).
If the pixel format bpp (color depth) is less than 32-bpp then the unused upper bits of the return value can safely be ignored (e.g., with a 16-bpp format the return value can be assigned to a Uint16, and similarly a Uint8 for an 8-bpp format).
| surface | the surface to use for the pixel format and palette. |
| r | the red component of the pixel in the range 0-255. |
| g | the green component of the pixel in the range 0-255. |
| b | the blue component of the pixel in the range 0-255. |
|
inline |
Map an RGBA quadruple to a pixel value for a surface.
This function maps the RGBA color value to the specified pixel format and returns the pixel value best approximating the given RGBA color value for the given pixel format.
If the surface pixel format has no alpha component the alpha value will be ignored (as it will be in formats with a palette).
If the surface has a palette, the index of the closest matching color in the palette will be returned.
If the pixel format bpp (color depth) is less than 32-bpp then the unused upper bits of the return value can safely be ignored (e.g., with a 16-bpp format the return value can be assigned to a Uint16, and similarly a Uint8 for an 8-bpp format).
| surface | the surface to use for the pixel format and palette. |
| c | the color components of the pixel in the range 0-255. |
|
constexpr |
Evaluates to true if the surface needs to be locked before access.
|
inline |
Premultiply the alpha on a block of pixels.
This is safe to use with src == dst, but not for other overlapping areas.
| size | the width and height of the surface. |
| src_format | an PixelFormat value of the src pixels format. |
| src | a pointer to the source pixels. |
| src_pitch | the pitch of the source pixels, in bytes. |
| dst_format | an PixelFormat value of the dst pixels format. |
| dst | a pointer to be filled in with premultiplied pixel data. |
| dst_pitch | the pitch of the destination pixels, in bytes. |
| linear | true to convert from sRGB to linear space for the alpha multiplication, false to do multiplication in sRGB space. |
| Error | on failure. |
|
inline |
Premultiply the alpha in a surface.
This is safe to use with src == dst, but not for other overlapping areas.
| linear | true to convert from sRGB to linear space for the alpha multiplication, false to do multiplication in sRGB space. |
| Error | on failure. |
|
inline |
Premultiply the alpha in a surface.
This is safe to use with src == dst, but not for other overlapping areas.
| surface | the surface to modify. |
| linear | true to convert from sRGB to linear space for the alpha multiplication, false to do multiplication in sRGB space. |
| Error | on failure. |
Retrieves a single pixel from a surface.
This function prioritizes correctness over speed: it is suitable for unit tests, but is not intended for use in a game engine.
| p | the coordinates, 0 <= x < width and 0 <= y < height. |
| Error | on failure. |
|
inline |
Retrieves a single pixel from a surface.
This function prioritizes correctness over speed: it is suitable for unit tests, but is not intended for use in a game engine.
Like GetRGBA, this uses the entire 0..255 range when converting color components from pixel formats with less than 8 bits per RGB component.
| p | the coordinates, 0 <= x < width and 0 <= y < height. |
| r | a pointer filled in with the red channel, 0-255, or nullptr to ignore this channel. |
| g | a pointer filled in with the green channel, 0-255, or nullptr to ignore this channel. |
| b | a pointer filled in with the blue channel, 0-255, or nullptr to ignore this channel. |
| a | a pointer filled in with the alpha channel, 0-255, or nullptr to ignore this channel. |
| Error | on failure. |
Retrieves a single pixel from a surface.
This function prioritizes correctness over speed: it is suitable for unit tests, but is not intended for use in a game engine.
| p | the coordinates, 0 <= x < width and 0 <= y < height. |
| Error | on failure. |
|
inline |
Retrieves a single pixel from a surface.
This function prioritizes correctness over speed: it is suitable for unit tests, but is not intended for use in a game engine.
| p | the coordinates, 0 <= x < width and 0 <= y < height. |
| r | a pointer filled in with the red channel, normally in the range 0-1, or nullptr to ignore this channel. |
| g | a pointer filled in with the green channel, normally in the range 0-1, or nullptr to ignore this channel. |
| b | a pointer filled in with the blue channel, normally in the range 0-1, or nullptr to ignore this channel. |
| a | a pointer filled in with the alpha channel, normally in the range 0-1, or nullptr to ignore this channel. |
| Error | on failure. |
|
inline |
Retrieves a single pixel from a surface.
This function prioritizes correctness over speed: it is suitable for unit tests, but is not intended for use in a game engine.
Like GetRGBA, this uses the entire 0..255 range when converting color components from pixel formats with less than 8 bits per RGB component.
| lock | the surface to read. |
| p | the coordinates, 0 <= x < width and 0 <= y < height. |
| Error | on failure. |
|
inline |
Retrieves a single pixel from a surface.
This function prioritizes correctness over speed: it is suitable for unit tests, but is not intended for use in a game engine.
Like GetRGBA, this uses the entire 0..255 range when converting color components from pixel formats with less than 8 bits per RGB component.
| lock | the surface to read. |
| p | the coordinates, 0 <= x < width and 0 <= y < height. |
| r | a pointer filled in with the red channel, 0-255, or nullptr to ignore this channel. |
| g | a pointer filled in with the green channel, 0-255, or nullptr to ignore this channel. |
| b | a pointer filled in with the blue channel, 0-255, or nullptr to ignore this channel. |
| a | a pointer filled in with the alpha channel, 0-255, or nullptr to ignore this channel. |
| Error | on failure. |
|
inline |
Retrieves a single pixel from a surface.
This function prioritizes correctness over speed: it is suitable for unit tests, but is not intended for use in a game engine.
Like GetRGBA, this uses the entire 0..255 range when converting color components from pixel formats with less than 8 bits per RGB component.
| surface | the surface to read. |
| p | the coordinates, 0 <= x < width and 0 <= y < height. |
| Error | on failure. |
|
inline |
Retrieves a single pixel from a surface.
This function prioritizes correctness over speed: it is suitable for unit tests, but is not intended for use in a game engine.
Like GetRGBA, this uses the entire 0..255 range when converting color components from pixel formats with less than 8 bits per RGB component.
| surface | the surface to read. |
| p | the coordinates, 0 <= x < width and 0 <= y < height. |
| r | a pointer filled in with the red channel, 0-255, or nullptr to ignore this channel. |
| g | a pointer filled in with the green channel, 0-255, or nullptr to ignore this channel. |
| b | a pointer filled in with the blue channel, 0-255, or nullptr to ignore this channel. |
| a | a pointer filled in with the alpha channel, 0-255, or nullptr to ignore this channel. |
| Error | on failure. |
|
inline |
Retrieves a single pixel from a surface.
This function prioritizes correctness over speed: it is suitable for unit tests, but is not intended for use in a game engine.
| lock | the surface to read. |
| p | the coordinates, 0 <= x < width and 0 <= y < height. |
| Error | on failure. |
|
inline |
Retrieves a single pixel from a surface.
This function prioritizes correctness over speed: it is suitable for unit tests, but is not intended for use in a game engine.
| lock | the surface to read. |
| p | the coordinates, 0 <= x < width and 0 <= y < height. |
| r | a pointer filled in with the red channel, normally in the range 0-1, or nullptr to ignore this channel. |
| g | a pointer filled in with the green channel, normally in the range 0-1, or nullptr to ignore this channel. |
| b | a pointer filled in with the blue channel, normally in the range 0-1, or nullptr to ignore this channel. |
| a | a pointer filled in with the alpha channel, normally in the range 0-1, or nullptr to ignore this channel. |
| Error | on failure. |
|
inline |
Retrieves a single pixel from a surface.
This function prioritizes correctness over speed: it is suitable for unit tests, but is not intended for use in a game engine.
| surface | the surface to read. |
| p | the coordinates, 0 <= x < width and 0 <= y < height. |
| Error | on failure. |
|
inline |
Retrieves a single pixel from a surface.
This function prioritizes correctness over speed: it is suitable for unit tests, but is not intended for use in a game engine.
| surface | the surface to read. |
| p | the coordinates, 0 <= x < width and 0 <= y < height. |
| r | a pointer filled in with the red channel, normally in the range 0-1, or nullptr to ignore this channel. |
| g | a pointer filled in with the green channel, normally in the range 0-1, or nullptr to ignore this channel. |
| b | a pointer filled in with the blue channel, normally in the range 0-1, or nullptr to ignore this channel. |
| a | a pointer filled in with the alpha channel, normally in the range 0-1, or nullptr to ignore this channel. |
| Error | on failure. |
|
inline |
Remove all alternate versions of a surface.
This function removes a reference from all the alternative versions, destroying them if this is the last reference to them.
|
inline |
Remove all alternate versions of a surface.
This function removes a reference from all the alternative versions, destroying them if this is the last reference to them.
| surface | the Surface structure to update. |
|
inline |
Release a surface after directly accessing the pixels.
|
inline |
Disable the clipping rectangle for a surface.
|
inline |
Disable the clipping rectangle for a surface.
|
inline |
Return a copy of a surface rotated clockwise a number of degrees.
The angle of rotation can be negative for counter-clockwise rotation.
When the rotation isn't a multiple of 90 degrees, the resulting surface is larger than the original, with the background filled in with the colorkey, if available, or RGBA 255/255/255/0 if not.
If surface has the prop.Surface.ROTATION_FLOAT property set on it, the new copy will have the adjusted value set: if the rotation property is 90 and angle was 30, the new surface will have a property value of 60 (that is: to be upright vs gravity, this surface needs to rotate 60 more degrees). However, note that further rotations on the new surface in this example will produce unexpected results, since the image will have resized and padded to accommodate the not-90 degree angle.
| angle | the rotation angle, in degrees. |
|
inline |
Return a copy of a surface rotated clockwise a number of degrees.
The angle of rotation can be negative for counter-clockwise rotation.
When the rotation isn't a multiple of 90 degrees, the resulting surface is larger than the original, with the background filled in with the colorkey, if available, or RGBA 255/255/255/0 if not.
If surface has the prop.Surface.ROTATION_FLOAT property set on it, the new copy will have the adjusted value set: if the rotation property is 90 and angle was 30, the new surface will have a property value of 60 (that is: to be upright vs gravity, this surface needs to rotate 60 more degrees). However, note that further rotations on the new surface in this example will produce unexpected results, since the image will have resized and padded to accommodate the not-90 degree angle.
| surface | the surface to rotate. |
| angle | the rotation angle, in degrees. |
|
inline |
Save a surface to a file in BMP format.
Surfaces with a 24-bit, 32-bit and paletted 8-bit format get saved in the BMP directly. Other RGB formats with 8-bit or higher get converted to a 24-bit surface or, if they have an alpha mask or a colorkey, to a 32-bit surface before they are saved. YUV and paletted 1-bit and 4-bit formats are not supported.
| surface | the Surface structure containing the image to be saved. |
| file | a file to save to. |
| Error | on failure. |
|
inline |
Save a surface to a file in BMP format.
Surfaces with a 24-bit, 32-bit and paletted 8-bit format get saved in the BMP directly. Other RGB formats with 8-bit or higher get converted to a 24-bit surface or, if they have an alpha mask or a colorkey, to a 32-bit surface before they are saved. YUV and paletted 1-bit and 4-bit formats are not supported.
| file | a file to save to. |
| Error | on failure. |
|
inline |
Save a surface to a seekable SDL data stream in BMP format.
Surfaces with a 24-bit, 32-bit and paletted 8-bit format get saved in the BMP directly. Other RGB formats with 8-bit or higher get converted to a 24-bit surface or, if they have an alpha mask or a colorkey, to a 32-bit surface before they are saved. YUV and paletted 1-bit and 4-bit formats are not supported.
| surface | the Surface structure containing the image to be saved. |
| dst | a data stream to save to. |
| closeio | if true, calls IOStream.Close() on dst before returning, even in the case of an error. |
| Error | on failure. |
|
inline |
Save a surface to a seekable SDL data stream in BMP format.
Surfaces with a 24-bit, 32-bit and paletted 8-bit format get saved in the BMP directly. Other RGB formats with 8-bit or higher get converted to a 24-bit surface or, if they have an alpha mask or a colorkey, to a 32-bit surface before they are saved. YUV and paletted 1-bit and 4-bit formats are not supported.
| dst | a data stream to save to. |
| closeio | if true, calls IOStream.Close() on dst before returning, even in the case of an error. |
| Error | on failure. |
|
inline |
Save a surface to a file in PNG format.
| surface | the Surface structure containing the image to be saved. |
| file | a file to save to. |
| Error | on failure. |
|
inline |
Save a surface to a seekable SDL data stream in PNG format.
| surface | the Surface structure containing the image to be saved. |
| dst | a data stream to save to. |
| closeio | if true, calls IOStream.Close() on dst before returning, even in the case of an error. |
| Error | on failure. |
Creates a new surface identical to the existing surface, scaled to the desired size.
| size | the width and height of the new surface. |
| scaleMode | the ScaleMode to be used. |
|
inline |
Creates a new surface identical to the existing surface, scaled to the desired size.
The returned surface should be freed with Surface.Destroy().
| surface | the surface to duplicate and scale. |
| size | the width and height of the surface. |
| scaleMode | the ScaleMode to be used. |
|
inline |
Set an additional alpha value used in blit operations.
When this surface is blitted, during the blit operation the source alpha value is modulated by this alpha value according to the following formula:
srcA = srcA * (alpha / 255)
| alpha | the alpha value multiplied into blit operations. |
| Error | on failure. |
|
inline |
Set the blend mode used for blit operations.
To copy a surface to another surface (or texture) without blending with the existing data, the blendmode of the SOURCE surface should be set to BLENDMODE_NONE.
| blendMode | the BlendMode to use for blit blending. |
| Error | on failure. |
|
inline |
Set the clipping rectangle for a surface.
When surface is the destination of a blit, only the area within the clip rectangle is drawn into.
Note that blits are automatically clipped to the edges of the source and destination surfaces.
| rect | the Rect structure representing the clipping rectangle, or nullptr to disable clipping. |
|
inline |
Set the color key (transparent pixel) in a surface.
The color key defines a pixel value that will be treated as transparent in a blit. For example, one can use this to specify that cyan pixels should be considered transparent, and therefore not rendered.
It is a pixel of the format used by the surface, as generated by MapRGB().
| key | the transparent pixel or std::nullopt to disable it. |
| Error | on failure. |
Set an additional color value multiplied into blit operations.
When this surface is blitted, during the blit operation each source color channel is modulated by the appropriate color value according to the following formula:
srcC = srcC * (color / 255)
| r | the red color value multiplied into blit operations. |
| g | the green color value multiplied into blit operations. |
| b | the blue color value multiplied into blit operations. |
| Error | on failure. |
|
inline |
Set the colorspace used by a surface.
Setting the colorspace doesn't change the pixels, only how they are interpreted in color operations.
| colorspace | a Colorspace value describing the surface colorspace. |
| Error | on failure. |
|
inline |
Set an additional color and alpha value multiplied into blit operations.
When this surface is blitted, during the blit operation each source color channel is modulated by the appropriate color value according to the following formula:
srcC = srcC * (color / 255) srcA = srcA * (alpha / 255)
| color | the color to be multiplied in blit operations |
| Error | on failure. |
|
inline |
Set the palette used by a surface.
Setting the palette keeps an internal reference to the palette, which can be safely destroyed afterwards.
A single palette can be shared with many surfaces.
| palette | the Palette structure to use. |
| Error | on failure. |
|
inline |
Set the RLE acceleration hint for a surface.
If RLE is enabled, color key and alpha blending blits are much faster, but the surface must be locked before directly accessing the pixels.
| enabled | true to enable RLE acceleration, false to disable it. |
| Error | on failure. |
|
inline |
Set an additional alpha value used in blit operations.
When this surface is blitted, during the blit operation the source alpha value is modulated by this alpha value according to the following formula:
srcA = srcA * (alpha / 255)
| surface | the Surface structure to update. |
| alpha | the alpha value multiplied into blit operations. |
| Error | on failure. |
|
inline |
Set the blend mode used for blit operations.
To copy a surface to another surface (or texture) without blending with the existing data, the blendmode of the SOURCE surface should be set to BLENDMODE_NONE.
| Error | on failure. |
|
inline |
Set the clipping rectangle for a surface.
When surface is the destination of a blit, only the area within the clip rectangle is drawn into.
Note that blits are automatically clipped to the edges of the source and destination surfaces.
| surface | the Surface structure to be clipped. |
| rect | the Rect structure representing the clipping rectangle, or nullptr to disable clipping. |
|
inline |
Set the color key (transparent pixel) in a surface.
The color key defines a pixel value that will be treated as transparent in a blit. For example, one can use this to specify that cyan pixels should be considered transparent, and therefore not rendered.
It is a pixel of the format used by the surface, as generated by MapRGB().
| surface | the Surface structure to update. |
| key | the transparent pixel or std::nullopt to disable it. |
| Error | on failure. |
|
inline |
Set an additional color value multiplied into blit operations.
When this surface is blitted, during the blit operation each source color channel is modulated by the appropriate color value according to the following formula:
srcC = srcC * (color / 255)
| surface | the Surface structure to update. |
| r | the red color value multiplied into blit operations. |
| g | the green color value multiplied into blit operations. |
| b | the blue color value multiplied into blit operations. |
| Error | on failure. |
|
inline |
Set the colorspace used by a surface.
Setting the colorspace doesn't change the pixels, only how they are interpreted in color operations.
| surface | the Surface structure to update. |
| colorspace | an Colorspace value describing the surface colorspace. |
| Error | on failure. |
|
inline |
Set an additional color and alpha value multiplied into blit operations.
When this surface is blitted, during the blit operation each source color channel is modulated by the appropriate color value according to the following formula:
srcC = srcC * (color / 255) srcA = srcA * (alpha / 255)
| surface | the Surface structure to query. |
| color | the color to be multiplied in blit operations |
| Error | on failure. |
|
inline |
Set the palette used by a surface.
Setting the palette keeps an internal reference to the palette, which can be safely destroyed afterwards.
A single palette can be shared with many surfaces.
| Error | on failure. |
|
inline |
Set the RLE acceleration hint for a surface.
If RLE is enabled, color key and alpha blending blits are much faster, but the surface must be locked before directly accessing the pixels.
| surface | the Surface structure to optimize. |
| enabled | true to enable RLE acceleration, false to disable it. |
| Error | on failure. |
|
inline |
Perform a stretched pixel copy from one surface to another.
| src | the Surface structure to be copied from. |
| srcrect | the Rect structure representing the rectangle to be copied, or nullptr to copy the entire surface. |
| dstrect | the Rect structure representing the target rectangle in the destination surface, or nullptr to fill the entire destination surface. |
| scaleMode | the ScaleMode to be used. |
| Error | on failure. |
|
inline |
Perform a stretched pixel copy from one surface to another.
| src | the Surface structure to be copied from. |
| srcrect | the Rect structure representing the rectangle to be copied, or nullptr to copy the entire surface. |
| dst | the Surface structure that is the blit target. |
| dstrect | the Rect structure representing the target rectangle in the destination surface, or nullptr to fill the entire destination surface. |
| scaleMode | the ScaleMode to be used. |
| Error | on failure. |
|
inline |
Allocate a new surface with a specific pixel format.
The pixels of the new surface are initialized to zero.
| size | the width and height of the surface. |
| format | the PixelFormat for the new surface's pixel format. |
| Error | on failure. |
|
inline |
Allocate a new surface with a specific pixel format and existing pixel data.
No copy is made of the pixel data. Pixel data is not managed automatically; you must free the surface before you free the pixel data.
Pitch is the offset in bytes from one row of pixels to the next, e.g. width*4 for PIXELFORMAT_RGBA8888.
You may pass nullptr for pixels and 0 for pitch to create a surface that you will fill in with valid values later.
| size | the width and height of the surface. |
| format | the PixelFormat for the new surface's pixel format. |
| pixels | a pointer to existing pixel data. |
| pitch | the number of bytes between each row, including padding. |
| Error | on failure. |
|
inline |
|
inline |
Returns whether the surface has a color key.
It is safe to pass a nullptr surface here; it will return false.
| surface | the Surface structure to query. |
|
inline |
Returns whether the surface is RLE enabled.
It is safe to pass a nullptr surface here; it will return false.
| surface | the Surface structure to query. |
|
inline |
Set up a surface for directly accessing the pixels.
Between calls to Surface.Lock() / Surface.Unlock(), you can write to and read from surface->pixels, using the pixel format stored in surface->format. Once you are done accessing the surface, you should use Surface.Unlock() to release it.
Not all surfaces require locking. If Surface.MustLock(surface) evaluates to 0, then you can read and write to the surface at any time, and the pixel format of the surface will not change.
|
inline |
Release a surface after directly accessing the pixels.
|
inline |
Release a surface after directly accessing the pixels.
| surface | the Surface structure to be unlocked. |
Writes a single pixel to a surface.
This function prioritizes correctness over speed: it is suitable for unit tests, but is not intended for use in a game engine.
Like MapColor, this uses the entire 0..255 range when converting color components from pixel formats with less than 8 bits per RGB component.
| p | the coordinates, 0 <= x < width and 0 <= y < height. |
| c | the color values, 0-255. |
| Error | on failure. |
Writes a single pixel to a surface.
This function prioritizes correctness over speed: it is suitable for unit tests, but is not intended for use in a game engine.
| p | the coordinates, 0 <= x < width and 0 <= y < height. |
| c | the color values, normally in the range 0-1. |
| Error | on failure. |
|
inline |
Writes a single pixel to a surface.
This function prioritizes correctness over speed: it is suitable for unit tests, but is not intended for use in a game engine.
Like MapColor, this uses the entire 0..255 range when converting color components from pixel formats with less than 8 bits per RGB component.
| lock | the surface to write. |
| p | the coordinates, 0 <= x < width, 0 <= y < height. |
| c | the color channels value, 0-255. |
| Error | on failure. |
|
inline |
Writes a single pixel to a surface.
This function prioritizes correctness over speed: it is suitable for unit tests, but is not intended for use in a game engine.
Like MapColor, this uses the entire 0..255 range when converting color components from pixel formats with less than 8 bits per RGB component.
| surface | the surface to write. |
| p | the coordinates, 0 <= x < width, 0 <= y < height. |
| c | the color channels value, 0-255. |
| Error | on failure. |
|
inline |
Writes a single pixel to a surface.
This function prioritizes correctness over speed: it is suitable for unit tests, but is not intended for use in a game engine.
| lock | the surface to write. |
| p | the coordinates, 0 <= x < width, 0 <= y < height. |
| c | the color channels values, normally in the range 0-1. |
| Error | on failure. |
|
inline |
Writes a single pixel to a surface.
This function prioritizes correctness over speed: it is suitable for unit tests, but is not intended for use in a game engine.
| surface | the surface to write. |
| p | the coordinates, 0 <= x < width, 0 <= y < height. |
| c | the color channels values, normally in the range 0-1. |
| Error | on failure. |
|
constexpr |
flip horizontally and vertically (not a diagonal flip)
|
constexpr |
linear filtering
|
constexpr |
nearest pixel sampling
|
constexpr |
Surface needs to be locked to access pixels.
|
constexpr |
Surface is currently locked.
|
constexpr |
Surface uses preallocated pixel memory.