]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/demo/wxOGL.py
removed assert from wxColour::InitFromName() as there is no way to bypass it (see...
[wxWidgets.git] / wxPython / demo / wxOGL.py
index c963fdd847862e4dfd3040f980a3bb9c8d5eceae..a13bee893a23472682d7dbcd7aedbe77094d1461 100644 (file)
@@ -2,6 +2,8 @@
 from wxPython.wx import *
 from wxPython.ogl import *
 
+import images
+
 #----------------------------------------------------------------------
 # This creates some pens and brushes that the OGL library uses.
 
@@ -49,7 +51,6 @@ class MyEvtHandler(wxShapeEvtHandler):
         self.log = log
         self.statbarFrame = frame
 
-
     def UpdateStatusBar(self, shape):
         x,y = shape.GetX(), shape.GetY()
         width, height = shape.GetBoundingBoxMax()
@@ -126,6 +127,7 @@ class TestWindow(wxShapeCanvas):
         self.SetDiagram(self.diagram)
         self.diagram.SetCanvas(self)
         self.shapes = []
+        self.save_gdi = []
 
         rRectBrush = wxBrush(wxNamedColour("MEDIUM TURQUOISE"), wxSOLID)
 
@@ -134,6 +136,14 @@ class TestWindow(wxShapeCanvas):
         self.MyAddShape(DiamondShape(90, 90), 345, 235, wxPen(wxBLUE, 3, wxDOT), wxRED_BRUSH, "Polygon")
         self.MyAddShape(RoundedRectangleShape(95,70), 140, 255, wxPen(wxRED, 1), rRectBrush, "Rounded Rect")
 
+        bmp = images.getTest2Bitmap()
+        mask = wxMaskColour(bmp, wxBLUE)
+        bmp.SetMask(mask)
+
+        s = wxBitmapShape()
+        s.SetBitmap(bmp)
+        self.MyAddShape(s, 225, 150, None, None, "Bitmap")
+
         dc = wxClientDC(self)
         self.PrepareDC(dc)
         for x in range(len(self.shapes)):
@@ -158,13 +168,13 @@ class TestWindow(wxShapeCanvas):
 
 
     def MyAddShape(self, shape, x, y, pen, brush, text):
-        shape.SetDraggable(true)
+        shape.SetDraggable(true, true)
         shape.SetCanvas(self)
         shape.SetX(x)
         shape.SetY(y)
-        shape.SetPen(pen)
-        shape.SetBrush(brush)
-        shape.AddText(text)
+        if pen:    shape.SetPen(pen)
+        if brush:  shape.SetBrush(brush)
+        if text:   shape.AddText(text)
         #shape.SetShadowMode(SHADOW_RIGHT)
         self.diagram.AddShape(shape)
         shape.Show(true)
@@ -177,11 +187,13 @@ class TestWindow(wxShapeCanvas):
         self.shapes.append(shape)
 
 
+
     def __del__(self):
         for shape in self.diagram.GetShapeList():
             if shape.GetParent() == None:
                 shape.SetCanvas(None)
                 shape.Destroy()
+        self.diagram.Destroy()
 
 
 #----------------------------------------------------------------------