Class 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
Name | Description |
this
(sdlTexture, isOwner, userRef)
|
Constructs a dsdl2.Texture from a vanilla SDL_Texture* from bindbc-sdl
|
this
(renderer, pixelFormat, access, size)
|
Creates a blank dsdl2.Texture in the VRAM, which wraps SDL_CreateTexture
|
this
(renderer, surface)
|
Creates a dsdl2.Texture in the VRAM from a dsdl2.Surface , which wraps SDL_CreateTextureFromSurface
|
Fields
Name | Type | Description |
sdlTexture
|
sdl.render.SDL_Texture* | Internal SDL_Texture pointer
|
Properties
Name | Type | Description |
access [get]
|
TextureAccess | Wraps SDL_QueryTexture which gets the dsdl2.TextureAccess of the dsdl2.Texture
|
alphaMod [get]
|
ubyte | Wraps SDL_GetTextureAlphaMod which gets the alpha multiplier of the dsdl2.Texture
|
alphaMod [set]
|
ubyte | Wraps SDL_SetTextureAlphaMod which sets the alpha multiplier of the dsdl2.Texture
|
blendMode [get]
|
BlendMode | Wraps SDL_GetTextureBlendMode which gets the dsdl2.Texture 's dsdl2.BlendMode defining drawing
|
blendMode [set]
|
BlendMode | Wraps SDL_SetTextureBlendMode which sets the dsdl2.Texture 's dsdl2.BlendMode defining drawing
|
colorMod [get]
|
ubyte[3] | Wraps SDL_GetTextureColorMod which gets the color multipliers of the dsdl2.Texture
|
colorMod [set]
|
ubyte[3] | Wraps SDL_SetTextureColorMod which sets the color multipliers of the dsdl2.Texture
|
height [get]
|
uint | Wraps SDL_QueryTexture which gets the height of the dsdl2.Texture in pixels
|
mod [get]
|
Color | Gets the color and alpha multipliers of the dsdl2.Texture that wraps SDL_GetTextureColorMod and
SDL_GetTextureAlphaMod
|
mod [set]
|
Color | Sets the color and alpha multipliers of the dsdl2.Texture that wraps SDL_SetTextureColorMod and
SDL_SetTextureAlphaMod
|
pixelFormat [get]
|
const(PixelFormat) | Wraps SDL_QueryTexture which gets the dsdl2.PixelFormat of the dsdl2.Texture
|
scaleMode [get]
|
ScaleMode | Wraps SDL_GetTextureScaleMode (from SDL 2.0.12) which gets the texture's scaling mode
|
scaleMode [set]
|
ScaleMode | Wraps SDL_SetTextureScaleMode (from SDL 2.0.12) which sets the texture's scaling mode
|
size [get]
|
uint[2] | Wraps SDL_QueryTexture which gets the size of the dsdl2.Texture in pixels
|
width [get]
|
uint | Wraps SDL_QueryTexture which gets the width of the dsdl2.Texture in pixels
|
Methods
Name | Description |
bindGL
()
|
Wraps SDL_GL_BindTexture which binds the texture in OpenGL
|
opEquals
(rhs)
|
Equality operator overload
|
toHash
()
|
Gets the hash of the dsdl2.Texture
|
toString
()
|
Formats the dsdl2.Texture into its construction representation: "dsdl2.Texture(<sdlTexture>)"
|
unbindGL
()
|
Wraps SDL_GL_UnbindTexture which unbinds the texture in OpenGL
|
update
(pixels, pitch)
|
Wraps SDL_UpdateTexture which updates the entire dsdl2.Texture 's pixel data
|
update
(rect, pixels, pitch)
|
Wraps SDL_UpdateTexture which updates the dsdl2.Texture 's pixel data at a certain dsdl2.Rect boundary
|
Example
auto renderer = new dsdl2.Renderer(...);
auto surface = new dsdl2.Surface(...);
auto texture = new dsdl2.Texture(renderer, surface);