Thanks for any more tests and feedbacks!
[Update: a possible workaround by limiting the 'Intensity' value is added in the commented code section...]
Code: Select all
; DisplayTransparentSprite() Bug PB570 Linux
; Demo code with workaround as temporary bugfix
EnableExplicit
; Workaround - PB570 Linux - DisplayTransparentSprite()
; CompilerIf #PB_Compiler_OS=#PB_OS_Linux
; Procedure DisplayTransparentSprite_(output_ID, x, y, alpha)
; If alpha>253 : alpha=253 : EndIf ; Mostly 254 works, but not ever, it look, it's available 253 work all over
; DisplayTransparentSprite(output_ID, x, y, alpha)
; EndProcedure
; Macro DisplayTransparentSprite(output_ID, x, y, alpha=253)
; DisplayTransparentSprite_(output_ID, x, y, alpha)
; EndMacro
; CompilerEndIf
InitSprite()
Define i, ii, texture_ID, sprite_ID, sprite_1_ID, output_x, output_y, output_width=800, output_height=600
Define window_ID=OpenWindow(#PB_Any, #PB_Ignore, #PB_Ignore, output_width, output_height, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If Not OpenWindowedScreen(WindowID(window_ID), 0, 0, output_width, output_height) : End : EndIf
Macro create_sprite
If IsImage(texture_ID) : FreeImage(texture_ID) : EndIf
If IsSprite(sprite_ID) : FreeSprite(sprite_ID) : EndIf
texture_ID=CreateImage(#PB_Any, 200, 200)
sprite_ID=CreateSprite(#PB_Any, ImageWidth(texture_ID), ImageHeight(texture_ID))
StartDrawing(ImageOutput(texture_ID))
DrawingMode(#PB_2DDrawing_Outlined)
LineXY(0, 0, ImageWidth(texture_ID), ImageHeight(texture_ID), $FFFFFF) ; don't use black, as this is the pre-defined transparent color
LineXY(ImageWidth(texture_ID), 0, 0, ImageHeight(texture_ID), $FFFF)
Box(0, 0, ImageWidth(texture_ID), ImageHeight(texture_ID), $FF)
StopDrawing()
EndMacro
create_sprite
sprite_1_ID=CreateSprite(#PB_Any, output_width, output_height)
Repeat
Repeat ; Get all window events before FlipBuffers()
Define win_event=WaitWindowEvent(1)
If win_event=#PB_Event_CloseWindow
End
EndIf
Until Not win_event
FlipBuffers()
ClearScreen(0)
DisplaySprite(sprite_1_ID, 0, 0) ; Set a background before the output of the result - here in this snippet we use simply black
StartDrawing(SpriteOutput(sprite_ID)) ; Draw the texture
DrawImage(ImageID(texture_ID), 0, 0)
StopDrawing()
For i=0 To output_width
For ii=0 To output_height
; DisplayTransparentSprite(sprite_ID, i, ii, 254) : ii+ImageHeight(texture_ID)-1 ; = OK
; FIXME - 255 on the following line will break the function (254 and all other values work)
DisplayTransparentSprite(sprite_ID, i, ii) : ii+ImageHeight(texture_ID)-1
Next
i+ImageWidth(texture_ID)-1
Next
ForEver