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

PortabilityGHC
Stabilityhighly unstable
MaintainerStephen Tetley <stephen.tetley@gmail.com>

Wumpus.Basic.Kernel.Base.UpdateDC

Contents

Description

Customize drawing attributes. The functions here are DrawingContext modifiers to be run within a the scope of a localize block (cf. local of the Reader monad).

By convention, underscore-separated names are used for DrawingContext modifiers in this module. This is because the modifiers defined here are expected to be used mostly as static "properties" resembling constants in drawings.

Synopsis

Globals

snap_grid_factors :: Double -> Double -> DrawingContextFSource

snap_grid_factors : x_unit * y_unit -> DrawingContextF

Set the snap grid factors - a snap grid is an alternative coordinate space, it can be convenient for drawing "box and arrow" diagrams.

Line widths

set_line_width :: Double -> DrawingContextFSource

set_line_width : width_in_points -> DrawingContextF

Set the line_width to the supplied point size.

Initially the line width is 1.0.

Constant variations of the function maybe be more convenient:

 line_default, line_thin, line_thick, line_ultra_thick

line_default :: DrawingContextFSource

Set the line_width to default - 1.0.

line_thin :: DrawingContextFSource

Set the line_width to thin - 0.5.

line_thick :: DrawingContextFSource

Set the line_width to thick - 2.0.

line_ultra_thick :: DrawingContextFSource

Set the line_width to ultra_thick - 4.0.

relative_line_width :: (FontSize -> Double) -> DrawingContextFSource

Set the line width to a size relative to the current font size. The size is calculated with the supplied function.

Line cap

cap_default :: DrawingContextFSource

Set the line_cap to the default which is butt.

This is a synonym for cap_butt.

cap_butt :: DrawingContextFSource

Set the line_cap to butt.

Butt chamfers off the stroke, flush to the end point.

This is the default.

  .-------.
  |=======|
  '-------'

cap_round :: DrawingContextFSource

Set the line_cap to round.

This rounds the end of the stroke and the visually the rounding slightly extends the length of the line.

  .-------.
 ( ======= )
  '-------'

cap_square :: DrawingContextFSource

Set the line_cap to square.

This squares off the end of the stroke, but visual extends the stroke by half the line width.

  .---------.
  | ======= |
  '---------'

Line join

join_default :: DrawingContextFSource

Set the line_join to the default which is miter.

This is a synonym for join_miter.

join_miter :: DrawingContextFSource

Set the line_join to miter.

This extends the joining line segments to form a sharp miter.

This is the default.

      /\
     /..\ 
    /./\.\
   /./  \.\
  /./    \.\

join_round :: DrawingContextFSource

Set the line_join to round.

This rounds off the corner of the joined line segments.

  \.\  
   \.\ 
    ,.)
   /./
  /./

join_bevel :: DrawingContextFSource

Set the line_join to round.

This bevels off the corner of the joined line segments with a notch.

      __
     /..\ 
    /./\.\
   /./  \.\
  /./    \.\

Dash pattern

set_dash_pattern :: DashPattern -> DrawingContextFSource

Set the dash pattern.

Initially the dash pattern is Solid.

solid_line :: DrawingContextFSource

Set the dash_pattern to solid - i.e. no dash pattern.

This is the default.

dotted_line :: DrawingContextFSource

Set the dash pattern to draw a dotted line.

A dot is actually a square - side length is equal to the line width.

The spacing between dots is 2 times the dot width.

packed_dotted :: DrawingContextFSource

Set the dash pattern to draw a tightly packed dotted line.

A dot is actually a square - side length is equal to the line width.

The spacing between dots is equal to the dot width.

loose_dotted :: DrawingContextFSource

Set the dash pattern to draw a loosely dotted line.

A dot is actually a square - side length is equal to the line width.

The spacing between dots is 4 times the dot width.

dashed_line :: DrawingContextFSource

Set the dash pattern to draw a dashed line.

The dash length is 3 times the line width, the spacing is 2 times the line width.

packed_dashed :: DrawingContextFSource

Set the dash pattern to draw a tightly packed, dashed line.

The dash length is 3 times the line width, the spacing is equal to the line width.

loose_dashed :: DrawingContextFSource

Set the dash pattern to draw a loosely dashed line.

The dash length is 3 times the line width, the spacing is 4 times the line width.

Font properties

font_attr :: FontDef -> Int -> DrawingContextFSource

