Module

Flare.Drawing

Package
purescript-flare
Repository
sharkdp/purescript-flare

#runFlareDrawing Source

runFlareDrawing :: ElementId -> ElementId -> UI Drawing -> Effect Unit

Renders a Flare UI with a Drawing as output. The first ID specifies the DOM element for the controls while the second ID specifies the canvas for rendering.

Re-exports from Graphics.Drawing

#Shape Source

data Shape

A single shape.

Instances

#Shadow Source

newtype Shadow

Encapsulates shadow settings etc.

Instances

#Point Source

type Point = { x :: Number, y :: Number }

A Point consists of x and y coordinates.

#OutlineStyle Source

newtype OutlineStyle

Encapsulates outline color etc.

Instances

#Font Source

data Font

Fonts.

Instances

#FillStyle Source

newtype FillStyle

Encapsulates fill color etc.

Instances

#Drawing Source

data Drawing

A vector Drawing.

Instances

#Color Source

data Color

The representation of a color.

Note:

  • The Eq instance compares two Colors by comparing their (integer) RGB values. This is different from comparing the HSL values (for example, HSL has many different representations of black (arbitrary hue and saturation values).
  • Colors outside the sRGB gamut which cannot be displayed on a typical computer screen can not be represented by Color.

Instances

#translate Source

translate :: Number -> Number -> Drawing -> Drawing

Apply a translation by providing the x and y distances.

#text Source

text :: Font -> Number -> Number -> FillStyle -> String -> Drawing

Render some text.

#shadowOffset Source

shadowOffset :: Number -> Number -> Shadow

Set the shadow blur.

#shadowColor Source

shadowColor :: Color -> Shadow

Set the shadow color.

#shadowBlur Source

shadowBlur :: Number -> Shadow

Set the shadow blur.

#shadow Source

shadow :: Shadow -> Drawing -> Drawing

Apply a Shadow to a Drawing.

#scale Source

scale :: Number -> Number -> Drawing -> Drawing

Apply a scale transformation by providing the x and y scale factors.

#rotate Source

rotate :: Number -> Drawing -> Drawing

Apply a rotation by providing the angle.

#render Source

render :: Context2D -> Drawing -> Effect Unit

Render a Drawing to a canvas.

#rectangle Source

rectangle :: Number -> Number -> Number -> Number -> Shape

Create a rectangle from the left, top, width and height parameters.

#path Source

path :: forall f. Foldable f => f Point -> Shape

Create a path.

#outlined Source

outlined :: OutlineStyle -> Shape -> Drawing

Draw the outline of a Shape.

#outlineColor Source

outlineColor :: Color -> OutlineStyle

Set the outline color.

#lineWidth Source

lineWidth :: Number -> OutlineStyle

Set the line width.

#filled Source

filled :: FillStyle -> Shape -> Drawing

Fill a Shape.

#fillColor Source

fillColor :: Color -> FillStyle

Set the fill color.

#everywhere Source

everywhere :: (Drawing -> Drawing) -> Drawing -> Drawing

Modify a Drawing by applying a transformation to every subdrawing.

#closed Source

closed :: forall f. Foldable f => f Point -> Shape

Create a closed path.

#clipped Source

clipped :: Shape -> Drawing -> Drawing

Clip a Drawing to a Shape.

#circle Source

circle :: Number -> Number -> Number -> Shape

Create a circle from the left, top and radius parameters.

#arc Source

arc :: Number -> Number -> Number -> Number -> Number -> Shape

Create a circular arc from the left, top, start angle, end angle and radius parameters.