Module

Graphics.Drawing

Package
purescript-drawing
Repository
paf31/purescript-drawing

This module defines a type Drawing for creating vector graphics.

#Point Source

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

A Point consists of x and y coordinates.

#Shape Source

data Shape

A single shape.

Instances

#path Source

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

Create a path.

#closed Source

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

Create a closed path.

#rectangle Source

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

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

#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.

#FillStyle Source

newtype FillStyle

Encapsulates fill color etc.

Instances

#fillColor Source

fillColor :: Color -> FillStyle

Set the fill color.

#OutlineStyle Source

newtype OutlineStyle

Encapsulates outline color etc.

Instances

#outlineColor Source

outlineColor :: Color -> OutlineStyle

Set the outline color.

#lineWidth Source

lineWidth :: Number -> OutlineStyle

Set the line width.

#Shadow Source

newtype Shadow

Encapsulates shadow settings etc.

Instances

#shadowOffset Source

shadowOffset :: Number -> Number -> Shadow

Set the shadow blur.

#shadowBlur Source

shadowBlur :: Number -> Shadow

Set the shadow blur.

#shadowColor Source

shadowColor :: Color -> Shadow

Set the shadow color.

#shadow Source

shadow :: Shadow -> Drawing -> Drawing

Apply a Shadow to a Drawing.

#Drawing Source

data Drawing

A vector Drawing.

Instances

#filled Source

filled :: FillStyle -> Shape -> Drawing

Fill a Shape.

#outlined Source

outlined :: OutlineStyle -> Shape -> Drawing

Draw the outline of a Shape.

#clipped Source

clipped :: Shape -> Drawing -> Drawing

Clip a Drawing to a Shape.

#scale Source

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

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

#translate Source

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

Apply a translation by providing the x and y distances.

#rotate Source

rotate :: Number -> Drawing -> Drawing

Apply a rotation by providing the angle.

#text Source

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

Render some text.

#everywhere Source

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

Modify a Drawing by applying a transformation to every subdrawing.

#render Source

render :: Context2D -> Drawing -> Effect Unit

Render a Drawing to a canvas.

Re-exports from Color

#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

Re-exports from Graphics.Drawing.Font

#Font Source

data Font

Fonts.

Instances