Class: Savage::Directions::HorizontalTo

Inherits:
CoordinateTarget show all
Defined in:
lib/ext/savage/lib/savage/directions/horizontal_to.rb

Instance Attribute Summary

Attributes inherited from CoordinateTarget

#target

Attributes inherited from Savage::Direction

#absolute

Instance Method Summary collapse

Methods inherited from CoordinateTarget

#initialize, #to_a

Methods inherited from Savage::Direction

#absolute?, #initialize, #relative?, #to_command

Methods included from Transformable

#rotate, #scale, #skew_x, #skew_y, #translate

Methods included from Utils

#bool_to_int

Constructor Details

This class inherits a constructor from Savage::Directions::CoordinateTarget

Instance Method Details

#command_codeObject



4
5
6
# File 'lib/ext/savage/lib/savage/directions/horizontal_to.rb', line 4

def command_code
  (absolute?) ? 'H' : 'h'
end

#transform(scale_x, skew_x, skew_y, scale_y, tx, ty) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/ext/savage/lib/savage/directions/horizontal_to.rb', line 8

def transform(scale_x, skew_x, skew_y, scale_y, tx, ty)

  unless skew_y.zero?
    raise 'rotating or skewing (in Y axis) an "horizontal_to" direction is not supported yet.'
  end
  
  self.target *= scale_x
  self.target += tx if absolute?
end