Module: Magick::RVG::StructureConstructors
- Included in:
- Embellishable, Pattern
- Defined in:
- lib/rvg/embellishable.rb
Overview
Methods that construct container objects within a container
Instance Method Summary collapse
-
#g(&block) ⇒ Object
Defines a group.
-
#rvg(cols, rows, x = 0, y = 0, &block) ⇒ Object
Establishes a new viewport.
Instance Method Details
#g(&block) ⇒ Object
Defines a group.
This method constructs a new Group container object. The styles and transforms specified on this object will be used by objects contained within, unless overridden by an inner container or the contained object itself. Define grouped elements by calling RVG::Embellishable methods within the associated block.
357 358 359 360 361 |
# File 'lib/rvg/embellishable.rb', line 357 def g(&block) group = Group.new(&block) @content << group group end |
#rvg(cols, rows, x = 0, y = 0, &block) ⇒ Object
Establishes a new viewport. [x
, y
] is the coordinate of the upper-left corner within the containing viewport. This is a container method. Styles and transforms specified on this object will be used by objects contained within, unless overridden by an inner container or the contained object itself.
334 335 336 337 338 339 340 341 342 343 344 345 346 |
# File 'lib/rvg/embellishable.rb', line 334 def rvg(cols, rows, x = 0, y = 0, &block) rvg = Magick::RVG.new(cols, rows, &block) begin x = Float(x) y = Float(y) rescue ArgumentError args = [cols, rows, x, y] raise ArgumentError, "at least one argument is not convertable to Float (got #{args.collect {|a| a.class}.join(', ')})" end rvg.corner(x, y) @content << rvg rvg end |