Texture

D class that wraps SDL_Texture storing textures in the VRAM

dsdl2.Texture stores a 2D image out of pixels with a width and height, where each pixel stored in the GPU RAM (VRAM) according to its defined dsdl2.PixelFormat. A dsdl2.Texture is associated with its dsdl2.Renderer, and can only be operated with/by it.

Constructors

this
this(SDL_Texture* sdlTexture, bool isOwner, void* userRef)

Constructs a dsdl2.Texture from a vanilla SDL_Texture* from bindbc-sdl

this
this(Renderer renderer, PixelFormat pixelFormat, TextureAccess access, uint[2] size)

Creates a blank dsdl2.Texture in the VRAM, which wraps SDL_CreateTexture

this
this(Renderer renderer, Surface surface)

Creates a dsdl2.Texture in the VRAM from a dsdl2.Surface, which wraps SDL_CreateTextureFromSurface

Destructor

~this
~this()
Undocumented in source.

Members

Functions

access
TextureAccess access()

Wraps SDL_QueryTexture which gets the dsdl2.TextureAccess of the dsdl2.Texture

alphaMod
ubyte alphaMod()

Wraps SDL_GetTextureAlphaMod which gets the alpha multiplier of the dsdl2.Texture

alphaMod
void alphaMod(ubyte newAlphaMod)

Wraps SDL_SetTextureAlphaMod which sets the alpha multiplier of the dsdl2.Texture

bindGL
float[2] bindGL()

Wraps SDL_GL_BindTexture which binds the texture in OpenGL

blendMode
BlendMode blendMode()

Wraps SDL_GetTextureBlendMode which gets the dsdl2.Texture's dsdl2.BlendMode defining drawing

blendMode
void blendMode(BlendMode newMode)

Wraps SDL_SetTextureBlendMode which sets the dsdl2.Texture's dsdl2.BlendMode defining drawing

colorMod
ubyte[3] colorMod()

Wraps SDL_GetTextureColorMod which gets the color multipliers of the dsdl2.Texture

colorMod
void colorMod(ubyte[3] newColorMod)

Wraps SDL_SetTextureColorMod which sets the color multipliers of the dsdl2.Texture

height
uint height()

Wraps SDL_QueryTexture which gets the height of the dsdl2.Texture in pixels

mod
Color mod()

Gets the color and alpha multipliers of the dsdl2.Texture that wraps SDL_GetTextureColorMod and SDL_GetTextureAlphaMod

mod
void mod(Color newMod)

Sets the color and alpha multipliers of the dsdl2.Texture that wraps SDL_SetTextureColorMod and SDL_SetTextureAlphaMod

opEquals
bool opEquals(Texture rhs)

Equality operator overload

pixelFormat
const(PixelFormat) pixelFormat()

Wraps SDL_QueryTexture which gets the dsdl2.PixelFormat of the dsdl2.Texture

scaleMode
ScaleMode scaleMode()

Wraps SDL_GetTextureScaleMode (from SDL 2.0.12) which gets the texture's scaling mode

scaleMode
void scaleMode(ScaleMode newMode)

Wraps SDL_SetTextureScaleMode (from SDL 2.0.12) which sets the texture's scaling mode

size
uint[2] size()

Wraps SDL_QueryTexture which gets the size of the dsdl2.Texture in pixels

toHash
hash_t toHash()

Gets the hash of the dsdl2.Texture

toString
string toString()

Formats the dsdl2.Texture into its construction representation: "dsdl2.Texture(<sdlTexture>)"

unbindGL
void unbindGL()

Wraps SDL_GL_UnbindTexture which unbinds the texture in OpenGL

update
void update(void[] pixels, size_t pitch)

Wraps SDL_UpdateTexture which updates the entire dsdl2.Texture's pixel data

update
void update(Rect rect, void[] pixels, size_t pitch)

Wraps SDL_UpdateTexture which updates the dsdl2.Texture's pixel data at a certain dsdl2.Rect boundary

width
uint width()

Wraps SDL_QueryTexture which gets the width of the dsdl2.Texture in pixels

Variables

sdlTexture
SDL_Texture* sdlTexture;

Internal SDL_Texture pointer

Examples

auto renderer = new dsdl2.Renderer(...);
auto surface = new dsdl2.Surface(...);

auto texture = new dsdl2.Texture(renderer, surface);

Meta