Question about transparent region as the shape of the frame

When I use wx.RegionFromBitmap to create a region from a transparent bitmap, and then call wx.Frame.SetShape to set the region as the frame’s shape, even the transparent part of the bitmap is not transparent in the frame. What’s the matter? Is anything wrong?

PS: I know we could use wx.RegionFromBitmapColour could meet my need. However, I want to know why we can’t use wx.RegionFromBitmap and a transparent picture to produce the same effect.

···

Dae James

Does the image have an alpha channel instead of a mask? For PNG type image files, for example, if any pixel's transparency value is something other than 0 or 255 then it will be loaded in to wx with an alpha channel. If all are either 0 or 255 then it will be loaded as a mask instead. wx.RegionFromBitmap can only use a mask. You can use wx.Image.ConvertAlphaToMask to force it to be a mask if needed

···

On 10/14/12 4:21 AM, Dae James wrote:

When I use wx.RegionFromBitmap to create a region from a transparent
bitmap, and then call wx.Frame.SetShape to set the region as the frame's
shape, even the transparent part of the bitmap is not transparent in the
frame. What's the matter? Is anything wrong?
PS: I know we could use wx.RegionFromBitmapColour could meet my need.
However, I want to know why we can't use wx.RegionFromBitmap and a
transparent picture to produce the same effect.

--
Robin Dunn
Software Craftsman

What if I want some parts of the region to be translucent, other parts opacity?

···

Dae James

From: Robin Dunn

Date: 2012-10-17 07:28

To: wxpython-users

Subject: Re: [wxPython-users] Question about transparent region as the shape of the frame

On 10/14/12 4:21 AM, Dae James wrote:

When I use wx.RegionFromBitmap to create a region from a transparent

bitmap, and then call wx.Frame.SetShape to set the region as the frame’s

shape, even the transparent part of the bitmap is not transparent in the

frame. What’s the matter? Is anything wrong?

PS: I know we could use wx.RegionFromBitmapColour could meet my need.

However, I want to know why we can’t use wx.RegionFromBitmap and a

transparent picture to produce the same effect.

Does the image have an alpha channel instead of a mask? For PNG type

image files, for example, if any pixel’s transparency value is something

other than 0 or 255 then it will be loaded in to wx with an alpha

channel. If all are either 0 or 255 then it will be loaded as a mask

instead. wx.RegionFromBitmap can only use a mask. You can use

wx.Image.ConvertAlphaToMask to force it to be a mask if needed

Robin Dunn

Software Craftsman

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

That can't currently be done by setting the frame shape. It's only an all or nothing transparency.

···

On 10/16/12 11:14 PM, Dae James wrote:

What if I want some parts of the region to be translucent, other parts
opacity?

--
Robin Dunn
Software Craftsman