You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Setting the dimension of a ex.Canvas to 200x200 forces it to 256x256, this is unexpected to users. If we need power of two images it should be handled internally not leaked to the user.
There does seem to be a bug in the current ex.Canvas which forces the dimensions to be the next greatest power of 2 size. We should be able to fix ex.Canvas to allow arbitrary width/height before we release the next version of excalibur this week 👍
Here is a workaround to center the ex.Canvas in that snippet:
constcanvas=newex.Canvas({width: 256,height: 256,cache: true,// If true draw once until flagged dirty again, otherwise draw to Canvas every framedraw: (ctx)=>{console.log('With cache=true I draw once');ctx.fillStyle='red';ctx.fillRect(56/2,56/2,200,200);}})
Expected Result
ex.Canvas dimension should have been 200x200
Actual Result
ex.Canvas was unexpectedly 256x256
Environment
browsers and versions: NA
operating system: NA
Excalibur versions: v0.26.0
Current Workaround
Compensate by setting the ex.Canvas to a power of two, then offset to center.
The text was updated successfully, but these errors were encountered:
eonarheim
added
the
bug
This issue describes undesirable, incorrect, or unexpected behavior
label
Jul 7, 2022
…2404)
Closes#2403
## Changes:
- Removes unnecessary POT enforcement in the `ex.Raster` base class
- Removes all power of two code, webgl2 doesn't need this anymore
Steps to Reproduce
Setting the dimension of a ex.Canvas to 200x200 forces it to 256x256, this is unexpected to users. If we need power of two images it should be handled internally not leaked to the user.
There does seem to be a bug in the current
ex.Canvas
which forces the dimensions to be the next greatest power of 2 size. We should be able to fixex.Canvas
to allow arbitrary width/height before we release the next version of excalibur this week 👍Here is a workaround to center the ex.Canvas in that snippet:
Expected Result
ex.Canvas dimension should have been 200x200
Actual Result
ex.Canvas was unexpectedly 256x256
Environment
Current Workaround
Compensate by setting the ex.Canvas to a power of two, then offset to center.
The text was updated successfully, but these errors were encountered: