In case of 'spr4' the text background is drawn even with the transparent flag set, and it's drawn using the frontcolor.
In case of 'spr5' the AllChannels operation is separated from the Transparent one, which is working fine even in combination with the AlphaBlend flag, but i'm not sure the resulting blended color is correct, though that could be my ignorance about blending modes.
Ubuntu 16.04.3 LTS
PureBasic 5.61 (Linux - x64)
PureBasic 5.46 LTS Beta 1 (Linux - x64) (tested in fullscreen)
Code: Select all
InitSprite()
InitKeyboard()
ww=800
wh=600
win=OpenWindow(#PB_Any, 50,100, ww,wh, "", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
OpenWindowedScreen(WindowID(win), 0,0, ww,wh, 1,0,0)
w = 45
h = 45
spr1 = CreateSprite(#PB_Any, w, h, #PB_Sprite_AlphaBlending)
StartDrawing(SpriteOutput(spr1))
DrawingMode(#PB_2DDrawing_AllChannels)
Box(0, 0, w, h, $ff00ff00)
StopDrawing()
spr2 = CreateSprite(#PB_Any, w, h, #PB_Sprite_AlphaBlending)
StartDrawing(SpriteOutput(spr2))
DrawingMode(#PB_2DDrawing_AllChannels)
DrawText(0, 0, "Text")
StopDrawing()
spr3 = CreateSprite(#PB_Any, w, h, #PB_Sprite_AlphaBlending)
StartDrawing(SpriteOutput(spr3))
DrawingMode(#PB_2DDrawing_AlphaBlend)
DrawText(0, 0, "Text")
StopDrawing()
spr4 = CreateSprite(#PB_Any, w, h, #PB_Sprite_AlphaBlending)
StartDrawing(SpriteOutput(spr4))
DrawingMode(#PB_2DDrawing_AllChannels | #PB_2DDrawing_Transparent) ; transparent, should not draw text background
Box(0,0,20,30,$8800ff00)
DrawText(0, 0, "Text") ; background is drawn, using frontcolor
DrawText(5, 5, "Text", $88888888) ; background is drawn, using frontcolor
DrawText(10, 10, "Text", $880000ff, $00000000) ; background is drawn, using frontcolor
StopDrawing()
spr5 = CreateSprite(#PB_Any, w, h, #PB_Sprite_AlphaBlending)
StartDrawing(SpriteOutput(spr5))
DrawingMode(#PB_2DDrawing_AllChannels)
Box(0,0,20,30,$0)
DrawingMode(#PB_2DDrawing_AlphaBlend | #PB_2DDrawing_Transparent)
DrawText(0, 0, "Text")
DrawText(5, 5, "Text", $88888888)
DrawText(10, 10, "Text", $880000ff, $00000000)
Debug Hex(AlphaBlend($000000ff,$88888888)) ; 88888888
Debug Hex(AlphaBlend($88888888,$000000ff)) ; 88888888
StopDrawing()
Repeat
ExamineKeyboard()
Repeat
event = WindowEvent()
Select event
Case #PB_Event_CloseWindow
quit = #True
EndSelect
Until Not event
DisplayTransparentSprite(spr1, 10, 10)
DisplayTransparentSprite(spr2, 60, 10)
DisplayTransparentSprite(spr3, 110, 10)
DisplayTransparentSprite(spr4, 160, 10)
DisplayTransparentSprite(spr5, 210, 10)
FlipBuffers()
ClearScreen($333333)
Until quit Or KeyboardPushed(#PB_Key_Escape)