Method: PDF::Writer::Graphics#transform_matrix

Defined in:
lib/pdf/writer/graphics.rb

#transform_matrix(a, b, c, d, e, f) ⇒ Object

Transforms the coordinate axis with the appended matrix. All transformations (including those above) are performed with this matrix. The transformation matrix is:

+-     -+
| a c e |
| b d f |
| 0 0 1 |
+-     -+

The six values are represented as a six-digit vector: [ a b c d e f ]

  • Axis translation uses [ 1 0 0 1 x y ] where x and y are the new (0,0) coordinates in the old axis system.

  • Scaling uses [ sx 0 0 sy 0 0 ] where sx and sy are the scaling factors.

  • Rotation uses [ cos(a) sin(a) -sin(a) cos(a) 0 0 ] where a is the angle, measured in radians.

  • X axis skewing uses [ 1 0 tan(a) 1 0 0 ] where a is the angle, measured in radians.

  • Y axis skewing uses [ 1 tan(a) 0 1 0 0 ] where a is the angle, measured in radians.



810
811
812
# File 'lib/pdf/writer/graphics.rb', line 810

def transform_matrix(a, b, c, d, e, f)
  add_content("\n%.3f %.3f %.3f %.3f %.3f %.3f cm" % [ a, b, c, d, e, f ])
end