Canvas Creation Methods
To place graphic elements in a canvas, there are several item creation methods:
createArcCreates an arc contained within the given bounding box. For example, to create an oval bounded by the box from (0,0) to (40,100):
$canvas->createArc(0,0,40,100, -extent => 360);
The
-extentoption gives a number between 0 and 360 defining the length of the arc. The default-extentis90, or 1/4 of an oval; an extent of360gives you a full oval. The complete list of options tocreateArcis:-extent =>degreesCreates an arc of the specified extent.
degreescan be any number between 0 and 360, as described above.-fill =>colorFills the arc with the specified color.
-outline =>colorDraws the arc with the specified color (default is
black).-outlinestipple =>bitmapDraws the outline with the specified bitmap pattern.
-start =>degreesStarts drawing the arc from the specified position, which is represented by a number from 0 to 360. The default is
0, which means to start drawing at the 3 o’clock position.-stipple =>bitmapUses the specified bitmap to fill the arc (if
-fillis also specified).-style =>typeDraws the arc as specified. Values are:
piesliceDraws lines from the center to the ends of the arc (the default)
chordDraws a line connecting the two ends of the arc
arcDraws the arc with no other lines
-tags =>tagnamesAssociates the arc with the specified tag(s). Multiple tag names can be supplied as an anonymous list.
-width =>amountThe width of the outline. Default is
1.
createBitmap ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access