March Docs

Arcade.Draw

Types

typeRgbaRgba = { red : Int, green : Int, blue : Int, alpha : Float }#

A colour as the canvas takes it: 0-255 channels and an alpha 0...1.

typeLineEndLineEnd = ButtEnd | RoundEnd#
typeCornerCorner = MitreCorner | RoundCorner#
typeBlendBlend = Over | Lighter#

Canvas globalCompositeOperation: source-over, or "lighter" for glows.

typePathStepPathStep =#
typeShapeShape =#

Holed fills its outer ring minus the inner one (even-odd). Polys is a union of rings wound the same way (non-zero).

typeAffineAffine = {#

Canvas setTransform(a, b, c, d, e, f): x' = a x + c y + e, y' = b x + d y + f.

typeGradientStopGradientStop = { offset : Float, colour : Rgba }#
typeRadialRadial = {#

createRadialGradient in the coordinates of frame. The shell builds the path in pixels, then sets frame before filling.

typePaintPaint = Flat(Rgba) | RadialPaint(Radial)#
typePenPen = { ink : Rgba, width : Float, ends : LineEnd, corners : Corner }#
typeLetteringLettering = {#

Text centred on middle (textAlign center, textBaseline middle) in the coordinates of frame. edge is stroked first, under the fill.

typeDrawOpDrawOp =#

Functions

fncsscss(c : Rgba) : String needs ()#
fncss_numbercss_number(x : Float) : String needs ()#

fn lighter(c : Rgba, t : Float) : Rgba needs () do mix(c, hex(16777215), t) end

fnmixmix(c : Rgba, o : Rgba, t : Float) : Rgba needs ()#

fn channel(x : Float) : Int needs () do Math.clamp_int(float_round(x), 0, 255) end