[5.46 LTS B1] ImageGadget transparency issues

Post bugreports for the Windows version here
User avatar
Kukulkan
Addict
Addict
Posts: 1352
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

[5.46 LTS B1] ImageGadget transparency issues

Post by Kukulkan »

[EDIT] Remove usage of some external PNG test image. Now use self drawn [/EDIT]

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 
Looks like this after some movement and resize (Windows 7):
Image

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.
User avatar
Lord
Addict
Addict
Posts: 847
Joined: Tue May 26, 2009 2:11 pm

Re: [5.46 LTS B1] ImageGadget transparency issues

Post by Lord »

Kukulkan wrote:[EDIT] Remove usage of some external PNG test image. Now use self drawn [/EDIT]
...
You can also avoid saving and loading the XML:
Replace

Code: Select all

...
If CreateFile(0, GetTemporaryDirectory() + "test.xml")
  WriteString(0, a.s)
  CloseFile(0)
EndIf

xml.i = LoadXML(#PB_Any, GetTemporaryDirectory() + "test.xml")
...
with

Code: Select all

xml.i=CatchXML(#PB_Any, @a, StringByteLength(a, #PB_Unicode), #PB_XML_StreamStart, #PB_Unicode)
This has nothing to do with the mentioned bug, but I don't like to have all these temporarely stored pieces. At least they should be deleted after been catched.
Image
freak
PureBasic Team
PureBasic Team
Posts: 5929
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Re: [5.46 LTS B1] ImageGadget transparency issues

Post by freak »

Lord wrote:

Code: Select all

xml.i=CatchXML(#PB_Any, @a, StringByteLength(a, #PB_Unicode), #PB_XML_StreamStart, #PB_Unicode)
It is even simpler these days:

Code: Select all

xml.i = ParseXML(#PB_Any, a)
quidquid Latine dictum sit altum videtur
User avatar
Kukulkan
Addict
Addict
Posts: 1352
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Re: [5.46 LTS B1] ImageGadget transparency issues

Post by Kukulkan »

Thanks for the hints about the XML functions but it looks like I really can't use PB 5.46 because of this IMAGE bug.

For my users it currently looks like this:
Image

And after some resizing and moving, it looks like this:
Image

Can you please confirm the bug? Or is it just on my machines? Or is there a way around? Looks like all transparency in images is somehow not working. Do I need to draw a background into the images before using them in XML dialog?
User avatar
Lord
Addict
Addict
Posts: 847
Joined: Tue May 26, 2009 2:11 pm

Re: [5.46 LTS B1] ImageGadget transparency issues

Post by Lord »

Kukulkan wrote:...
Can you please confirm the bug?
...
I can confirm this bug using PB5.60(x64) and PB5.60(x86).
Image
Fred
Administrator
Administrator
Posts: 16619
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: [5.46 LTS B1] ImageGadget transparency issues

Post by Fred »

Is it a regression or it has always been like that ?
User avatar
Lord
Addict
Addict
Posts: 847
Joined: Tue May 26, 2009 2:11 pm

Re: [5.46 LTS B1] ImageGadget transparency issues

Post by Lord »

At least PB5.44LTS and PB5.50 do show the same behaviour.
Image
Post Reply