3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/prawn/svg/extensions/additional_gradient_transforms.rb', line 3
def gradient_coordinates(gradient)
if gradient.apply_transformations.is_a?(Array)
x1, y1, x2, y2, transformation = super
a, b, c, d, e, f = transformation
na, nb, nc, nd, ne, nf = gradient.apply_transformations
matrix = Matrix[[a, c, e], [b, d, f], [0, 0, 1]] * Matrix[[na, nc, ne], [nb, nd, nf], [0, 0, 1]]
new_transformation = matrix.to_a[0..1].transpose.flatten
[x1, y1, x2, y2, new_transformation]
else
super
end
end
|