A position as a two-dimensional vector.
Modulesdl2-gfx-0.3.0.0Haskell2010
SDL.Primitive
Bindings to SDL2_gfx's primitives drawing functionality. These functions
should allow you to render various simple shapes such as lines, ellipses or
polygons.
All of the monadic functions within this module are capable of throwing an SDLException if they encounter an error.
Synopsis
- type Pos
- type Color
- value pixel
- value line
- type Length
- value horizontalLine
- value verticalLine
- value smoothLine
- type Width
- value thickLine
- value triangle
- value smoothTriangle
- value fillTriangle
- value rectangle
- type Radius
- value roundRectangle
- value fillRectangle
- value fillRoundRectangle
- type Start
- type End
- value arc
- value circle
- value smoothCircle
- value fillCircle
- value ellipse
- value smoothEllipse
- value fillEllipse
- value pie
- value fillPie
- type Steps
- value bezier
- value polygon
- value smoothPolygon
- value fillPolygon
- Packagesdl2-gfx-0.3.0.0
- Exports34
- LanguageHaskell2010
- LicenceMIT
- SourcePrimitive.hs
Pixels
A color as an RGBA byte-vector.
Renders a single pixel at a given position.
Lines
Renders a line between two points.
A length in pixels.
Renders an anti-aliased line between two points.
A width in pixels.
Triangles
Render a transparent triangle, its edges being of a given Color.
Same as triangle, but the edges are anti-aliased.
Rectangles
Renders a transparent rectangle spanning two points, bordered by a line of a given Color.
A radius in pixels.
Same as roundRectangle, but the rectangle is filled by the given Color.
Curves
A starting position in degrees.
An ending position in degrees.
Renders a transparent circle, bordered by a line of a given Color.
Same as circle, but the border is anti-aliased.
Same as ellipse, but makes the border anti-aliased.
How many interpolation steps when rendering a bezier curve?
The higher this is, the smoother the curve and more resource-intensive the render.
Renders a bezier curve of a given Color.
The input vectors contain the bezier curve's point locations on the x and y-axis, respectively. The input vectors need to be the same length, and those lengths must be at least 3, otherwise bezier might raise an SDLException. The same applies for the number of interpolation Steps: it must be at least 2.
Polygons
Render a transparent polygon, its edges of a given Color.
The input vectors contain the points' locations on the x and y-axis, respectively. The input vectors need to be the of the same length, and the lengths must be at least 3, otherwise polygon might raise an SDLException.
Same as polygon, but the edges are drawn anti-aliased.