htdp-image-1.0.0.0: Beginner friendly graphics library.

Safe HaskellNone
LanguageHaskell2010

Graphics.Shape

Contents

Description

Image constructors

Synopsis

Documentation

data Mode Source #

Drawing mode.

Instances
Eq Mode Source # 
Instance details

Defined in Graphics.Shape

Methods

(==) :: Mode -> Mode -> Bool #

(/=) :: Mode -> Mode -> Bool #

solid :: Mode Source #

Type of drawing mode.

outline :: Mode Source #

Type of drawing mode.

circle Source #

Arguments

:: Float
r
-> Mode
m
-> Color
c
-> Image 

Constructs a circle of radius r, drawing mode m and color c.

ellipse Source #

Arguments

:: Float
w
-> Float
h
-> Mode
m
-> Color
c
-> Image 

Constructs an ellipse of width w, height h, mode m, and color c.

line Source #

Arguments

:: Float
x1
-> Float
y1
-> Color
c
-> Image 

Constructs an image of a line segment of color c that connects the points (0,0) to (x1, y1).

addLine Source #

Arguments

:: Image
i
-> Float
x1
-> Float
y1
-> Float
x2
-> Float
y2
-> Color 
-> Image 

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.

triangle Source #

Arguments

:: Float
l
-> Mode
m
-> Color
c
-> Image 

Constructs an upward-pointing equilateral triangle with length l, mode m, and color c.

rightTriangle Source #

Arguments

:: Float
b
-> Float
p
-> Mode
m
-> Color
c
-> Image 

Constructs a right triangle with base length b, perpendicular length p, mode m, and color c.

isoscelesTriangle Source #

Arguments

:: Float
l
-> Float
a
-> Mode
m
-> Color
c
-> Image 

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.

triangleSSS Source #

Arguments

:: Float
a
-> Float
b
-> Float
c
-> Mode
m
-> Color
color
-> Image 

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.

triangleASS Source #

Arguments

:: Float
A
-> Float
b
-> Float
c
-> Mode
mode
-> Color
color
-> Image 

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.

triangleSAS Source #

Arguments

:: Float
B
-> Float
a
-> Float
c
-> Mode
mode
-> Color
color
-> Image 

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.

triangleSSA Source #

Arguments

:: Float
C
-> Float
a
-> Float
c
-> Mode
mode
-> Color
color
-> Image 

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.

triangleAAS Source #

Arguments

:: Float
A
-> Float
B
-> Float
c
-> Mode
m
-> Color
color
-> Image 

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.

triangleASA Source #

Arguments

:: Float
A
-> Float
C
-> Float
b
-> Mode
m
-> Color
color
-> Image 

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.

triangleSAA Source #

Arguments

:: Float
B
-> Float
C
-> Float
a
-> Mode
m
-> Color
color
-> Image 

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.

square Source #

Arguments

:: Float
s
-> Mode
m
-> Color
c
-> Image 

Constructs a square of side s, mode m, and color c.

rectangle Source #

Arguments

:: Float
w
-> Float
h
-> Mode
m
-> Color
c
-> Image 

Constructs a rectangle of width w, height h, mode m, and color c.

rhombus Source #

Arguments

:: Float
l
-> Float
a
-> Mode
m
-> Color
c
-> Image 

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.

star Source #

Arguments

:: Float
l
-> Mode
m
-> Color
c
-> Image 

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.