Method: Magick::RVG::Transformable#translate

Defined in:
lib/rvg/transformable.rb

#translate(tx, ty = nil) {|_self| ... } ⇒ Object

Add tx to all x-coordinates and ty to all y-coordinates. If ty is omitted it defaults to tx.

Yields:

  • (_self)

Yield Parameters:

[View source]

59
60
61
62
63
64
65
66
67
68
# File 'lib/rvg/transformable.rb', line 59

def translate(tx, ty=nil)
    ty ||= tx
    begin
        @transforms << [:translate, [Float(tx), Float(ty)]]
    rescue ArgumentError
        raise ArgumentError, "arguments must be convertable to float (got #{tx.class}, #{ty.class})"
    end
    yield(self) if block_given?
    self
end