wumpus-basic-0.24.0: Basic objects and system code built on Wumpus-Core.

PortabilityGHC
Stabilityhighly unstable
Maintainerstephen.tetley@gmail.com
Safe HaskellSafe-Infered

Wumpus.Basic.Kernel.Objects.DrawingPrimitives

Contents

Description

Primitive drawings - text, paths, lines, rectangles, disks, ellipses...

All the primitives take their drawing properties (colour, line width, etc.) from the DrawingContext.

Synopsis

Prim Paths

locPP :: InterpretUnit u => [Vec2 u] -> LocQuery u PrimPathSource

locPP : [next_vector] -> LocImage PrimPath

Create a path query - i.e. a functional type from Point to PrimPath.

This is the analogue to vectorPath in Wumpus-Core, but the result is produced within the DrawingContext.

emptyLocPP :: InterpretUnit u => LocQuery u PrimPathSource

emptyLocPP : (Point ~> PrimPath)

Create an empty path query - i.e. a functional type from Point to PrimPath.

This is the analogue to emptyPath in Wumpus-Core, but the result is produced within the DrawingContext.

vertexPP :: InterpretUnit u => [Point2 u] -> Query u PrimPathSource

vertexPP : (Point ~> PrimPath)

Create a PrimPath made of straight line segments joining the supplied points.

This is the analogue to vertexPrimPath in Wumpus-Core, but it is polymorphic on unit.

curvePP :: InterpretUnit u => [Point2 u] -> Query u PrimPathSource

curvePP : (Point ~> PrimPath)

Create a path made of curve segments joining the supplied points.

This is the analogue to curvedPrimPath in Wumpus-Core, but it is polymorphic on unit.

dcOpenPath :: PrimPath -> Graphic uSource

dcOpenPath : path -> Graphic

This is the analogue to the ostroke function in Wumpus-Core, but the drawing properties (colour, line width, etc.) are taken from the implicit DrawingContext.

dcClosedPath :: DrawMode -> PrimPath -> Graphic uSource

dcClosedPath : DrawStyle * path -> Graphic

Draw a closed path according to the supplied DrawStyle ( fill | stroke | fill_stroke).

Text

dcTextlabel :: InterpretUnit u => String -> LocGraphic uSource

dcTextlabel : string -> LocGraphic

Create a text LocGraphic - i.e. a functional type from Point to Graphic.

The implicit point of the LocGraphic is the baseline left.

This is the analogue to textlabel in Wumpus-core, but the text properties (font family, font size, colour) are taken from the implicit DrawingContext.

dcRTextlabel :: InterpretUnit u => String -> LocThetaGraphic uSource

dcRTextlabel : string -> LocThetaGraphic

Create a text LocThetaGraphic - i.e. a functional type from Point and Angle to Graphic.

The implicit point of the LocGraphic is the baseline left, the implicit angle is rotation factor of the text.

Note - rotated text often does not render well in PostScript or SVG. Rotated text should be used sparingly.

This is the analogue to rtextlabel in Wumpus-core.

dcEscapedlabel :: InterpretUnit u => EscapedText -> LocGraphic uSource

dcEscapedlabel : escaped_text -> LocGraphic

Create a text LocGraphic - i.e. a functional type from Point to Graphic.

The implicit point of the LocGraphic is the baseline left.

This is the analogue to escapedlabel in Wumpus-core, but the text properties (font family, font size, colour) are taken from the implicit DrawingContext.

dcREscapedlabel :: InterpretUnit u => EscapedText -> LocThetaGraphic uSource

dcREscapedlabel : escaped_text -> LocThetaGraphic

Create a text LocThetaGraphic - i.e. a functional type from Point and Angle to Graphic.

The implicit point of the LocGraphic is the baseline left, the implicit angle is rotation factor of the text.

Note - rotated text often does not render well in PostScript or SVG. Rotated text should be used sparingly.

This is the analogue to rescapedlabel in Wumpus-core, but the text properties (font family, font size, colour) are taken from the implicit DrawingContext.

hkernLine :: InterpretUnit u => [KernChar u] -> LocGraphic uSource

hkernLine : [kern_char] -> LocGraphic

Create a horizontally kerned text LocGraphic - i.e. a functional type from Point to Graphic.

The implicit point of the LocGraphic is the baseline left.

This is the analogue to hkernlabel in Wumpus-core, but the text properties (font family, font size, colour) are taken from the implicit DrawingContext.

