Safe Haskell | None |
---|---|

Language | Haskell2010 |

Image constructors

## Synopsis

- data Mode
- solid :: Mode
- outline :: Mode
- circle :: Float -> Mode -> Color -> Image
- ellipse :: Float -> Float -> Mode -> Color -> Image
- line :: Float -> Float -> Color -> Image
- addLine :: Image -> Float -> Float -> Float -> Float -> Color -> Image
- emptyImage :: Image
- triangle :: Float -> Mode -> Color -> Image
- rightTriangle :: Float -> Float -> Mode -> Color -> Image
- isoscelesTriangle :: Float -> Float -> Mode -> Color -> Image
- triangleSSS :: Float -> Float -> Float -> Mode -> Color -> Image
- triangleASS :: Float -> Float -> Float -> Mode -> Color -> Image
- triangleSAS :: Float -> Float -> Float -> Mode -> Color -> Image
- triangleSSA :: Float -> Float -> Float -> Mode -> Color -> Image
- triangleAAS :: Float -> Float -> Float -> Mode -> Color -> Image
- triangleASA :: Float -> Float -> Float -> Mode -> Color -> Image
- triangleSAA :: Float -> Float -> Float -> Mode -> Color -> Image
- square :: Float -> Mode -> Color -> Image
- rectangle :: Float -> Float -> Mode -> Color -> Image
- rhombus :: Float -> Float -> Mode -> Color -> Image
- star :: Float -> Mode -> Color -> Image

# Documentation

Drawing mode.

Constructs a circle of radius `r`

, drawing mode `m`

and color `c`

.

Constructs an ellipse of width `w`

, height `h`

, mode `m`

, and color `c`

.

Constructs an image of a line segment of color `c`

that connects the points
`(0,0)`

to `(x1, y1)`

.

Adds a line to the given image `i`

of color `c`

, starting from point `(x1, y1)`

and going to point `(x2, y2)`

. If the line crosses the given image's binding box,
then new image dimesions are changed to accommodate the line.

emptyImage :: Image Source #

Constructs an image of width and height `0`

.

Constructs an upward-pointing equilateral triangle with length `l`

,
mode `m`

, and color `c`

.

Constructs a right triangle with base length `b`

, perpendicular length
`p`

, mode `m`

, and color `c`

.

Constructs a triangle of two equal-length sides, of length `l`

, where the
angle between those sides is `a`

, mode is `m`

and color is `c`

. If the angle
is less than `180`

, then the triangle will point up, else it will point down.

### The following image from 2htdp/image documentation is useful for the following family of functions.

Constructs a triangle of side `a`

, `b`

, and `c`

. The variables refer to the
diagram above.
If it's not possible to construct the triangle with the given arguments,
an empty image is returned.

Constructs a triangle of mode `m`

, color `color`

, angle `A`

, and lengths
`b`

and `c`

. The variables refer to the diagram above.
If it's not possible to construct the triangle with the given arguments,
an empty image is returned.

Constructs a triangle of mode `m`

, color `color`

, angle `B`

, and lengths
`a`

and `c`

. The variables refer to the diagram above.
If it's not possible to construct the triangle with the given arguments,
an empty image is returned.

Constructs a triangle of mode `m`

, color `color`

, angle `C`

, and lengths
`a`

and `c`

. The variables refer to the diagram above.
If it's not possible to construct the triangle with the given arguments,
an empty image is returned.

Constructs a triangle of mode `m`

, color `color`

, angle `A`

, angle `B`

, and
length `c`

. The variables refer to the diagram above.
If it's not possible to construct the triangle with the given arguments,
an empty image is returned.

Constructs a triangle of mode `m`

, color `color`

, angle `A`

, angle `C`

, and
length `b`

. The variables refer to the diagram above.
If it's not possible to construct the triangle with the given arguments,
an empty image is returned.

Constructs a triangle of mode `m`

, color `color`

, angle `B`

, angle `C`

, and
length `a`

. The variables refer to the diagram above.
If it's not possible to construct the triangle with the given arguments,
an empty image is returned.

Constructs a square of side `s`

, mode `m`

, and color `c`

.

Constructs a rectangle of width `w`

, height `h`

, mode `m`

, and color `c`

.

Constructs a four sided polygon with all equal sides of length `l`

, where the
top and bottom pair of angles is `a`

, and the left and right are `180 - a`

.
As usual, mode is `m`

and color is `c`

.

Constructs a star with five points of mode `m`

and color `c`

. The argument
`l`

determines the side length of the internal pentagon.
Currently, a solid star is glitchy since it is a non-convex polygon
and openGL (the underlying graphics library) doesn't draw them correctly.
This will be corrected in future versions.