dplug.canvas

2D software renderer. See an example of a Canvas-enabled UIElement in: dplug.flatwidgets.windowresizer.UIWindowResizer

This is a DPlug-specific rework of dg2d by Cerjones. https://github.com/cerjones/dg2d

- removal of truetype functionnality (since covered by dplug:graphics) - nothrow @nogc - rework of the Canvas itself, to resemble more the HTML5 Canvas API - Blitter delegate made explicit with a userData pointer - added html color parsing - no alignment requirements - clipping is done with the ImageRef input - added a few blendmodes However a failure of this fork is that for transforms and stroke() support you do need path abstraction in the end.

dplug:canvas is pretty fast and writes 4 pixels at once.

Bug: you can't use it on a widget that is full-size in your plugin.

Modules

angularblit
module dplug.canvas.angularblit

Not supported for now.

colorblit
module dplug.canvas.colorblit

Implement the plain color fill style. dplug:canvas internals.

ellipticalblit
module dplug.canvas.ellipticalblit

Implement the elliptic gradient fill style. dplug:canvas internals.

gradient
module dplug.canvas.gradient

Implement the gradient class. dplug:canvas internals.

htmlcolors
module dplug.canvas.htmlcolors

Implement HTML color parsing. dplug:canvas internals.

linearblit
module dplug.canvas.linearblit

Implement the linear gradient fill style. dplug:canvas internals.

misc
module dplug.canvas.misc

Miscellaneous functions for dplug:canvas internals.

rasterizer
module dplug.canvas.rasterizer

Analytic antialiasing rasterizer.

Public Imports

dplug.math.vector
public import dplug.math.vector;
Undocumented in source.
dplug.math.box
public import dplug.math.box;
Undocumented in source.

Members

Aliases

ImageDest
alias ImageDest = ImageRef!RGBA

dplug:canvas operates on RGBA 8-bit buffers.

Classes

CanvasGradient
class CanvasGradient

Holds both gradient data/table and positioning information.

Enums

CompositeOperation
enum CompositeOperation

How to composite against background (background is always considered opaque in dplug:canvas).

FillRule
enum FillRule

How to fill pixels.

Structs

Canvas
struct Canvas

A 2D Canvas able to render complex pathes into an ImageRef!RGBA buffer. Canvas tries to follow loosely the HTML 5 Canvas API.

Transform2D
struct Transform2D

The transform type used by dplug:canvas. It's a 3x3 float matrix with the form: (a b c) (d e f) (0 0 1)

Meta