Module

Graphics.Canvas.Extra

Package
purescript-web-font-loading
Repository
rowtype-yoga/purescript-web-font-loading

Native canvas capabilities not provided by Graphics.Canvas.

#createCanvasElement Source

createCanvasElement :: Effect CanvasElement

A fresh, detached <canvas> element, not attached to the document — handy as an offscreen drawing surface (e.g. a texture source).

#createOffscreenCanvas Source

createOffscreenCanvas :: Number -> Number -> Effect CanvasElement

Construct a native worker-compatible surface. Throws when OffscreenCanvas is unavailable; callers can choose another surface using the capability query.

#supportsOffscreenCanvas Source

supportsOffscreenCanvas :: Effect Boolean

Unlike detached DOM canvases, these surfaces are available in workers.

#getContext2DNullable Source

getContext2DNullable :: CanvasElement -> Effect (Nullable Context2D)

Preserve the native null result when the context type is unavailable or the surface has already been bound to a different context type.

#resetContext Source

resetContext :: Context2D -> Effect Unit

Use the native reset operation when available. On older implementations, restore the identity transform and clear the bitmap without resizing it.

#measureTextInk Source

measureTextInk :: Context2D -> String -> Effect { ascent :: Number, descent :: Number, width :: Number }

Native advance width and actual ink extents. Unsupported ink metrics are NaN, leaving fallback font/measurement policy to the caller.

#FillRule Source

data FillRule

Constructors

#setFilter Source

setFilter :: Context2D -> String -> Effect Unit

Set a CSS filter string without imposing a particular filter recipe.

#createPatternNullable Source

createPatternNullable :: Context2D -> CanvasImageSource -> PatternRepeat -> Effect (Nullable CanvasPattern)

Like Graphics.Canvas.createPattern, but retain native allocation failure.

#setPatternTransform Source

setPatternTransform :: CanvasPattern -> Transform -> Effect Boolean

Apply a DOMMatrix2DInit directly; no DOMMatrix constructor is needed in workers. Returns false if this browser does not support pattern transforms.

#LetterSpacing Source

newtype LetterSpacing

A CSS length controlling extra space between glyphs, e.g. 8px.

Constructors

Instances

#setLetterSpacing Source

setLetterSpacing :: Context2D -> LetterSpacing -> Effect Unit

Set the context's letterSpacing.

#FontKerning Source

newtype FontKerning

Whether the context applies font kerning.

Instances

#setFontKerning Source

setFontKerning :: Context2D -> FontKerning -> Effect Unit

Set the context's fontKerning.