Advanced game related topics
ricardo_sdl
 
Posts: 9
Joined: Fri Jan 10, 2020 12:30 pm

How to set imageSmoothingEnabled to false?

by ricardo_sdl Fri Feb 14, 2020 7:50 pm

I think that imageSmoothingEnabled is making all the pixels look pretty ugly. Is there any way in SpiderBasic that I can set it to false?
Thanks.
User avatar
Peter
 
Posts: 671
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080

Re: How to set imageSmoothingEnabled to false?

by Peter Fri Feb 14, 2020 9:59 pm

I'm not so familiar with drawing a picture on a canvas. Can you provide a small example?
ricardo_sdl
 
Posts: 9
Joined: Fri Jan 10, 2020 12:30 pm

Re: How to set imageSmoothingEnabled to false?

by ricardo_sdl Sun Feb 16, 2020 2:46 am

After taking a look on the generated javascript code and the PixiJS library used by SpiderBasic, I think I got it. Here:
https://imgur.com/a/8FQ5tBd
You can see the differences in visual that I was getting when running on PureBasic and SpiderBasic.

It seems to involve the function SpriteQuality, which changes how the sprites are rendered when zoomed, rotated etc. The documentation says:
#PB_Sprite_NoFiltering : No filtering, faster but ugly when zooming/rotating (default).
#PB_Sprite_BilinearFiltering: Bilinear filtering, slower but clean when zooming/rotating.

I understood that changing SpriteQuality to #PB_Sprite_BilinearFiltering should make the SpiderBasic version looks like the PureBasic version. But it didn't change the visuals on SpiderBasic, instead the PureBasic version got the smoothed pixels. Then I decided to leave the call to SpriteQuality with #PB_Sprite_NoFiltering as the paramenter. And there it is, the spiderbasic version looked the way I wanted with the benefit of not changing the visuals on PureBasic. It looks to me that the default option #PB_Sprite_NoFiltering on SpiderBasic was not really the deafult option util I called SpriteQuality explicitly.
Return to Game Programming

Who is online

Users browsing this forum: No registered users and 1 guest