Set the font attributes, point size and font face.

set_font :: FontDef -> DrawingContextFSource

Set the font face.

set_font_size :: Int -> DrawingContextFSource

Set the point size.

This controls the drawing size of both text labels and marks (e.g. dots and arrowheads).

scale_point_size :: Double -> DrawingContextFSource

Scale the current point size by the supplied ratio.

Note - as fonts can only be drawn at integral sizes this operation is not exact - for instance scaling 15pt by (1%2) results in 7pt.

double_point_size :: DrawingContextFSource

Set the point size (font and mark size) to double the current size.

half_point_size :: DrawingContextFSource

Set the point size to half the current size, note the point size also controls the size of dots, arrowsheads etc.

Note - as fonts can only be drawn at integral sizes this operation is not exact - half size of 15pt type is 7pt.

Text margins

text_margin :: Em -> Em -> DrawingContextFSource

text_margin : x_sep * y_sep -> DrawingContextF

Note - this is in Em units.

text_margin_none :: DrawingContextFSource

Set the text margin to (0,0).

This produces a tight box around the text vertically measured to the cap-height and descender. Therefore some characters may extend outside the margin (e.g. accented capitals like A-grave).

text_margin_tight :: DrawingContextFSource

Set the text margin to (0.25 em, 0.25 em).

text_margin_default :: DrawingContextFSource

Set the text margin to (0.5 em, 0.5 em).

text_margin_loose :: DrawingContextFSource

Set the text margin to (1.0 em, 1.0 em).

Colour

stroke_colour :: RGBi -> DrawingContextFSource

Set the stroke colour.

fill_colour :: RGBi -> DrawingContextFSource

Set the fill colour.

text_colour :: RGBi -> DrawingContextFSource

Set the text colour.

single_colour :: RGBi -> DrawingContextFSource

Set the stroke, fill and text colours to a single colour.

swap_colours :: DrawingContextFSource

Swap the stroke colour and fill colours.

fill_use_stroke_colour :: DrawingContextFSource

Set the fill colour to use the current stroke colour.

stroke_use_fill_colour :: DrawingContextFSource

Set the stroke colour to use the current fill colour.

fill_use_text_colour :: DrawingContextFSource

Set the fill colour to use the current text colour.

stroke_use_text_colour :: DrawingContextFSource

Set the stroke colour to use the current fill colour.

text_use_stroke_colour :: DrawingContextFSource

Set the text colour to use the current stroke colour.

text_use_fill_colour :: DrawingContextFSource

Set the text colour to use the current fill colour.

Connector Props

source_space :: (Ord u, InterpretUnit u) => u -> DrawingContextFSource

Set the connector source spacing.

The spacing is used as a projection along the line formed between connector points making the connection looser if required.

The default value is 0. Negative values are not allowed, they are normalized to 0.

dest_space :: (Ord u, InterpretUnit u) => u -> DrawingContextFSource

Set the connector destination spacing.

The spacing is used as a projection along the line formed between connector points making the connection looser if required.

The default value is 0. Negative values are not allowed, they are normalized to 0.

source_offset :: (Ord u, InterpretUnit u) => u -> DrawingContextFSource

Set the connector source offset.

The offset is used to shift the start point upwards perpendicular to its true origin (negative values are downwards). This can be used to draw a connector with two parallel lines, for example.

Upwards and downwards in this description are dependent on the direction of the line, of course. Generally the documentations consider lines are left-to-right unless specifically noted.

dest_offset :: (Ord u, InterpretUnit u) => u -> DrawingContextFSource

Set the connector destination offset.

See source_offset for an explanation.

uniform_conn_space :: (Ord u, InterpretUnit u) => u -> DrawingContextFSource

Set the connector source and destination spacings to the same length.

conn_arc_angle :: Radian -> DrawingContextFSource

Set the connector arc angle.

source_arm_len :: InterpretUnit u => u -> DrawingContextFSource

Set the connector source arm length.

dest_arm_len :: InterpretUnit u => u -> DrawingContextFSource

Set the connector destination arm length.

uniform_arm_len :: InterpretUnit u => u -> DrawingContextFSource

Set the connector source and destination arms to the same length.

conn_loop_size :: InterpretUnit u => u -> DrawingContextFSource

Set the connector loop size.

conn_box_halfsize :: InterpretUnit u => u -> DrawingContextFSource

Set the connector box halfsize.