@STARGÅTE, yep, exactly what I'm asking about. I thought that enabling bilinear filtering would do it for DisplaySprite(), but thanks for the TransformSprite() tip.
Too bad using RotateSprite() or ZoomSprite(), etc. resets the previous matrix transformations..
@Fred, yeah, I know you can send a float and it will round to the nearest pixel, but IMO this looks worse for
certain sprites (not all), than interpolating. The GFX card is basically changing the alpha of image pixels depending on "how much" they are in a physical pixel, so it actually looks good with sprites that already have an antialiased edge to them. (The GFX card is already essentially doing this when transforming image pixels to other resolutions than native.)
EDIT:
It also helps movement appear smoother at fast speeds:
With this image:
Code: Select all
InitSprite()
UsePNGImageDecoder()
Enumeration
#Window
#Sprite
EndEnumeration
OpenWindow(#Window, 0, 0, 300, 300, "Sprite", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(#Window), 0, 0, WindowWidth(#Window), WindowHeight(#Window), 0, 0, 0)
SpriteQuality(#PB_Sprite_BilinearFiltering)
;CreateSprite(#Sprite, 32, 32)
; StartDrawing(SpriteOutput(#Sprite))
; Box(10, 1, 2, 30, $FF8080)
; Box(16, 1, 2, 30, $80FF80)
; Box(22, 1, 2, 30, $8080FF)
; Line(1, 16, 30, 1, $FFFFFF)
; StopDrawing()
LoadSprite(#Sprite, "circle.png", #PB_Sprite_AlphaBlending)
Define Start = ElapsedMilliseconds()
Define X.f
Define delta.f
Repeat
Repeat
Select WindowEvent()
Case #PB_Event_CloseWindow
End
Case #Null
Break
EndSelect
ForEver
delta = (ElapsedMilliseconds() - Start)/1000
Start = ElapsedMilliseconds()
ClearScreen($FFFFFF)
X = X+9*delta
ZoomSprite(#Sprite, 32, 32)
DisplayTransparentSprite(#Sprite, X, X)
TransformSprite(#Sprite, X, X+50, X+SpriteWidth(#Sprite), X+50, X+SpriteWidth(#Sprite), X+50+SpriteHeight(#Sprite), X, X+50+SpriteHeight(#Sprite))
DisplayTransparentSprite(#Sprite, 0, 0)
FlipBuffers()
ForEver