SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
SDL::Texture Struct Reference

An efficient driver-specific representation of pixel data. More...

Inheritance diagram for SDL::Texture:
[legend]

Public Member Functions

constexpr Texture (TextureRaw resource) noexcept
 Constructs from raw Texture.
constexpr Texture (const Texture &other)
 Copy constructor.
constexpr Texture (Texture &&other) noexcept
 Move constructor.
 Texture (RendererRef renderer, PixelFormat format, TextureAccess access, const PointRaw &size)
 Create a texture for a rendering context.
 Texture (RendererRef renderer, SurfaceRef surface)
 Create a texture from an existing surface.
 Texture (RendererRef renderer, PropertiesRef props)
 Create a texture for a rendering context with the specified properties.
 Texture (RendererRef renderer, StringParam file)
 Load an image from a filesystem path into a texture.
 Texture (RendererRef renderer, IOStreamRef src, bool closeio=false)
 Load an image from an SDL data source into a texture.
constexpr operator TextureConstRef () const noexcept
 Converts to TextureConstRef.
 ~Texture ()
 Destructor.
constexpr Textureoperator= (Texture &&other) noexcept
 Assignment operator.
Textureoperator= (const Texture &other)
 Assignment operator.
void Destroy ()
 Destroy the specified texture.
PropertiesRef GetProperties () const
 Get the properties associated with a texture.
RendererRef GetRenderer () const
 Get the renderer that created an Texture.
void GetSize (float *w, float *h) const
 Get the size of a texture, as floating point values.
Point GetSize () const
 Get the size of a texture.
FPoint GetSizeFloat () const
 Get the size of a texture, as floating point values.
int GetWidth () const
 Get the width in pixels.
int GetHeight () const
 Get the height in pixels.
PixelFormat GetFormat () const
 Get the pixel format.
void SetPalette (PaletteRef palette)
 Set the palette used by a texture.
Palette GetPalette ()
 Get the palette used by a texture.
void SetColorMod (Uint8 r, Uint8 g, Uint8 b)
 Set an additional color value multiplied into render copy operations.
void SetColorModFloat (float r, float g, float b)
 Set an additional color value multiplied into render copy operations.
void GetColorMod (Uint8 *r, Uint8 *g, Uint8 *b) const
 Get the additional color value multiplied into render copy operations.
void GetColorModFloat (float *r, float *g, float *b) const
 Get the additional color value multiplied into render copy operations.
void SetAlphaMod (Uint8 alpha)
 Set an additional alpha value multiplied into render copy operations.
void SetAlphaModFloat (float alpha)
 Set an additional alpha value multiplied into render copy operations.
Uint8 GetAlphaMod () const
 Get the additional alpha value multiplied into render copy operations.
float GetAlphaModFloat () const
 Get the additional alpha value multiplied into render copy operations.
void SetMod (Color c)
 Set an additional color and alpha values multiplied into render copy operations.
void SetModFloat (FColor c)
 Set an additional color and alpha values multiplied into render copy operations.
Color GetMod () const
 Get the additional color value multiplied into render copy operations.
FColor GetModFloat () const
 Get the additional color value multiplied into render copy operations.
void SetBlendMode (BlendMode blendMode)
 Set the blend mode for a texture, used by Renderer.RenderTexture().
BlendMode GetBlendMode () const
 Get the blend mode used for texture copy operations.
void SetScaleMode (ScaleMode scaleMode)
 Set the scale mode used for texture scale operations.
ScaleMode GetScaleMode () const
 Get the scale mode used for texture scale operations.
void Update (OptionalRef< const RectRaw > rect, const void *pixels, int pitch)
 Update the given texture rectangle with new pixel data.
void Update (SurfaceConstRef surface, OptionalRef< const RectRaw > rect=std::nullopt)
 Update the given texture rectangle with new pixel data.
void UpdateYUV (OptionalRef< const RectRaw > rect, const Uint8 *Yplane, int Ypitch, const Uint8 *Uplane, int Upitch, const Uint8 *Vplane, int Vpitch)
 Update a rectangle within a planar YV12 or IYUV texture with new pixel data.
void UpdateNV (OptionalRef< const RectRaw > rect, const Uint8 *Yplane, int Ypitch, const Uint8 *UVplane, int UVpitch)
 Update a rectangle within a planar NV12 or NV21 texture with new pixels.
TextureLock Lock (OptionalRef< const RectRaw > rect, void **pixels, int *pitch)
 Lock a portion of the texture for write-only pixel access.
TextureSurfaceLock LockToSurface (OptionalRef< const RectRaw > rect=std::nullopt)
 Lock a portion of the texture for write-only pixel access, and expose it as a SDL surface.
void Unlock (TextureLock &&lock)
 Unlock a texture, uploading the changes to video memory, if needed.
void Unlock (TextureSurfaceLock &&lock)
 Unlock a texture, uploading the changes to video memory, if needed.
constexpr ResourceBase (RawPointer resource)
 Constructs from resource pointer.
constexpr ResourceBase (std::nullptr_t=nullptr)
 Constructs null/invalid.
Public Member Functions inherited from SDL::ResourceBase< TextureRaw, TextureRawConst >
constexpr ResourceBase (RawPointer resource)
 Constructs from resource pointer.
constexpr operator bool () const
 Converts to bool.
constexpr auto operator<=> (const ResourceBase &other) const=default
 Comparison.
constexpr RawConstPointer operator-> () const noexcept
 member access to underlying resource pointer.
constexpr RawPointer get () const noexcept
 Retrieves underlying resource pointer.
constexpr RawPointer release () noexcept
 Retrieves underlying resource pointer and clear this.

Static Public Member Functions

static Texture Borrow (TextureRaw resource)
 Safely borrows the from TextureRaw.

Additional Inherited Members

Public Types inherited from SDL::ResourceBase< TextureRaw, TextureRawConst >
using RawPointer
 The underlying raw pointer type.
using RawConstPointer
 The underlying const raw pointer type.

Detailed Description

An efficient driver-specific representation of pixel data.

Since
This struct is available since SDL 3.2.0.
See also
Renderer.CreateTexture
Renderer.CreateTextureFromSurface
Renderer.CreateTextureWithProperties
Texture.Destroy
Category:
Resource

Constructor & Destructor Documentation

◆ Texture()

SDL::Texture::Texture ( TextureRaw resource)
inlineexplicitconstexprnoexcept

Constructs from raw Texture.

Parameters
resourcea TextureRaw to be wrapped.

This assumes the ownership, call release() if you need to take back.

Member Function Documentation

◆ Borrow()

Texture SDL::Texture::Borrow ( TextureRaw resource)
inlinestatic

Safely borrows the from TextureRaw.

Parameters
resourcea TextureRaw.

This does not takes ownership!


The documentation for this struct was generated from the following files: