Canvasity

Main canvas API. Given an image buffer, a Canvasity can draw 2D shapes without any GPU usage.

nothrow @nogc
struct Canvasity {}

Constructors

this
this(Image buffer, CanvasOptions options)

Construct a new canvas. Reset to default state.

Destructor

~this
~this()
Undocumented in source.

Postblit

this(this)
this(this)
Undocumented in source.

Members

Enums

savedBySaveRestore
anonymousenum savedBySaveRestore
Undocumented in source.

Functions

arc
void arc(float x, float y, float radius, float start_angle, float end_angle, bool counter_clockwise)
void arc(T p, float radius, float start_angle, float end_angle, bool counter_clockwise)

Extend the current subpath with an arc between two angles.

arcTo
void arcTo(float v_x, float v_y, float x, float y, float r)
void arcTo(T v, T p, float r)

Extend the current subpath with an arc tangent to two lines.

beginPath
void beginPath()

Reset the current path.

bezierCurveTo
void bezierCurveTo(float c1_x, float c1_y, float c2_x, float c2_y, float x, float y)
void bezierCurveTo(T c1, T c2, T p)

Extend the current subpath with a cubic Bezier curve.

clearRect
void clearRect(float x, float y, float width, float height)

Clear a rectangular area back to transparent black.

clip
void clip()

Restrict the clip region by the current path.

closePath
void closePath()

Close the current subpath.

drawImage
void drawImage(const(ubyte)* image, int width, int height, int stride, float x, float y, float to_width, float to_height)

Draw an image onto the canvas.

fill
void fill()

Draw the interior of the current path using the fill style.

fillRect
void fillRect(float x, float y, float w, float h)

Fill a rectangular area.

fillStyle
void fillStyle(Color col)
void fillStyle(const(char)[] cssColor)
void fillStyle(RGBAf col)
void fillStyle(RGBA8 col)
void fillStyle(RGBA16 col)
void fillStyle(T col)

Set filling or stroking to use a constant color and opacity.

fillStyle
deprecated void fillStyle(float r, float g, float b, float a)
Undocumented in source. Be warned that the author may not have intended to support it.
fillText
void fillText(const(char)* text, float x, float y, float maxWidth)

Draw a line of text by filling its outline.

globalAlpha
void globalAlpha(float alpha)
float globalAlpha()

Set/get the opacity applied to all drawing operations.

globalCompositeOperation
void globalCompositeOperation(CanvasCompositeOp op)
void globalCompositeOperation(const(char)[] compositeOp)
CanvasCompositeOp globalCompositeOperation()

Set/get the compositing operation for blending new drawing and old pixels.

initialize
void initialize(Image buffer, CanvasOptions options)

Construct a new canvas. Reset to default state.

isPointInPath
bool isPointInPath(float x, float y)
bool isPointInPath(T p)

Tests whether a point is in or on the current path.

lineCap
void lineCap(CanvasLineCap capStyle)
void lineCap(const(char)[] capStyle)
CanvasLineCap lineCap()
lineDashOffset
void lineDashOffset(float offset)

Offset where each subpath starts the dash pattern.

lineDashOffset
float lineDashOffset()
Undocumented in source. Be warned that the author may not have intended to support it.
lineJoin
void lineJoin(CanvasLineJoin joinStyle)
void lineJoin(const(char)[] joinStyle)
CanvasLineJoin lineJoin()
lineTo
void lineTo(float x, float y)
void lineTo(T v)

Extend the current subpath with a straight line.

lineWidth
void lineWidth(float width)
float lineWidth()

Set/get the width of the lines when stroking.

measure_text
float measure_text(const(char)* text)

Measure the width in pixels of a line of text.

miterLimit
void miterLimit(float limit)
float miterLimit()

Set/get the limit on maximum pointiness allowed for miter joins.

moveTo
void moveTo(float x, float y)
void moveTo(T v)

Create a new subpath.

quadraticCurveYo
void quadraticCurveYo(float cx, float cy, float x, float y)
void quadraticCurveYo(T c, T p)

Extend the current subpath with a quadratic Bezier curve.

rect
void rect(float x, float y, float width, float height)

Add a closed subpath in the shape of a rectangle.

restore
void restore()

Restore a previously saved state as though from a stack.

rotate
void rotate(float angle)

Rotate the current transform.

save
void save()

Save the current state as though to a stack.

scale
void scale(float x, float y)

Scale the current transform.

setFont
bool setFont(const(ubyte)* font, int bytes, float size)

Set the font to use for text drawing.

setLineDash
void setLineDash(const(float)* segments, int count)
void setLineDash(const(float)[] segments)
void setLineDash()

Set or clear the line dash pattern.

setTransform
void setTransform(float a, float b, float c, float d, float e, float f)

Replace the current transform.

shadowBlur
void shadowBlur(float level)
float shadowBlur()

Set/get the level of gaussian blurring on the shadow.

shadowColor
void shadowColor(Color col)
void shadowColor(const(char)[] cssColor)
void shadowColor(RGBAf col)
void shadowColor(RGBA8 col)
void shadowColor(RGBA16 col)

Set the color and opacity of the shadow.

shadowColor
deprecated void shadowColor(float r, float g, float b, float a)
Undocumented in source. Be warned that the author may not have intended to support it.
shadowOffsetX
void shadowOffsetX(float offsetX)
float shadowOffsetX()
shadowOffsetY
void shadowOffsetY(float offsetY)
float shadowOffsetY()

Set/get offset of the shadow in pixels.

stroke
void stroke()

Draw the edges of the current path using the stroke style.

strokeRect
void strokeRect(float x, float y, float w, float h)

Stroke a rectangular area.

strokeStyle
void strokeStyle(Color col)
void strokeStyle(const(char)[] cssColor)
void strokeStyle(RGBAf col)
void strokeStyle(RGBA8 col)
void strokeStyle(RGBA16 col)
void strokeStyle(T rgba)

Set filling or stroking to use a constant color and opacity.

strokeStyle
deprecated void strokeStyle(float r, float g, float b, float a)
Undocumented in source. Be warned that the author may not have intended to support it.
stroke_text
void stroke_text(const(char)* text, float x, float y, float maxWidth)

Draw a line of text by stroking its outline.

transform
void transform(float a, float b, float c, float d, float e, float f)

Add an arbitrary transform to the current transform.

translate
void translate(float x, float y)

Translate the current transform.

Manifest constants

maxSaveRestoreDepth
enum maxSaveRestoreDepth;
Undocumented in source.

Meta