Method: Prawn::Graphics::Transformation#transformation_matrix

Defined in:
lib/prawn/graphics/transformation.rb

#transformation_matrix(*matrix) { ... } ⇒ void

This method returns an undefined value.

Transform the user space (see notes for rotate regarding graphics state) Generally, one would use the #rotate, #scale, and #translate convenience methods instead of calling transformation_matrix directly

Parameters:

  • matrix (Array(Number, Number, Number, Number, Number, Number))

    Transformation matrix.

    The six elements correspond to the following elements of the transformation matrix:

    “‘plain a b 0 c d 0 e f 0 “`

Yields:



154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/prawn/graphics/transformation.rb', line 154

def transformation_matrix(*matrix)
  if matrix.length != 6
    raise ArgumentError,
      'Transformation matrix must have exacty 6 elements'
  end
  save_graphics_state if block_given?

  add_to_transformation_stack(*matrix)

  values = PDF::Core.real_params(matrix)
  renderer.add_content("#{values} cm")
  if block_given?
    yield
    restore_graphics_state
  end
end