User Guide
Ruby Component
Scaling
The custom line cap scales proportionally to the pen size. The default is for this to scale 1:1. You can change this by using the
setWidthScale method of the CustomLineCap class. Setting this to 2 for example, would make the cap be double the size it would be
normally at whatever pen width. The width of the pen used to stroke the path would also be double the pen width.
Join and Caps for the Path
Going into even more detail, you can even set the end caps for the custom line cap itself. Use the setStrokeCaps method of
CustomLineCap. This takes two parameters, a cap for the start of the path and a cap for the end of the path. These are strings and can be
one of the following:
“square”, “round”, “triangle”
The join style can also be set by using the setStrokeJoin method. This takes a single string to define the join style and can be one of:
“bevel”, “round”, “miterclipped”
The example below shows these methods being used. Note that the end cap and join styles only apply to stroked paths. If you use a filled
path for your custom end cap then these are ignored.
147 of 212