class Magick::RVG::Group

Define a collection of shapes, text, etc. that can be reused. Group objects are containers. That is, styles and transforms defined on the group are used by contained objects such as shapes, text, and nested groups unless overridden by a nested container or the object itself. Groups can be reused with the RVG::UseConstructors#use method. Create groups within containers with the RVG::StructureConstructors#g method.

Example:

# All elements in the group will be translated by 50 in the
# x-direction and 10 in the y-direction.
rvg.g.translate(50, 10).styles(:stroke=>'red',:fill=>'none') do |grp|
    # The line will be red.
    grp.line(10,10, 20,20)
    # The circle will be blue.
    grp.circle(10, 20, 20).styles(:stroke=>'blue')
end

Public Class Methods

new() { |self| ... } click to toggle source
Calls superclass method Magick::RVG::Describable::new
# File lib/rvg/container.rb, line 62
def initialize
  super
  @content = Content.new
  yield(self) if block_given?
end

Public Instance Methods

<<(obj) click to toggle source

Append an arbitrary object to the group’s content. Called by use to insert a non-container object into a group. @private

# File lib/rvg/container.rb, line 86
def <<(obj)
  @content << obj
end
add_primitives(gc) click to toggle source

@private

# File lib/rvg/container.rb, line 69
def add_primitives(gc)
  gc.push
  add_transform_primitives(gc)
  add_style_primitives(gc)
  @content.each { |element| element.add_primitives(gc) }
  gc.pop
end
ref(x, y, _width, _height) click to toggle source

Translate container according to use arguments @private

# File lib/rvg/container.rb, line 79
def ref(x, y, _width, _height)
  translate(x, y) if x != 0 || y != 0
end