-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add setTransform method to CanvasPattern #1623
Conversation
I would suggest you add a small visual example to the list of examples available here: https://github.com/Automattic/node-canvas/blob/master/test/public/tests.js#L433 they are not official tests, but helps to compare how things go compared to browsers. |
@@ -389,6 +389,7 @@ Context2d::fill(bool preserve) { | |||
cairo_set_source(_context, new_pattern); | |||
cairo_pattern_destroy(new_pattern); | |||
} else { | |||
cairo_pattern_set_filter(state->fillPattern, state->patternQuality); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
patterQuality isn't really a canvas feature.
I think, but i may be wrong, it is used to simulate imageSmoothingEnabled property.
In canvas pattern quality is always best, there is no other option.
In case this change is ok, then it should be applied also to the stroke part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now applied to the stroke as well
Is there any timeline on getting this merged? This would be very nice to have. |
@asturur, @zbjornson What's preventing this from being merged? Anything we can help with? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, sorry for the delay in getting this reviewed!
@LinusU Need upgrading on npm, pls. |
As noted in #1411, CanvasPattern objects should accept a transformation matrix to be applied before the canvas's CTM. The one wrinkle is that cairo's conception of a pattern matrix is that it transforms from user- to pattern-space while canvas's is the reverse. As a result, the DOMMatrix passed to the method is inverted before being applied to the cairo pattern.