mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2025-07-21 12:41:10 +02:00
The Bitmap mask bug on OSX has been fixed, switch back to using the bitmap to get the shape
This commit is contained in:
@@ -74,10 +74,10 @@ New and improved in this release:
|
||||
compared to the original IE 11 backend. Using this backed requires that a
|
||||
new-ish version of the Edge browser is installed on the end user's computer.
|
||||
|
||||
* Added the wx.Image.ConvertToRegion method. This lets you create a wx.Image
|
||||
* Added the wx.Image.ConvertToRegion method. This lets you create a wx.Region
|
||||
from an image and a specified color or the mask if the image has one. This
|
||||
was done to workaround a bug in wxMac, but it seems worthwhile enough to keep
|
||||
it around.
|
||||
it around even after the bug was fixed.
|
||||
|
||||
|
||||
|
||||
|
@@ -26,10 +26,12 @@ class TestFrame(wx.Frame):
|
||||
self.Bind(wx.EVT_RIGHT_UP, self.OnExit)
|
||||
self.Bind(wx.EVT_PAINT, self.OnPaint)
|
||||
|
||||
# Load the image and ensure it has a Mask, (rather than an alpha channel)
|
||||
img = images.Vippi.GetImage()
|
||||
if img.HasAlpha():
|
||||
img.ConvertAlphaToMask()
|
||||
self.img = img
|
||||
# Convert it to a wx.Bitmap, which will be used in SetWindowShape, and
|
||||
# in OnPaint below.
|
||||
self.bmp = wx.Bitmap(img)
|
||||
|
||||
w, h = self.bmp.GetWidth(), self.bmp.GetHeight()
|
||||
@@ -52,9 +54,15 @@ class TestFrame(wx.Frame):
|
||||
|
||||
|
||||
def SetWindowShape(self, *evt):
|
||||
# Use the bitmap's mask to determine the region
|
||||
#r = wx.Region(self.bmp)
|
||||
r = self.img.ConvertToRegion()
|
||||
# Use the bitmap's mask to create a wx.Region
|
||||
r = wx.Region(self.bmp)
|
||||
|
||||
# NOTE: Starting in 4.1 you can also get a wx.Region directly from
|
||||
# a wx.Image, so you can save a step if you don't need it as a wx.Bitmap
|
||||
# for anything else.
|
||||
#r = self.img.ConvertToRegion()
|
||||
|
||||
# Use the region to set the frame's shape
|
||||
self.hasShape = self.SetShape(r)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user