Module: Magick::RVG::Stretchable
Overview
The methods in this module describe the user-coordinate space. Only RVG objects are stretchable.
Instance Method Summary collapse
-
#viewbox(x, y, width, height) {|_self| ... } ⇒ Object
Describe a user coordinate system to be imposed on the viewbox.
Methods included from PreserveAspectRatio
Instance Method Details
#viewbox(x, y, width, height) {|_self| ... } ⇒ Object
Describe a user coordinate system to be imposed on the viewbox. The arguments must be numbers and the width
and height
arguments must be positive.
132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/rvg/stretchable.rb', line 132 def viewbox(x, y, width, height) begin @vbx_x = Float(x) @vbx_y = Float(y) @vbx_width = Float(width) @vbx_height = Float(height) rescue ArgumentError raise ArgumentError, "arguments must be convertable to float (got #{x.class}, #{y.class}, #{width.class}, #{height.class})" end raise(ArgumentError, "viewbox width must be > 0 (#{width} given)") unless width >= 0 raise(ArgumentError, "viewbox height must be > 0 (#{height} given)") unless height >= 0 yield(self) if block_given? self end |