| Module | Magick::RVG::ShapeConstructors |
| In: |
lib/rvg/embellishable.rb
|
Methods that construct basic shapes within a container
Draws a polygon. The arguments are [x, y] pairs that define the points that make up the polygon. At least two points must be specified. If the last point is not the same as the first, adds an additional point to close the polygon.
# File lib/rvg/embellishable.rb, line 314
314: def polygon(*points)
315: polygon = Polygon.new(*points)
316: @content << polygon
317: return polygon
318: end
Draws a polyline. The arguments are [x, y] pairs that define the points that make up the polyline. At least two points must be specified.
# File lib/rvg/embellishable.rb, line 323
323: def polyline(*points)
324: polyline = Polyline.new(*points)
325: @content << polyline
326: return polyline
327: end
Draws a rectangle whose upper-left corner is [x, y] and with the specified width and height. Unless otherwise specified the rectangle has square corners. Returns a Rectangle object.
Draw a rectangle with rounded corners by calling the round method on the Rectangle object. rx and ry are the corner radii in the x- and y-directions. For example:
canvas.rect(width, height, x, y).round(8, 6)
If ry is omitted it defaults to rx.
# File lib/rvg/embellishable.rb, line 303
303: def rect(width, height, x=0, y=0)
304: rect = Rect.new(width, height, x, y)
305: @content << rect
306: return rect
307: end