Object
Custom line caps allow you to define your own custom shapes for line start and end caps - for example to create your own shape of arrowhead. To use a CustomLineCap, you must first assign it to a Pen object using the setCustomStartCap and setCustomEndCap methods.
The shape is defined using a GraphicsPath object. When defining the a GraphicsPath for a custom line cap, the co-ordinate system works a little differently that usual...
The 'origin' co-ordinate [0.0, 0.0] represent the end point of the line to be capped.
The positive x-axis represents the direction that the line is pointing. Ths shape will be automatically rotated to point in the direction of whatever line is is capping.
The 'grid size' represents the dimensions of the line cap for a one unit wide line thickness. When the cap is drawn, it will be scaled relative to this according to the actual line thickness (unless the setWidthScale method has been used to alter the scaling.
Create a new CustomLineCap. The given GraphicsPath defines the shape of the new cap according to the class notes above. Offset (a Float number) shifts the line cap by the given number of grid units in the direction that the line is pointing.
If the GraphicsPath argument is preceded by 'nil', the cap will be drawn as an unfilled outline using the same pen as the line which it is capping. If the GraphicsPath is followed by 'nil', the cap will be drawn as a solid filled shape.
See pg.189 of the User Guide for some helpful diagrams showing how a custom line cap relates to the line which it is capping.
# File GUI_Classes.rb, line 368 def self.new #DUMMY end
If the custom line cap is to be drawn as an unfilled shape, calling setStrokeCaps defines how any drawn strokes are capped. The first argument defines how the start of a stroke is capped, and the second argument defines how the end of strokes are capped. Each takes a short string descriptor from the following list...
"square", "round", "triangle"
See pg.190 of the User Guide for a more detailed description.
# File GUI_Classes.rb, line 397 def setStrokeCaps #DUMMY end
If the custom line cap is to be drawn as an unfilled shape, calling setStrokeJoin defines how straight lines are joined for the cap's shape. The single argument is a short String descriptor from the following list...
"bevel", "round", "mitreclipped"
See pg.190 of the User Guide for a more detailed description.
# File GUI_Classes.rb, line 412 def setStrokeJoin #DUMMY end
This method is used to scale a line cap. A setting of 1.0 will draw the cap at the size at which it was originally defined (NB - this is relative to the thickness of the Pen that it is capping). A value of 0.5 would halve the size; 2.0 would double the size; and so on...
# File GUI_Classes.rb, line 380 def setWidthScale #DUMMY end
Generated with the Darkfish Rdoc Generator 2.