Page 1 of 1
[Love2d Android] Wrong scaling of images
Posted: Sun Sep 22, 2019 6:01 am
by bhgt
I've been working with Love2d Android for some time now, and I've noticed that using a canvas for pixelated effect doesn't work according to the scale.
The attachment Screenshot_2019-09-22-10-42-17-767_org.love2d.android.png is no longer available
As shown in the attachement, the original character is of 16px height (for the character) but on rotating, each (image) pixel seems to be made of 4 (screen/canvas) pixels. I'm not sure if this is a problem with canvas, images, or Android, because even without a canvas, the low resolution images are displayed at higher scale than the actual resolution.
- Screenshot_2019-09-22-10-42-17-767_org.love2d.android.png (6.97 KiB) Viewed 2613 times
I tried checking the DPIScale of the image and it's 1.
I tried scaling the images to a scale of 0.5 and the pixels seem to be displayed correctly, somehow.
Is this scaling normal, or am I missing something?
Re: [Love2d Android] Wrong scaling of images
Posted: Sun Sep 22, 2019 11:34 am
by pgimeno
What version of LÖVE are you using?
Can you give more precise instructions to reproduce the problem? Preferably a short program demonstrating it.
Re: [Love2d Android] Wrong scaling of images
Posted: Sun Sep 22, 2019 4:29 pm
by zorg
It's just a hunch, but usually with this kind of issue, the culprit is usually the fact that while a canvas might indeed be low-resolution, but when the canvas itself gets rotated when it's drawn to the backbuffer (which i'm assuming is indeed of a higher resolution), the blockiness of the contents may not be preserved in some cases.
From the image, i'm guessing you're scaling the canvas first and then rotating (or maybe you're using such parameters with love.graphics.draw), for what i'm guessing you're after, you'd need to rotate first, then scale, to preserve blockiness, i think.
Re: [Love2d Android] Wrong scaling of images
Posted: Tue Sep 24, 2019 1:37 am
by AuahDark
LOVE Android operates on DPI-scale.
* When making new Canvas, Canvas expects the size to be DPI-scaled unless you pass {dpiscale=1} to the 3rd argument.
* When drawing image, the image is drawn in DPI-scaled units and not in pixels.