Drawing wx.Bitmap with alpha to Cairo surface

Hello

I try to draw a wx.Bitmap that may contain an alpha channel to a pycairo
surface. This works fine if there is no alpha channel. However, if
there is one then the bitmap is not drawn.

Could you give me a hint how to solve this (if possible without using
PIL)?

I have attached an example file that creates a PDF document.

Thanks in advance!

cairo_bmp_test.py (2.11 KB)

Seems to work for me, I see two images, the second has a white background everywhere the first was black.

···

On Monday, August 4, 2014 6:10:48 AM UTC-7, Martin Manns wrote:

Hello

I try to draw a wx.Bitmap that may contain an alpha channel to a pycairo

surface. This works fine if there is no alpha channel. However, if

there is one then the bitmap is not drawn.

Could you give me a hint how to solve this (if possible without using

PIL)?

I have attached an example file that creates a PDF document.

Thanks in advance!

P.S. I used 2.9.4.0-MSW

I also get the same results with 3.0.0-MSW and 3.0.1.0.b20140707 msw

···

On Monday, August 4, 2014 9:37:35 AM UTC-7, Nathan McCorkle wrote:

Seems to work for me, I see two images, the second has a white background everywhere the first was black.

On Monday, August 4, 2014 6:10:48 AM UTC-7, Martin Manns wrote:

Hello

I try to draw a wx.Bitmap that may contain an alpha channel to a pycairo

surface. This works fine if there is no alpha channel. However, if

there is one then the bitmap is not drawn.

Could you give me a hint how to solve this (if possible without using

PIL)?

I have attached an example file that creates a PDF document.

Thanks in advance!

On my system, the attached PDF file is generated, which shows only the
one with the black background i.e. the one without transparency.

I use Debian testing:
Python 2.7.8
wxPython 2.8.12.1 (gtk2-unicode)
pycairo: 1.8.8

cairo_bmp_test.pdf (1.93 KB)

···

On Mon, 4 Aug 2014 09:40:05 -0700 (PDT) Nathan McCorkle <nmz787@gmail.com> wrote:

On Monday, August 4, 2014 9:37:35 AM UTC-7, Nathan McCorkle wrote:
>
> Seems to work for me, I see two images, the second has a white
> background everywhere the first was black.

Try upgrading to a newer version of wxPython then, first, if that doesn’t fix it then it would seem to be platform specific and worthy of looking for an existing bug report at trac.wxwidgets.org

···

On Monday, August 4, 2014 12:09:27 PM UTC-7, Martin Manns wrote:

On Mon, 4 Aug 2014 09:40:05 -0700 (PDT) > > Nathan McCorkle nmz...@gmail.com wrote:

On Monday, August 4, 2014 9:37:35 AM UTC-7, Nathan McCorkle wrote:

Seems to work for me, I see two images, the second has a white

background everywhere the first was black.

On my system, the attached PDF file is generated, which shows only the

one with the black background i.e. the one without transparency.

I use Debian testing:

Python 2.7.8

wxPython 2.8.12.1 (gtk2-unicode)

pycairo: 1.8.8

With wxPython 3.0 it works fine.

So the only thing that I need is a workaround for users who are stuck
with wxPython 2.8.x. I would welcome ideas how to avoid the black
background and switch it to white.

···

On Mon, 4 Aug 2014 14:07:41 -0700 (PDT) Nathan McCorkle <nmz787@gmail.com> wrote:

Try upgrading to a newer version of wxPython then, first, if that
doesn't fix it then it would seem to be platform specific and worthy
of looking for an existing bug report at trac.wxwidgets.org