This code:
Code: Select all
UsePNGImageDecoder()
a.s = "<?xml version='1.0' ?>"
a.s + "<window name='mainWindow'"
a.s + " text='window text'"
a.s + " width='780'"
a.s + " height='500'"
a.s + " margin='0'"
a.s + " flags='#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_TitleBar|#PB_Window_SizeGadget|#PB_Window_MaximizeGadget|#PB_Window_Invisible|#PB_Window_ScreenCentered'>"
a.s + " <vbox expand='item:2' spacing='0'>"
a.s + " <!-- header image --> "
a.s + " <image name='image' height='40' width='auto' />"
a.s + " <!-- grid -->"
a.s + " <listicon name='listicon' flags='#PB_ListIcon_AlwaysShowSelection|#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect|#PB_ListIcon_MultiSelect' />"
a.s + " <!-- spacer -->"
a.s + " <singlebox margin='2' />"
a.s + " <!-- button bar -->"
a.s + " <hbox height='70' expand='item:4'>"
a.s + " <empty />"
a.s + " <image name='logo' width='64' height='64'/>"
a.s + " <empty width='20'/>"
a.s + " <text name='label' flags=''/>"
a.s + " <empty />"
a.s + " <button name='Button_help' width='30' />"
a.s + " <empty />"
a.s + " <button name='Button_refresh' width='60' />"
a.s + " <button name='Button_send' width='60' />"
a.s + " </hbox>"
a.s + " <singlebox margin='5' />"
a.s + " </vbox>"
a.s + "</window>"
a.s = ReplaceString(a.s, "\q", Chr(34)) ; get quotes back
; Debug a.s
If CreateFile(0, GetTemporaryDirectory() + "test.xml")
WriteString(0, a.s)
CloseFile(0)
EndIf
xml.i = LoadXML(#PB_Any, GetTemporaryDirectory() + "test.xml")
d.i = CreateDialog(#PB_Any)
w.i = OpenXMLDialog(d.i, xml.i, "")
If w.i = 0
Debug DialogError(d.i)
End
EndIf
logo.i = DialogGadget(d.i, "logo")
HeaderImageID.i = CreateImage(#PB_Any, 64, 64, 32, #PB_Image_Transparent)
StartDrawing(ImageOutput(HeaderImageID.i))
DrawingMode(#PB_2DDrawing_AllChannels)
Circle(32,32, 18, RGBA(0,0,0,20))
Circle(32,32, 15, RGBA(100,255,120,255))
StopDrawing()
SetGadgetState(logo.i, ImageID(HeaderImageID.i))
SmartWindowRefresh(DialogWindow(d.i), 1)
HideWindow(DialogWindow(d.i), #False)
Repeat
Event.i = WaitWindowEvent()
Until Event.i = #PB_Event_CloseWindow
Three things realized:
1) The image background seems to mix with the background of the underlying window (here PB IDE).
2) The image is redrawn and this corrupts transparency (the shadow borders of the image turn black)
3) On Linux it works like expected (background is window background, transparency stays)
Without SmartWindowRefresh() it is better, but still not okay. If you slowly resize the width of the window (not height!), you still realize that the transparent shadow around the circle is overdrawn and getting darker. The image is not refreshed correctly.