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

fix(node-canvas): imageSmoothing setter #8032

Merged
merged 2 commits into from
Jun 30, 2022

Conversation

ShaMan123
Copy link
Contributor

@ShaMan123 ShaMan123 commented Jun 29, 2022

fixes #8030
override default patternQuality from good to best for node canvas
https://github.com/Automattic/node-canvas/blob/0bccc05b384cc1f3e969cd9ed7859a95376ec88c/src/CanvasRenderingContext2d.cc#L1479

Should we expose a way to control patternQuality? Should it be set on if imageSmoothing is enabled?

Seems this prop doesn't exist on the browser. The only thing I found that comes near is https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/imageSmoothingQuality

@github-actions
Copy link
Contributor

github-actions bot commented Jun 29, 2022

Code Coverage Summary

> [email protected] coverage:report
> nyc report --reporter=lcov --reporter=text

-----------|---------|----------|---------|---------|-----------------------------------------------
File       | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                             
-----------|---------|----------|---------|---------|-----------------------------------------------
All files  |    83.2 |    76.17 |   85.85 |   82.93 |                                               
 fabric.js |    83.2 |    76.17 |   85.85 |   82.93 | ...,30851,30925,30936-31001,31124,31223,31459 
-----------|---------|----------|---------|---------|-----------------------------------------------

@@ -755,6 +755,7 @@
this.calcViewportBoundaries();
this.clearContext(ctx);
fabric.util.setImageSmoothing(ctx, this.imageSmoothingEnabled);
ctx.patternQuality = 'best';
Copy link
Contributor Author

@ShaMan123 ShaMan123 Jun 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe fast as default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast isn't good enough
look at the diff between best and fast
image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

objectsInActiveSelections

objectsInActiveSelections

@ShaMan123 ShaMan123 requested a review from asturur June 29, 2022 07:39
@asturur
Copy link
Member

asturur commented Jun 30, 2022

is a node-canvas non standard property, that control some cairo parameters.
I m fine leaving it in a way that satisfy most expectations, but i don't want to add logic around that ( when to set best or fast )

@asturur asturur merged commit edc9075 into master Jun 30, 2022
@ShaMan123 ShaMan123 deleted the fix-node-image-smoothing-setter branch September 11, 2022 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scaling up very small image behaves differently in browser vs Node
2 participants