-
Notifications
You must be signed in to change notification settings - Fork 448
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
Document the relationship between offscreen canvas and pixel density #2336
Comments
yes this is very likely:
Could you share the example with me? |
@wcandillon Here is the code. You can see the density issue and paint stroke goes different if setting strokeWidth is skipped on the two textures. I attached the result image (above: offscreen, below: pictureRecorder) and code. Thanks :) Versions:
|
I think this is the expected result. const pd = PixelRatio.get();
const offscreen = useDerivedValue(() => {
const off = Skia.Surface.MakeOffscreen(
stageWidth * pd,
stageHeightHalf * pd
)!;
const canvas = off.getCanvas();
canvas.scale(pd, pd);
drawBalls(canvas);
canvas.restore();
return off.makeImageSnapshot();
}, []); |
@wcandillon Nice :) Thanks for the insight ! 🥰 |
@wcandillon Oh I have a question, so you are planning to fix this offscreen density issue to make users don't need to add the pixel density configuration for offscreen canvas? |
I don't think it makes sense to add it in this API because the offscreen API has nothing to do with the screen. |
Got it! Thanks 🙏🥰 |
What we will do as a first step is document this better. |
I'm closing it for now, as the current situation seems to make sense. |
Yes, it does appear when using useTexture |
Description
As reported in #1811
Version
latest
Steps to reproduce
Draw an offscreen canvas on a high-density screen. Take a screenshot and compare the image to the same drawing on an onscreen canvas.
Snack, code example, screenshot, or link to a repository
See #1811
The text was updated successfully, but these errors were encountered: