Add a another two examples of patterns
[PoPiPaint.git] / CanvasView.py
index 28a7d0d..bbac60b 100755 (executable)
@@ -67,18 +67,16 @@ class CanvasView(wx.Window):
 
         self.offset_angle = -pi/2.
 
 
         self.offset_angle = -pi/2.
 
-        self.SetSize((w, h))
+        self.SetInitialSize((w, h))
 
         self.SetFocus()
 
         self.Bind(wx.EVT_PAINT, self.OnPaint)
 
 
         self.SetFocus()
 
         self.Bind(wx.EVT_PAINT, self.OnPaint)
 
-        # make a DC to draw into...
-        self.buffer = wx.EmptyBitmap(w, h)
-        self.dc = wx.BufferedDC(None, self.buffer)
-
-        # Because we want the position of the mouse pointer
-        # relative to the center of the canvas
+        # Have a reference DC with the desired coordinate system.
+        # Because we want the position of the mouse pointer relative to the
+        # center of this canvas.
+        self.dc = wx.MemoryDC(wx.EmptyBitmap(w, h))
         self.dc.SetDeviceOrigin(w/2., h/2.)
 
         self.draw_grid = True
         self.dc.SetDeviceOrigin(w/2., h/2.)
 
         self.draw_grid = True
@@ -93,7 +91,7 @@ class CanvasView(wx.Window):
         # are bugs regarding bitmaps with alpha channels and MemoryDC
         self.grid_buffer = self.loadGrid("res/grid.png")
 
         # are bugs regarding bitmaps with alpha channels and MemoryDC
         self.grid_buffer = self.loadGrid("res/grid.png")
 
-        self.pixels_buffer = wx.EmptyBitmap(w, h, depth=32)
+        self.pixels_buffer = wx.EmptyBitmapRGBA(w, h, 0, 0 ,0, 255)
         self.drawAllPixels()
 
     def setPixelCoordinates(self, gc):
         self.drawAllPixels()
 
     def setPixelCoordinates(self, gc):