Canvas

Behave like Texture but you can render onto it. Use pushCanvas/popCanvas to start the drawing region on it.

Constructors

this
this(Vec2f renderSize_, bool isSmooth_)

Ctor

this
this(Vec2i renderSize_, bool isSmooth_)

Ctor

this
this(Canvas canvas)

Ctor

Destructor

~this
~this()
Undocumented in source.

Members

Functions

copy
Canvas copy(Canvas canvas)

Copy

draw
void draw(Vec2f pos, Vec2f anchor)

Draw the texture at the specified location. Render the whole texture here

draw
void draw(Vec2f pos, Vec4i srcRect, Vec2f anchor)

Render a section of the texture here

draw
void draw(Vec2f pos, Vec2f size, Vec2f anchor)

Render the whole texture here

draw
void draw(Vec2f pos, Vec2f size, Vec4i srcRect, Vec2f anchor)

Render a section of the texture here

draw
void draw(Vec2f pos, Vec2f size, Vec4i srcRect, float angle, Flip flip, Vec2f anchor)

Render a section of the texture here

setSmooth
void setSmooth(bool isSmooth_)

Toggle the canvas smoothing

Properties

alpha
float alpha [@property getter]
float alpha [@property setter]

Alpha

blend
Blend blend [@property getter]
Blend blend [@property setter]

Blending algorithm.

color
Color color [@property getter]
Color color [@property setter]

Color added to the canvas.

height
uint height [@property getter]

Height in texels.

isLoaded
bool isLoaded [@property getter]

loaded ?

renderSize
Vec2i renderSize [@property getter]
Vec2i renderSize [@property setter]

The size (in texels) of the surface to be rendered on. Changing that value allocate a new texture, so don't do it everytime.

target
const(SDL_Texture*) target [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
width
uint width [@property getter]

Width in texels.

Variables

_isTargetOnStack
bool _isTargetOnStack;
Undocumented in source.
clearAlpha
float clearAlpha;

The base opacity when nothing is rendered.

clearColor
Color clearColor;

The base color when nothing is rendered.

flip
Flip flip;

Mirroring property.

position
Vec2f position;

The view position inside the canvas. +//// The size of the view inside of the canvas

size
Vec2f size;

The view position inside the canvas.

Inherited Members

From Drawable

isLoaded
bool isLoaded [@property getter]

loaded ?

width
uint width [@property getter]

Width in texels.

height
uint height [@property getter]

Height in texels.

color
Color color [@property getter]
Color color [@property setter]

Color added to the renderable.

alpha
float alpha [@property getter]
float alpha [@property setter]

Alpha

blend
Blend blend [@property getter]
Blend blend [@property setter]

Blending algorithm.

draw
void draw(Vec2f pos, Vec2f anchor)

Render the whole texture here

draw
void draw(Vec2f pos, Vec4i srcRect, Vec2f anchor)

Render a section of the texture here

draw
void draw(Vec2f pos, Vec2f size, Vec2f anchor)

Render the whole texture here

draw
void draw(Vec2f pos, Vec2f size, Vec4i srcRect, Vec2f anchor)

Render a section of the texture here

draw
void draw(Vec2f pos, Vec2f size, Vec4i srcRect, float angle, Flip flip, Vec2f anchor)

Render a section of the texture here

Meta