In Files

Parent

Pen

A pen is a drawing instrument for drawing lines. As well as simple parameters such as thickness and colour, a massive variety of styles can be created - including dashed lines, arrowheads, and different junction and corner styles.

Once defined, a pen can be used to draw simple lines, complex curves or the outlines to solid shapes.

Public Class Methods

new(Color, width) → Pen click to toggle source

Creates a new Pen object of the given color, with the Float value width setting the width of the line that the Pen will draw. Width is measured in 'grid' units (by default 8 pixels, as seen on the 'graph paper' background of the FlowStone workspace).

Further attributes can be set by calling other methods on the Pen object once it has been created.

# File GUI_Classes.rb, line 110
def self.new
  #DUMMY
end

Public Instance Methods

getWidth → Float click to toggle source

Returns the current width of the Pen as a Float measured in 'grid' units.

# File GUI_Classes.rb, line 139
def getWidth
  #DUMMY
end
resetTransform click to toggle source

If the Pen is using start and/or end caps, and these have been resized using the scaleTransform method, calling resetTransform will reset the cap size to the default value.

See also setStartCap, setEndCap, scaleTransform

# File GUI_Classes.rb, line 301
def resetTransform
  #DUMMY
end
scaleTransform(Float) click to toggle source

If 'anchor' style start and/or end caps have been set for a pen, this method can be used to scale the end caps to make the anchors the desired size. The value is a scale factor, where 1.0 is equivalent to the default size, smaller values decrease the size, larger values scale it up.

See also setStartCap, setEndCap, resetTransform.

# File GUI_Classes.rb, line 288
def scaleTransform
  #DUMMY
end
setAlignment(Integer/String) click to toggle source

This sets how the pen will align itself when drawing the outline of a closed shape (e.g. a closed GraphicsPath object). There are two options, each of which can be chosen either using an Integer index or a String descriptions...

  • 0 or "centre" -> The centreline of the pen will follow the shape's outline. This means that part of the line will fall outside the shape defined by the path. This is the default setting for a new Pen.

  • 1 or 'inset' -> The Pen is aligned so that its outer edge follows the shape's outline - thus keeping the whole of the line within the boundary defined by the shape.

# File GUI_Classes.rb, line 157
def setAlignment
  #DUMMY
end
setBrush(brush) click to toggle source

Rather than drawing a line in solid color, it is also possible to use any of the wide variety of brushes that FlowStone can define - LinearGradientBrush, PathGradientBrush, HatchBrush or TextureBrush. To do this, simple call setBrush with an appropriately defined brush object.

# File GUI_Classes.rb, line 234
def setBrush
  #DUMMY
end
setColor(Color) click to toggle source

Set a new colour for the Pen object. This can save CPU time compared to making a whole new Pen and garbage collecting the old one.

# File GUI_Classes.rb, line 130
def setColor
  #DUMMY
end
setCustomEndCap(CustomLineCap) click to toggle source

Works just as for setEndCap, but using an instance of the CustomLineCap class rather than one of the built-in line cap styles.

See also setEndCap

# File GUI_Classes.rb, line 325
def setCustomEndCap
  #DUMMY
end
setCustomStartCap(CustomLineCap) click to toggle source

Works just as for setStartCap, but using an instance of the CustomLineCap class rather than one of the built-in line cap styles.

See also setStartCap

# File GUI_Classes.rb, line 313
def setCustomStartCap
  #DUMMY
end
setDashCaps(Integer/String) click to toggle source

Determines how individual dashes and dots are drawn when using a broken line style (see setDashStyle). The option is set using either an Integer index or a short String descriptor...

  • 0 or 'flat' -> The default - dashes and dots are cut perpendicular to the line.

  • 1 or 'round' -> Blunt, rounded end caps.

  • 2 or 'triangle' -> Diamond or 'chevron' shaped.

# File GUI_Classes.rb, line 222
def setDashCaps
  #DUMMY
end
setDashStyle(Integer/String) click to toggle source

Defines the style (if any) of dashes or dots with which to draw lines with the pen. The option is set using either an Integer index or a short String descriptor...

  • 0 or 'none' -> Solid lines - no dashes or dots. The default Pen setting.

  • 1 or 'dash' -> Dashes only.

  • 2 or 'dot' -> Dots only.

  • 3 or 'dashdot' -> Dashes separated by single dots.

  • 4 or 'dashdotdot' -> Dashes separated by double dots.

The style with which individual dashes and dots are drawn is set by the setDashCaps method.

# File GUI_Classes.rb, line 208
def setDashStyle
  #DUMMY
end
setEndCap(String) click to toggle source

If a pen is used to draw lines (open shapes), as opposed to a closed shape, this method will set how the end of the line should be drawn. The style is chosen using a short String desciptor from the following list...

"square", "round", "triangle", "noanchor", "squareanchor", "roundanchor", "diamondanchor", "arrowanchor".

The default is "square" - cut off prependicular to the line direction. "Anchor" types have an enlarged 'handle' at the end of the line. See page 187 of the User Guide for illustrations of the differnet styles.

See also setStartCap, scaleTransform, resetTransform

# File GUI_Classes.rb, line 274
def setEndCap
  #DUMMY
end
setLineJoin(Integer/String) click to toggle source

Determines how the pen will draw the angle where two straight lines join. As this is rather hard to describe in words, refer to page 183 of the User Guide where these are shown very clearly in a set of diagrams.

The kind of joins to use may be set using either an Integer index or a short String description...

  • 0 or 'mitre' -> Outlines are extended until they cross - can result in very long 'points' at acute corners. This is the default for a new Pen.

  • 1 or 'bevel' -> The corner is flattened off.

  • 2 or 'round' -> A smooth radiused curve is used.

  • 3 or 'mitreclipped' -> Similar to 'mitre', but overly long points are cut short. The degree of clipping is defined by the setMitreLimit method.

# File GUI_Classes.rb, line 178
def setLineJoin
  #DUMMY
end
setMitreLimit(Float) click to toggle source

Set the limit beyond which mitred corners will be clipped off when using the 'mitreclipped' form of line joins (see setLineJoin, option 3). This is a Float value representing a multiple of the line width. See page 184 of the User Guide for a helpful diagram.

# File GUI_Classes.rb, line 190
def setMitreLimit
  #DUMMY
end
setStartCap(String) click to toggle source

If a pen is used to draw lines (open shapes), as opposed to a closed shape, this method will set how the start of the line should be drawn. The style is chosen using a short String desciptor from the following list...

"square", "round", "triangle", "noanchor", "squareanchor", "roundanchor", "diamondanchor", "arrowanchor".

The default is "square" - cut off prependicular to the line direction. "Anchor" types have an enlarged 'handle' at the end of the line. See page 187 of the User Guide for illustrations of the different styles.

See also setEndCap, scaleTransform, resetTransform

# File GUI_Classes.rb, line 254
def setStartCap
  #DUMMY
end
setWidth(width) click to toggle source

Set a new width for the Pen object. Width is a Float measured in the current 'grid' units.

# File GUI_Classes.rb, line 120
def setWidth
  #'DUMMY
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.