Class: SVG::Transform

Inherits:
Object
  • Object
show all
Defined in:
lib/svg/transform.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) scale(xscale, yscale = xscale)

Sets the x- and y-axis scaling factors.

See: www.w3.org/TR/SVG/coords.html#TransformAttribute



10
11
12
# File 'lib/svg/transform.rb', line 10

def scale(xscale, yscale = xscale)
  transform[:scale] = [xscale, yscale]
end

- (String) to_s



25
26
27
28
29
# File 'lib/svg/transform.rb', line 25

def to_s
  transform.map do |key, values|
    "%s(%s)" % [key, values.join(", ")]
  end.join " "
end

- (Hash) transform



32
33
34
# File 'lib/svg/transform.rb', line 32

def transform
  @transform ||= {}
end

- (Object) translate(x, y = 0)

Sets the x- and y-axis translation positions.

See: www.w3.org/TR/SVG/coords.html#TransformAttribute



20
21
22
# File 'lib/svg/transform.rb', line 20

def translate(x, y = 0)
  transform[:translate] = [x, y]
end