vkernLine :: InterpretUnit u => [KernChar u] -> LocGraphic uSource

vkernLine : [kern_char] -> LocGraphic

Create a vertically kerned text LocGraphic - i.e. a functional type from Point to Graphic.

The implicit point of the LocGraphic is the baseline left.

This is the analogue to vkernlabel in Wumpus-core, but the text properties (font family, font size, colour) are taken from the implicit DrawingContext.

Lines

straightLine :: InterpretUnit u => Point2 u -> Point2 u -> Graphic uSource

straightLine : start_point * end_point -> LocGraphic

Create a straight line Graphic, the start and end point are supplied explicitly.

The line properties (colour, pen thickness, etc.) are taken from the implicit DrawingContext.

locStraightLine :: InterpretUnit u => Vec2 u -> LocGraphic uSource

locStraightLine : vec_to -> LocGraphic

Create a stright line LocGraphic - i.e. a functional type from Point to Graphic.

The implicit point of the LocGraphic is the start point, the end point is calculated by displacing the start point with the supplied vector.

The line properties (colour, pen thickness, etc.) are taken from the implicit DrawingContext.

curvedLine :: InterpretUnit u => Point2 u -> Point2 u -> Point2 u -> Point2 u -> Graphic uSource

curveLine : start_point * control_point1 * control_point2 * end_point -> Graphic

Create a Bezier curve Graphic, all control points are supplied explicitly.

The line properties (colour, pen thickness, etc.) are taken from the implicit DrawingContext.

straightConnector :: InterpretUnit u => ConnectorGraphic uSource

straightConnector : start_point * end_point -> Connector

Create a straight line Graphic, the start and end point are supplied implicitly.

The line properties (colour, pen thickness, etc.) are taken from the implicit DrawingContext.

Circles

dcCircle :: InterpretUnit u => DrawMode -> u -> LocGraphic uSource

dcCircle : DrawStyle * radius -> LocGraphic

Create a circle LocGraphic - the implicit point is center. The circle is drawn with four Bezier curves.

The respective line or fill properties for the DrawStyle are taken from the implicit DrawingContext.

Ellipses

dcEllipse :: InterpretUnit u => DrawMode -> u -> u -> LocGraphic uSource

strokedEllipse : x_radius * y_radius -> LocGraphic

Create a stroked ellipse LocGraphic - the implicit point is center. The ellipse is drawn with four Bezier curves.

The line properties (colour, pen thickness, etc.) are taken from the implicit DrawingContext.

dcREllipse :: InterpretUnit u => DrawMode -> u -> u -> LocThetaGraphic uSource

dcREllipse : x_radius * y_radius -> LocGraphic

Create a bordered ellipse LocThetaGraphic - the implicit point is center and the angle is rotation about the center. The ellipse is drawn with four Bezier curves.

The background fill colour and the outline stroke properties are taken from the implicit DrawingContext.

Rectangles

dcRectangle :: InterpretUnit u => DrawMode -> u -> u -> LocGraphic uSource

strokedRectangle : style * width * height -> LocGraphic

Create a stroked rectangle LocGraphic - the implicit point is bottom-left.

The line properties (colour, pen thickness, etc.) are taken from the implicit DrawingContext.

Disks

dcDisk :: InterpretUnit u => DrawMode -> u -> LocGraphic uSource

dcDisk : radius -> LocGraphic

Create a circle LocGraphic - the implicit point is the center.

This is a efficient representation of circles using PostScript's arc or SVG's circle in the generated output. However, stroked-circles do not draw well after non-uniform scaling - the pen width is scaled as well as the shape.

For stroked circles that can be adequately scaled, use dcCircle instead.

The fill or stroke properties for the respective DrawStyle are taken from the implicit DrawingContext.

dcEllipseDisk :: InterpretUnit u => DrawMode -> u -> u -> LocGraphic uSource

strokeEllipseDisk : x_radius * y_radius -> LocGraphic

Create a stroked ellipse LocGraphic - the implicit point is the center.

This is a efficient representation of circles using PostScript's arc or SVG's ellipse in the generated output. However, stroked ellipses do not draw well after non-uniform scaling - the pen width is scaled as well as the shape.

For stroked ellipses that can be adequately scaled, use strokedEllipse instead.

The line properties (colour, pen thickness, etc.) are taken from the implicit DrawingContext.

Arc

dcArc :: (Floating u, InterpretUnit u) => u -> Radian -> LocThetaGraphic uSource

dcArc : radius * apex_angle

Always open-stroked.