HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

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.

  • 8 types
  • 26 values

Pixels

3 declarations
typetype Pos = V2 CInt
#

A position as a two-dimensional vector.

Lines

7 declarations

Triangles

3 declarations

Rectangles

5 declarations

Curves

13 declarations
typetype Start = CInt
#

A starting position in degrees.

typetype End = CInt
#

An ending position in degrees.

valuearc
  1. :: MonadIO m
  2. => Renderer
  3. -> Pos
  4. -> Radius
  5. -> Start
  6. -> End
  7. -> Color
  8. -> m ()
#

Render an arc, its Pos being its center.

The Start and End arguments define the starting and ending points of the arc in degrees, zero degrees being south and increasing counterclockwise.

valuepie
  1. :: MonadIO m
  2. => Renderer
  3. -> Pos
  4. -> Radius
  5. -> Start
  6. -> End
  7. -> Color
  8. -> m ()
#

Render a pie outline, its Pos being its center.

The Start and End arguments define the starting and ending points of the pie in degrees, zero degrees being east and increasing counterclockwise.

typetype Steps = CInt
#

How many interpolation steps when rendering a bezier curve?

The higher this is, the smoother the curve and more resource-intensive the render.

valuebezier
  1. :: MonadIO m
  2. => Renderer
  3. -> Vector Int16
  4. -> Vector Int16
  5. -> Steps
  6. -> Color
  7. -> m ()
#

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

3 declarations