Texture

Textures are a rectangular collection of pixels Textures are fast and can be drawn using a renderer Textures can be created from a more easily edited surface Textures are handled in hardware as opposed to surfaces which are handled in software When used repeatedly and stored, textures should be preferred, but surfaces should be used when flexibility is desired

Constructors

this
this(Renderer renderer, uint format, SDL_TextureAccess access, int width, int height)

Creates a texture given explicit parameters that are required by SDL CreateTexture Allows for more control over how the texture works

this
this(Surface surface, Renderer renderer)

Constructs a new texture from a surface

this
this(SDL_Texture* alreadyExisting)

Creates a texture from an already existing SDL_Texture

Destructor

~this
~this()

Ensures that SDL can properly dispose of the texture

Members

Functions

lock
void lock(void** pixels, int* pitch, iRectangle location = null)

Locks a texture from editing

unlock
void unlock()

Unlocks a texture to edit

update
void update(void* pixels, int pitch, iRectangle location = null)

Updates a texture with new pixel data

Properties

access
int access [@property getter]

Gets the texture's access value Acces value determines how the texture can be accessed or modified Potential values are:

alphaMod
ubyte alphaMod [@property setter]

Sets the texture's alpha value, or transparency, if possible Alpha varies from 0 to 255

alphaMod
ubyte alphaMod [@property getter]

Gets the texture's alpha value, or transparency, if possible Alpha varies from 0 to 255

blendMode
SDL_BlendMode blendMode [@property setter]

Sets the texture's blend mode Modes include:

blendMode
SDL_BlendMode* blendMode [@property getter]

Gets the texture's blend mode Modes include:

colorMod
Color colorMod [@property setter]

Sets the color modifier for the surface Color modification works by multiplying the colorMultiplier / 255 into the surface pixels

colorMod
Color colorMod [@property getter]

Gets the color modifier for the surface Color modification works by multiplying the colorMultiplier / 255 into the surface pixels

dimensions
iVector dimensions [@property getter]

Gets the texture's dimensions as a point with the width being the x coordinate and the height being the y coordinate

format
uint format [@property getter]

Gets the texture's pixel format The pixel format is the format in which information about the pixels is stored (e.g. RGBA)

handle
SDL_Texture* handle [@property getter]

Returns the raw SDL data of this object

Meta