Copyright | (c) Tim Docker 2006 2014 |
---|---|
License | BSD-style (see chart/COPYRIGHT) |
Safe Haskell | Safe |
Language | Haskell98 |
- data Rect = Rect Point Point
- data Point = Point {}
- data Vector = Vector {}
- type RectSize = (Double, Double)
- type Range = (Double, Double)
- pointToVec :: Point -> Vector
- mkrect :: Point -> Point -> Point -> Point -> Rect
- rectPath :: Rect -> Path
- pvadd :: Point -> Vector -> Point
- pvsub :: Point -> Vector -> Point
- psub :: Point -> Point -> Vector
- vangle :: Vector -> Double
- vlen :: Vector -> Double
- vscale :: Double -> Vector -> Vector
- within :: Point -> Rect -> Bool
- intersectRect :: Limit Rect -> Limit Rect -> Limit Rect
- data RectEdge
- data Limit a
- type PointMapFn x y = (Limit x, Limit y) -> Point
- data Path
- lineTo :: Point -> Path
- moveTo :: Point -> Path
- lineTo' :: Double -> Double -> Path
- moveTo' :: Double -> Double -> Path
- arc :: Point -> Double -> Double -> Double -> Path
- arc' :: Double -> Double -> Double -> Double -> Double -> Path
- arcNeg :: Point -> Double -> Double -> Double -> Path
- arcNeg' :: Double -> Double -> Double -> Double -> Double -> Path
- close :: Path
- foldPath :: Monoid m => (Point -> m) -> (Point -> m) -> (Point -> Double -> Double -> Double -> m) -> (Point -> Double -> Double -> Double -> m) -> m -> Path -> m
- makeLinesExplicit :: Path -> Path
- transformP :: Matrix -> Point -> Point
- scaleP :: Vector -> Point -> Point
- rotateP :: Double -> Point -> Point
- translateP :: Vector -> Point -> Point
- data Matrix = Matrix {}
- identity :: Matrix
- rotate :: Double -> Matrix -> Matrix
- scale :: Vector -> Matrix -> Matrix
- translate :: Vector -> Matrix -> Matrix
- scalarMultiply :: Double -> Matrix -> Matrix
- adjoint :: Matrix -> Matrix
- invert :: Matrix -> Matrix
Points and Vectors
mkrect :: Point -> Point -> Point -> Point -> Rect #
Create a rectangle based upon the coordinates of 4 points.
type PointMapFn x y = (Limit x, Limit y) -> Point #
A function mapping between points.
Paths
The path type used by Charts.
A path can consist of several subpaths. Each
is started by a MoveTo
operation. All subpaths
are open, except the last one, which may be closed
using the Close
operation. When filling a path
all subpaths are closed implicitly.
Closing a subpath means that a line is drawn from the end point to the start point of the subpath.
If a Arc
(or ArcNeg
) is drawn a implicit line
from the last end point of the subpath is drawn
to the beginning of the arc. Another implicit line
is drawn from the end of an arc to the beginning of
the next path segment.
The beginning of a subpath is either (0,0) or set
by a MoveTo
instruction. If the first subpath is started
with an arc the beginning of that subpath is the beginning
of the arc.
Move the paths pointer to the given location and draw a straight line while doing so.
:: Point | Center point of the circle arc. |
-> Double | Radius of the circle. |
-> Double | Angle to start drawing at, in radians. |
-> Double | Angle to stop drawing at, in radians. |
-> Path |
Draw the arc of a circle. A straight line connects
the end of the previous path with the beginning of the arc.
The zero angle points in direction of the positive x-axis.
Angles increase in clock-wise direction. If the stop angle
is smaller then the start angle it is increased by multiples of
2 * pi
until is is greater or equal.
arcNeg :: Point -> Double -> Double -> Double -> Path #
Like arc
, but draws from the stop angle to the start angle
instead of between them.
:: Monoid m | |
=> (Point -> m) | MoveTo |
-> (Point -> m) | LineTo |
-> (Point -> Double -> Double -> Double -> m) | Arc |
-> (Point -> Double -> Double -> Double -> m) | ArcNeg |
-> m | Close |
-> Path | Path to fold |
-> m |
Fold the given path to a monoid structure.
makeLinesExplicit :: Path -> Path #
Enriches the path with explicit instructions to draw lines,
that otherwise would be implicit. See Path
for details
about what lines in paths are implicit.
Matrices
transformP :: Matrix -> Point -> Point #
Transform a point using the given matrix.
rotateP :: Double -> Point -> Point #
Rotate a point around the origin. The angle is given in radians.
translateP :: Vector -> Point -> Point #
Translate a point.
Copied from Graphics.Rendering.Cairo.Matrix
rotate :: Double -> Matrix -> Matrix #
Copied from Graphics.Rendering.Cairo.Matrix Rotations angle is given in radians.
scalarMultiply :: Double -> Matrix -> Matrix #
Copied from Graphics.Rendering.Cairo.Matrix