Bug: A call to "ClipSprite" cancels the results of "ZoomSprite" or "TransformSprite" (but not those of "RotateSprite"). Also, "RotateSprite" cancels "TransformSprite", but not "ZoomSprite"...
Code: Select all
; Initialization
If InitSprite() = 0 Or InitKeyboard() = 0 Or UsePNGImageDecoder() = 0
MessageRequester("Error", "Sprite system can't be initialized", 0)
End
EndIf
OpenWindow(0, 0, 0, 600, 400, "PB 5.20b5 - Sprite alphablending",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, 600, 400, 0, 0, 0, #PB_Screen_SmartSynchronization)
; Load a sprite and zoom it
LoadSprite(0, #PB_Compiler_Home + "Examples/Sources/Data/PureBasic.bmp",#PB_Sprite_AlphaBlending)
ZoomSprite(0,500,200)
clipped.b = #False
Repeat
While WindowEvent(): Delay(1): Wend
ClearScreen(RGB(120,150,200))
ExamineKeyboard()
If clipped = #False
StartDrawing(ScreenOutput())
DrawText(10,10,"Zoomed sprite. Press [Space] to clip it.")
StopDrawing()
If KeyboardReleased(#PB_Key_Space)
; When a sprite is clipped, previously applied "ZoomSprite" or "TransformSprite" are cancelled.
ClipSprite(0,20,10,100,50)
clipped = #True
EndIf
Else
StartDrawing(ScreenOutput())
DrawText(10,10,"ClipSprite cancels the ZoomSprite results :(")
StopDrawing()
EndIf
DisplayTransparentSprite(0, 50, 100)
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) Or event = #PB_Event_CloseWindow