Class 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

class Texture ;

Constructors

NameDescription
this Creates a texture given explicit parameters that are required by SDL CreateTexture Allows for more control over how the texture works
this Constructs a new texture from a surface
this Creates a texture from an already existing SDL_Texture

Properties

NameTypeDescription
access[get] intGets the texture's access value Acces value determines how the texture can be accessed or modified Potential values are:
alphaMod[set] ubyteSets the texture's alpha value, or transparency, if possible Alpha varies from 0 to 255
alphaMod[get] ubyteGets the texture's alpha value, or transparency, if possible Alpha varies from 0 to 255
blendMode[set] derelict.sdl2.internal.sdl_types.SDL_BlendModeSets the texture's blend mode Modes include:
blendMode[get] derelict.sdl2.internal.sdl_types.SDL_BlendMode*Gets the texture's blend mode Modes include:
colorMod[set] ColorSets the color modifier for the surface Color modification works by multiplying the colorMultiplier / 255 into the surface pixels
colorMod[get] ColorGets the color modifier for the surface Color modification works by multiplying the colorMultiplier / 255 into the surface pixels
dimensions[get] Vector!(int,2)Gets the texture's dimensions as a point with the width being the x coordinate and the height being the y coordinate
format[get] uintGets the texture's pixel format The pixel format is the format in which information about the pixels is stored (e.g. RGBA)
handle[get] derelict.sdl2.internal.sdl_types.SDL_Texture*Returns the raw SDL data of this object

Methods

NameDescription
lock Locks a texture from editing
unlock Unlocks a texture to edit
update Updates a texture with new pixel data