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

drawing canvas saving its image data blurred #8022

Closed
luckyrawatfreax opened this issue May 21, 2024 · 1 comment
Closed

drawing canvas saving its image data blurred #8022

luckyrawatfreax opened this issue May 21, 2024 · 1 comment
Assignees

Comments

@luckyrawatfreax
Copy link

when canvas data is saved and load it back on canvas makes it little nlurry each time we repeate this process.

Problem description

saving and loading canvas data blur it each time we save and load it. minimal file attached.

Attach a .c3p

canvas_blurr issue.zip

Steps to reproduce

  1. preview attached file
  2. draw something on canvas
  3. press save button
  4. press clear button
  5. press load button
  6. repeat 3-5 step 8-10 times

Observed result

image will start getting blurred

Expected result

shout maintain its quality

More details

Affected browsers/platforms:
Chrome, Windows11

First affected release:

System details

View details

PASTE HERE

@AshleyScirra AshleyScirra self-assigned this May 21, 2024
@AshleyScirra AshleyScirra added this to the Next release cycle milestone Jan 16, 2025
@AshleyScirra
Copy link
Member

This project has a problem in that it uses fractional display scaling with 'Letterbox scale'. In this case the Drawing Canvas may have a fractional size, and when that happens as it needs an integer number of pixels for the drawing surface, so it rounds the size up. For example if the width is calculated as 900.5 pixels, it allocates a 901 pixel wide surface. It then displays only the first 900.5 pixels of the 901 pixel wide surface (using fractional texture co-ordinates). The problem your project then encounters is that in this case it saves a 901 pixel wide image, loads it to a sprite, and then pastes the sprite over the drawing canvas at an effective size of 900.5 pixels - in other words a very small amount of resize, which accumulates to a blur.

The solution to this is to use either a fixed resolution canvas, or a non-fractional scaling mode like 'Letterbox integer scale'. However I did find that with 'Letterbox integer scale' the problem still occurred due to incorrect rounding of the surface size; that is fixed for the next release cycle (as per #8358 these bugs ought to have a full release cycle to test). But the unmodified project still will accumulate a blur over time due to the fractional sizing I mentioned; you'll still need to change the project to ensure it preserves quality.

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

No branches or pull requests

2 participants