def rotate(angle, options={}, &block)
Prawn.verify_options(:origin, options)
rad = degree_to_rad(angle)
cos = Math.cos(rad)
sin = Math.sin(rad)
if options[:origin].nil?
transformation_matrix(cos, sin, -sin, cos, 0, 0, &block)
else
raise Prawn::Errors::BlockRequired unless block_given?
x = options[:origin][0] + bounds.absolute_left
y = options[:origin][1] + bounds.absolute_bottom
x_prime = x * cos - y * sin
y_prime = x * sin + y * cos
translate(x - x_prime, y - y_prime) do
transformation_matrix(cos, sin, -sin, cos, 0, 0, &block)
end
end
end