Page 1 of 1

Shear a sprite according to a specific angle ?

Posted: Fri May 22, 2015 12:50 pm
by Joubarbe
Hi,

I'd like to know if it's possible to "shear" a sprite without losing too much quality, according to a given angle. In fact, I'd like to do the same thing I do in Photoshop : skew the image at a vertical angle of 3°, from this image :

Image

to this one :

Image

Or is it better to load my already sheared image into PB ?

Re: Shear a sprite according to a specific angle ?

Posted: Sat May 23, 2015 10:21 pm
by True29
i think photoshop do a little bit antialiasing.

Re: Shear a sprite according to a specific angle ?

Posted: Sat May 23, 2015 10:23 pm
by Joubarbe
Yep, that's why a simple TransformSprite() won't give a good result.

Re: Shear a sprite according to a specific angle ?

Posted: Sat May 23, 2015 10:29 pm
by STARGÅTE
You can set SpriteQuality(#PB_Sprite_BilinearFiltering) and use TransformSprite() with self calculated corners (instead of RotateSprite). And try to move the sprite some sub-pixel like +0.5 for x and y

Re: Shear a sprite according to a specific angle ?

Posted: Sun May 24, 2015 9:39 am
by Joubarbe
Currently I was using (always with PB_Sprite_BilinearFiltering) :

Code: Select all

dbg = SpriteWidth(spr)
dbg2 = SpriteHeight(spr)
TransformSprite(spr, 0, 0, #PB_Default, dbg, 5, #PB_Default, dbg, dbg2 + 5, #PB_Default, 0, dbg2, #PB_Default)
But as you probably guess, that gives aliasing. The only solution I see is to load my sprites as images and use the gDrawing library to draw them into a sprite with the gShear function. That's not ideal, because I need to have the same image twice...