mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2025-12-16 09:40:07 +01: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
|
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.
|
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
|
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
|
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_RIGHT_UP, self.OnExit)
|
||||||
self.Bind(wx.EVT_PAINT, self.OnPaint)
|
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()
|
img = images.Vippi.GetImage()
|
||||||
if img.HasAlpha():
|
if img.HasAlpha():
|
||||||
img.ConvertAlphaToMask()
|
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)
|
self.bmp = wx.Bitmap(img)
|
||||||
|
|
||||||
w, h = self.bmp.GetWidth(), self.bmp.GetHeight()
|
w, h = self.bmp.GetWidth(), self.bmp.GetHeight()
|
||||||
@@ -52,9 +54,15 @@ class TestFrame(wx.Frame):
|
|||||||
|
|
||||||
|
|
||||||
def SetWindowShape(self, *evt):
|
def SetWindowShape(self, *evt):
|
||||||
# Use the bitmap's mask to determine the region
|
# Use the bitmap's mask to create a wx.Region
|
||||||
#r = wx.Region(self.bmp)
|
r = wx.Region(self.bmp)
|
||||||
r = self.img.ConvertToRegion()
|
|
||||||
|
# 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)
|
self.hasShape = self.SetShape(r)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user