Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pattern/Shading transformation matrix issues #10955

Closed
brendandahl opened this issue Jul 8, 2019 · 1 comment
Closed

Pattern/Shading transformation matrix issues #10955

brendandahl opened this issue Jul 8, 2019 · 1 comment

Comments

@brendandahl
Copy link
Contributor

Currently, when we paint patterns/shadings we apply a base transform then apply the pattern's matrix. This isn't technically correct, instead we should leave the current transform applied and instead use pattern.setTransform. Something like:

matrix =  ctx.mozCurrentTransformInverse;
if (!svgElement) {
  svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
}
let mtx = svgElement.createSVGMatrix();
mtx.a = matrix[0];
mtx.b = matrix[1];
mtx.c = matrix[2];
mtx.d = matrix[3];
mtx.e = matrix[4];
mtx.f = matrix[5];
mtx = mtx.translate(clipped.offsetX, clipped.offsetY);
pattern.setTransform(mtx); 
@brendandahl
Copy link
Contributor Author

A good PDF for testing this:
#6769 (comment)
And also another PDF that is the same as above but with a pattern matrix of [2, 0, 0, 2, 0, 0] that illuminates some other issues as well:
issue6769_no_matrix.pdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants