Methods that construct basic shapes within a container
Draws a circle whose center is [cx, cy] and radius is r.
# File lib/rvg/embellishable.rb, line 264 264: def circle(r, cx=0, cy=0) 265: circle = Circle.new(r, cx, cy) 266: @content << circle 267: return circle 268: end
Draws an ellipse whose center is [cx, cy] and having a horizontal radius rx and vertical radius ry.
# File lib/rvg/embellishable.rb, line 272 272: def ellipse(rx, ry, cx=0, cy=0) 273: ellipse = Ellipse.new(rx, ry, cx, cy) 274: @content << ellipse 275: return ellipse 276: end
Draws a line from [x1, y1] to [x2, y2].
# File lib/rvg/embellishable.rb, line 279 279: def line(x1=0, y1=0, x2=0, y2=0) 280: line = Line.new(x1, y1, x2, y2) 281: @content << line 282: return line 283: end
Draws a path defined by an SVG path string or a PathData object.
# File lib/rvg/embellishable.rb, line 287 287: def path(path) 288: path = Path.new(path) 289: @content << path 290: return path 291: end
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 # 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
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.