class Magick::RVG::Image

Public Class Methods

new(image, width = nil, height = nil, x = 0, y = 0) click to toggle source

Composite a raster image in the viewport defined by [x,y] and width and height. Use the RVG::ImageConstructors#image method to create Text objects in a container.

Calls superclass method Magick::RVG::Describable::new
# File lib/rvg/embellishable.rb, line 216
def initialize(image, width = nil, height = nil, x = 0, y = 0)
  super()             # run module initializers
  @image = image.copy # use a copy of the image in case app. re-uses the argument
  @x, @y, @width, @height = Magick::RVG.convert_to_float(x, y, width || @image.columns, height || @image.rows)
  raise ArgumentError, 'width, height must be >= 0' if @width < 0 || @height < 0

  init_viewbox
end

Public Instance Methods

add_primitives(gc) click to toggle source

@private

# File lib/rvg/embellishable.rb, line 226
def add_primitives(gc)
  # Do not render if width or height is 0
  return if @width.zero? || @height.zero?

  gc.push
  add_transform_primitives(gc)
  add_style_primitives(gc)
  add_composite_primitive(gc)
  gc.pop
end