Possible bug in wxcairo ImageSurfaceFromBitmap

Hello,
I found a weird bug, probably in wxcairo ImageSurfaceFromBitmap.

I was trying to display a bitmap with transparent elements in the cairo context.
By doing (just like in wxpython demo):
img = wxcairo.ImageSurfaceFromBitmap(self.bitmap)

I lost transparency and transparent elements of the picture are displayed as white.

Why the bug is weird? Because it depends on the picture file that I load into the wxpython.
On Picture1.png things are bugged like mentioned above, while with Picture2.png transparency works as it should.
So why do I think that ImageSurfaceFromBitmap is bugged? Everyone would say that Picture1.png has no transparency…

So I tried to load Picture1.png directly from file into the cairo, without going through wxbitmap:
img = cairo.ImageSurface.create_from_png("Picture1.png")

Now the Picture1.png has transparency as it should!
What’s more intereting Picture1.png is displayed correctly by wxpython with use of e.g. staticbitmap or dc Draw.

For me that implies that the ImageSurfaceFromBitmap is bugged.

Any feedback is appreciated.

Btw. Picture1.png was created in Inkscape, Picture2.png was Created in GIMP. I use Linux, didn’t test it under Windows/Mac.

Full code (you can toggle by commenting/uncommenting and changing name Picture1 to picture2), screenshots and picture files attached below:

import wx
import wx.lib.wxcairo as wxcairo

import cairo

class TextPanel(wx.Panel):
    def __init__(self, parent):
        super().__init__(parent)
        self.SetSize(299,20)
        self.SetPosition((0,100))
        self.te = wx.StaticText(self)
        self.te.SetLabel("HELLO, CAN YOU SEE ME? HELLO, CAN YOU SEE ME?")

class BitmapPanel(wx.Panel):
    def __init__(self, parent):
        super().__init__(parent)
        self.SetSize(299,299)
        
        self.bitmap = wx.Bitmap("Picture1.png", 32)

#         wx.StaticBitmap(self, -1, self.bitmap)
        
        self.Bind(wx.EVT_PAINT, self.on_paint)

    def on_paint(self, event):
        dc = wx.PaintDC(self)
        
        self.draw_bitmap(dc)

    def draw_bitmap(self, dc):
        cr = wxcairo.ContextFromDC(dc)
        
        img = wxcairo.ImageSurfaceFromBitmap(self.bitmap)
        
#         img = cairo.ImageSurface.create_from_png("Picture1.png")

        cr.set_source_surface(img, 0, 0)
        cr.paint()

class MyFrame(wx.Frame):
    def __init__(self):
        super().__init__(None, title="wxcairo bug example")
        self.SetSize(499,499)
        self.SetBackgroundColour("YELLOW")
        
        self.textpanel = TextPanel(self)
        
        self.bitmappanel = BitmapPanel(self)
        self.Show()

if __name__ == "__main__":
    app = wx.App()
    frame = MyFrame()
    app.MainLoop()

Result:

Pictures:
Pictures.zip (5.1 KB)