X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/299647acac7960652aadb008775429c1f8ea9b8d..0a5bb138a71dfc1c706fc0858fb2801500e2c2e8:/wxPython/demo/Mask.py diff --git a/wxPython/demo/Mask.py b/wxPython/demo/Mask.py index 8d5a43c58b..faf15cd559 100644 --- a/wxPython/demo/Mask.py +++ b/wxPython/demo/Mask.py @@ -1,7 +1,3 @@ -# 11/20/2003 - Jeff Grimmett (grimmtooth@softhome.net) -# -# o Updated for wx namespace -# import wx @@ -44,7 +40,7 @@ class TestMaskWindow(wx.ScrolledWindow): self.bmp_withmask = images.getTestStar2Bitmap() # this mask comes from a monochrome bitmap - self.bmp_themask = wx.BitmapFromImage(images.getTestMaskImage(), 1) + self.bmp_themask = images.getTestMaskBitmap() mask = wx.Mask(self.bmp_themask) # set the mask on our bitmap @@ -53,7 +49,7 @@ class TestMaskWindow(wx.ScrolledWindow): # Now we'll create a mask in a bit of an easier way, by picking a # colour in the image that is to be the transparent colour. self.bmp_withcolourmask = images.getTestStar2Bitmap() - mask = wx.MaskColour(self.bmp_withcolourmask, wx.WHITE) + mask = wx.Mask(self.bmp_withcolourmask, wx.WHITE) self.bmp_withcolourmask.SetMask(mask) self.SetScrollbars(20, 20, 700/20, 460/20) @@ -62,6 +58,7 @@ class TestMaskWindow(wx.ScrolledWindow): def OnPaint (self, e): + self.SetBackgroundColour(wx.Colour(0,128,0)) dc = wx.PaintDC(self) self.PrepareDC(dc) dc.SetTextForeground(wx.WHITE) @@ -69,17 +66,17 @@ class TestMaskWindow(wx.ScrolledWindow): # make an interesting background... dc.SetPen(wx.MEDIUM_GREY_PEN) for i in range(100): - dc.DrawLine((0,i*10), (i*10,0)) + dc.DrawLine(0,i*10, i*10,0) # draw raw image, mask, and masked images - dc.DrawText('original image', (0,0)) - dc.DrawBitmap(self.bmp_nomask, (0,20), 0) - dc.DrawText('with colour mask', (0,100)) - dc.DrawBitmap(self.bmp_withcolourmask, (0,120), 1) - dc.DrawText('the mask image', (0,200)) - dc.DrawBitmap(self.bmp_themask, (0,220), 0) - dc.DrawText('masked image', (0,300)) - dc.DrawBitmap(self.bmp_withmask, (0,320), 1) + dc.DrawText('original image', 0,0) + dc.DrawBitmap(self.bmp_nomask, 0,20, 0) + dc.DrawText('with colour mask', 0,100) + dc.DrawBitmap(self.bmp_withcolourmask, 0,120, 1) + dc.DrawText('the mask image', 0,200) + dc.DrawBitmap(self.bmp_themask, 0,220, 0) + dc.DrawText('masked image', 0,300) + dc.DrawBitmap(self.bmp_withmask, 0,320, 1) cx,cy = self.bmp_themask.GetWidth(), self.bmp_themask.GetHeight() @@ -89,9 +86,9 @@ class TestMaskWindow(wx.ScrolledWindow): for text, code in logicList: x,y = 120+150*(i%4), 20+100*(i/4) - dc.DrawText(text, (x, y-20)) + dc.DrawText(text, x, y-20) mdc.SelectObject(self.bmp_withcolourmask) - dc.Blit((x,y), (cx,cy), mdc, (0,0), code, True) + dc.Blit(x,y, cx,cy, mdc, 0,0, code, True) i = i + 1 @@ -131,5 +128,5 @@ Context (dc) Blit() method's logic codes. if __name__ == '__main__': import sys,os import run - run.main(['', os.path.basename(sys.argv[0])]) + run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])