Safe Haskell | None |
---|
This module provides the implementation details common to all ChartBackend
s.
- data ChartBackendInstr a where
- StrokePath :: Path -> ChartBackendInstr ()
- FillPath :: Path -> ChartBackendInstr ()
- GetTextSize :: String -> ChartBackendInstr TextSize
- DrawText :: Point -> String -> ChartBackendInstr ()
- GetAlignments :: ChartBackendInstr AlignmentFns
- WithTransform :: Matrix -> Program ChartBackendInstr a -> ChartBackendInstr a
- WithFontStyle :: FontStyle -> Program ChartBackendInstr a -> ChartBackendInstr a
- WithFillStyle :: FillStyle -> Program ChartBackendInstr a -> ChartBackendInstr a
- WithLineStyle :: LineStyle -> Program ChartBackendInstr a -> ChartBackendInstr a
- WithClipRegion :: Rect -> Program ChartBackendInstr a -> ChartBackendInstr a
- type ChartBackend a = Program ChartBackendInstr a
- type CRender a = ChartBackend a
- strokePath :: Path -> ChartBackend ()
- fillPath :: Path -> ChartBackend ()
- textSize :: String -> ChartBackend TextSize
- drawText :: Point -> String -> ChartBackend ()
- withTransform :: Matrix -> ChartBackend a -> ChartBackend a
- withFontStyle :: FontStyle -> ChartBackend a -> ChartBackend a
- withFillStyle :: FillStyle -> ChartBackend a -> ChartBackend a
- withLineStyle :: LineStyle -> ChartBackend a -> ChartBackend a
- withClipRegion :: Rect -> ChartBackend a -> ChartBackend a
- getPointAlignFn :: ChartBackend (Point -> Point)
- getCoordAlignFn :: ChartBackend (Point -> Point)
Documentation
data ChartBackendInstr a whereSource
The abstract drawing operation generated when using the the chart drawing API.
See the documentation of the different function for the correct semantics of each instruction:
StrokePath :: Path -> ChartBackendInstr () | |
FillPath :: Path -> ChartBackendInstr () | |
GetTextSize :: String -> ChartBackendInstr TextSize | |
DrawText :: Point -> String -> ChartBackendInstr () | |
GetAlignments :: ChartBackendInstr AlignmentFns | |
WithTransform :: Matrix -> Program ChartBackendInstr a -> ChartBackendInstr a | |
WithFontStyle :: FontStyle -> Program ChartBackendInstr a -> ChartBackendInstr a | |
WithFillStyle :: FillStyle -> Program ChartBackendInstr a -> ChartBackendInstr a | |
WithLineStyle :: LineStyle -> Program ChartBackendInstr a -> ChartBackendInstr a | |
WithClipRegion :: Rect -> Program ChartBackendInstr a -> ChartBackendInstr a |
type ChartBackend a = Program ChartBackendInstr aSource
A ChartBackend
provides the capability to render a chart somewhere.
The coordinate system of the backend has its initial origin (0,0) in the top left corner of the drawing plane. The x-axis points towards the top right corner and the y-axis points towards the bottom left corner. The unit used by coordinates, the font size, and lengths is the always the same, but depends on the backend. All angles are measured in radians.
The line, fill and font style are set to their default values initially.
Information about the semantics of the instructions can be
found in the documentation of ChartBackendInstr
.
type CRender a = ChartBackend aSource
Deprecated: Use the new name ChartBackend!
Alias so the old name for rendering code still works.
strokePath :: Path -> ChartBackend ()Source
fillPath :: Path -> ChartBackend ()Source
textSize :: String -> ChartBackend TextSizeSource
Calculate a TextSize
object with rendering information
about the given string without actually rendering it.
drawText :: Point -> String -> ChartBackend ()Source
Draw a single-line textual label anchored by the baseline (vertical)
left (horizontal) point. Uses the current FontStyle
for drawing.
withTransform :: Matrix -> ChartBackend a -> ChartBackend aSource
Apply the given transformation in this local environment when drawing. The given transformation is applied after the current transformation. This means both are combined.
withFontStyle :: FontStyle -> ChartBackend a -> ChartBackend aSource
Use the given font style in this local environment when drawing text.
An implementing backend is expected to guarentee
to support the following font families: serif
, sans-serif
and monospace
;
If the backend is not able to find or load a given font it is required to fall back to a custom fail-safe font and use it instead.
withFillStyle :: FillStyle -> ChartBackend a -> ChartBackend aSource
Use the given fill style in this local environment when filling paths.
withLineStyle :: LineStyle -> ChartBackend a -> ChartBackend aSource
Use the given line style in this local environment when stroking paths.
withClipRegion :: Rect -> ChartBackend a -> ChartBackend aSource
Use the given clipping rectangle when drawing in this local environment. The new clipping region is intersected with the given clip region. You cannot escape the clip!
getPointAlignFn :: ChartBackend (Point -> Point)Source
Get the point alignment function
getCoordAlignFn :: ChartBackend (Point -> Point)Source
Get the coordinate alignment function