Class Magick::RVG::Rect
In: lib/rvg/embellishable.rb
Parent: Shape
Enum GeometryValue Stylable RVG\n[lib/rvg/clippath.rb\nlib/rvg/container.rb\nlib/rvg/deep_equal.rb\nlib/rvg/describable.rb\nlib/rvg/embellishable.rb\nlib/rvg/misc.rb\nlib/rvg/paint.rb\nlib/rvg/pathdata.rb\nlib/rvg/rvg.rb\nlib/rvg/stretchable.rb\nlib/rvg/stylable.rb\nlib/rvg/text.rb\nlib/rvg/transformable.rb\nlib/rvg/units.rb] Transformable Stretchable Embellishable Describable Duplicatable Comparable Image ImageList Array Geometry HatchFill Draw lib/RMagick.rb lib/rvg/misc.rb Application ObjectData Pre_ObjectData_Descriptor Envelope Post_ObjectData_Descriptor IPTC Magick dot/m_14_0.png

Methods

new   round  

Public Class methods

Define a width x height rectangle. The upper-left corner is at [x, y]. If either width or height is 0, the rectangle is not rendered. Use the RVG::ShapeConstructors#rect method to create Rect objects in a container.

[Source]

    # File lib/rvg/embellishable.rb, line 91
91:             def initialize(width, height, x=0, y=0)
92:                 super()
93:                 width, height, x, y = Magick::RVG.convert_to_float(width, height, x, y)
94:                 if width < 0 || height < 0
95:                     raise ArgumentError, "width, height must be >= 0 (#{width}, #{height} given)"
96:                 end
97:                 @args = [x, y, x+width, y+height]
98:                 @primitive = :rectangle
99:             end

Public Instance methods

Specify optional rounded corners for a rectangle. The arguments are the x- and y-axis radii. If y is omitted it defaults to x.

[Source]

     # File lib/rvg/embellishable.rb, line 103
103:             def round(rx, ry=nil)
104:                 rx, ry = Magick::RVG.convert_to_float(rx, ry || rx)
105:                 if rx < 0 || ry < 0
106:                     raise ArgumentError, "rx, ry must be >= 0 (#{rx}, #{ry} given)"
107:                 end
108:                 @args << rx << ry
109:                 @primitive = :roundrectangle
110:                 self
111:             end

[Validate]