More FloatCanvas updates from Werner

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@73909 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2013-05-04 02:00:24 +00:00
parent ede298e62e
commit 1447c3d50a
3 changed files with 18 additions and 18 deletions

View File

@@ -1834,10 +1834,10 @@ class Bitmap(TextObjectMixin, DrawObject, ):
DrawObject.__init__(self,InForeground) DrawObject.__init__(self,InForeground)
if type(Bitmap) == wx._gdi.Bitmap: if type(Bitmap) == wx.Bitmap:
self.Bitmap = Bitmap self.Bitmap = Bitmap
elif type(Bitmap) == wx._core.Image: elif type(Bitmap) == wx.Image:
self.Bitmap = wx.BitmapFromImage(Bitmap) self.Bitmap = wx.Bitmap(Bitmap)
# Note the BB is just the point, as the size in World coordinates is not fixed # Note the BB is just the point, as the size in World coordinates is not fixed
self.BoundingBox = BBox.asBBox( (XY,XY) ) self.BoundingBox = BBox.asBBox( (XY,XY) )
@@ -1850,7 +1850,7 @@ class Bitmap(TextObjectMixin, DrawObject, ):
def _Draw(self, dc , WorldToPixel, ScaleWorldToPixel, HTdc=None): def _Draw(self, dc , WorldToPixel, ScaleWorldToPixel, HTdc=None):
XY = WorldToPixel(self.XY) XY = WorldToPixel(self.XY)
XY = self.ShiftFun(XY[0], XY[1], self.Width, self.Height) XY = self.ShiftFun(XY[0], XY[1], self.Width, self.Height)
dc.DrawBitmapPoint(self.Bitmap, XY, True) dc.DrawBitmap(self.Bitmap, XY, True)
if HTdc and self.HitAble: if HTdc and self.HitAble:
HTdc.SetPen(self.HitPen) HTdc.SetPen(self.HitPen)
HTdc.SetBrush(self.HitBrush) HTdc.SetBrush(self.HitBrush)
@@ -1884,9 +1884,9 @@ class ScaledBitmap(TextObjectMixin, DrawObject, ):
DrawObject.__init__(self,InForeground) DrawObject.__init__(self,InForeground)
if type(Bitmap) == wx._gdi.Bitmap: if type(Bitmap) == wx.Bitmap:
self.Image = Bitmap.ConvertToImage() self.Image = Bitmap.ConvertToImage()
elif type(Bitmap) == wx._core.Image: elif type(Bitmap) == wx.Image:
self.Image = Bitmap self.Image = Bitmap
self.XY = XY self.XY = XY
@@ -1912,10 +1912,10 @@ class ScaledBitmap(TextObjectMixin, DrawObject, ):
if (self.ScaledBitmap is None) or (H <> self.ScaledHeight) : if (self.ScaledBitmap is None) or (H <> self.ScaledHeight) :
self.ScaledHeight = H self.ScaledHeight = H
Img = self.Image.Scale(W, H) Img = self.Image.Scale(W, H)
self.ScaledBitmap = wx.BitmapFromImage(Img) self.ScaledBitmap = wx.Bitmap(Img)
XY = self.ShiftFun(XY[0], XY[1], W, H) XY = self.ShiftFun(XY[0], XY[1], W, H)
dc.DrawBitmapPoint(self.ScaledBitmap, XY, True) dc.DrawBitmap(self.ScaledBitmap, XY, True)
if HTdc and self.HitAble: if HTdc and self.HitAble:
HTdc.SetPen(self.HitPen) HTdc.SetPen(self.HitPen)
HTdc.SetBrush(self.HitBrush) HTdc.SetBrush(self.HitBrush)
@@ -1995,7 +1995,7 @@ class ScaledBitmap2(TextObjectMixin, DrawObject, ):
self.ScaledHeight = H self.ScaledHeight = H
#print "Scaling to:", W, H #print "Scaling to:", W, H
Img = self.Image.Scale(W, H) Img = self.Image.Scale(W, H)
bmp = wx.BitmapFromImage(Img) bmp = wx.Bitmap(Img)
self.ScaledBitmap = ((0, 0, self.bmpWidth, self.bmpHeight , W, H), bmp)# this defines the cached bitmap self.ScaledBitmap = ((0, 0, self.bmpWidth, self.bmpHeight , W, H), bmp)# this defines the cached bitmap
else: else:
#print "Using Cached bitmap" #print "Using Cached bitmap"
@@ -2062,7 +2062,7 @@ class ScaledBitmap2(TextObjectMixin, DrawObject, ):
Img = self.Image.GetSubImage(wx.Rect(Xb, Yb, Wb, Hb)) Img = self.Image.GetSubImage(wx.Rect(Xb, Yb, Wb, Hb))
print "rescaling with High quality" print "rescaling with High quality"
Img.Rescale(Ws, Hs, quality=wx.IMAGE_QUALITY_HIGH) Img.Rescale(Ws, Hs, quality=wx.IMAGE_QUALITY_HIGH)
bmp = wx.BitmapFromImage(Img) bmp = wx.Bitmap(Img)
self.ScaledBitmap = ((Xb, Yb, Wb, Hb, Ws, Ws), bmp)# this defines the cached bitmap self.ScaledBitmap = ((Xb, Yb, Wb, Hb, Ws, Ws), bmp)# this defines the cached bitmap
#XY = self.ShiftFun(XY[0], XY[1], W, H) #XY = self.ShiftFun(XY[0], XY[1], W, H)
#fixme: get the shiftfun working! #fixme: get the shiftfun working!
@@ -2261,9 +2261,9 @@ class Arc(XYObjectMixin, LineAndFillMixin, DrawObject):
EndXY = WorldToPixel(self.EndXY) EndXY = WorldToPixel(self.EndXY)
CenterXY = WorldToPixel(self.CenterXY) CenterXY = WorldToPixel(self.CenterXY)
dc.DrawArcPoint(StartXY, EndXY, CenterXY) dc.DrawArc(StartXY, EndXY, CenterXY)
if HTdc and self.HitAble: if HTdc and self.HitAble:
HTdc.DrawArcPoint(StartXY, EndXY, CenterXY) HTdc.DrawArc(StartXY, EndXY, CenterXY)
def CalcBoundingBox(self): def CalcBoundingBox(self):
self.BoundingBox = BBox.asBBox( N.array((self.XY, (self.XY + self.WH) ), N.float) ) self.BoundingBox = BBox.asBBox( N.array((self.XY, (self.XY + self.WH) ), N.float) )

View File

@@ -3,9 +3,9 @@ import wx
## import a local version of FloatCanvas ## import a local version of FloatCanvas
from floatcanvas import FloatCanvas from wx.lib.floatcanvas import FloatCanvas
from floatcanvas.Utilities import BBox from wx.lib.floatcanvas.Utilities import BBox
from floatcanvas.Utilities import Colors from wx.lib.floatcanvas.Utilities import Colors
import numpy as N import numpy as N
@@ -133,6 +133,6 @@ class PieChart(XYObjectMixin, LineOnlyMixin, DrawObject):
radius = self.Diameter/2 radius = self.Diameter/2
HTdc.SetPen(self.HitPen) HTdc.SetPen(self.HitPen)
HTdc.SetBrush(self.HitBrush) HTdc.SetBrush(self.HitBrush)
HTdc.DrawCirclePoint(CenterXY, radius) HTdc.DrawCircle(CenterXY, radius)

View File

@@ -66,9 +66,9 @@ class RubberBandBox(GUIMode.GUIBase):
dc.SetBrush(wx.TRANSPARENT_BRUSH) dc.SetBrush(wx.TRANSPARENT_BRUSH)
dc.SetLogicalFunction(wx.XOR) dc.SetLogicalFunction(wx.XOR)
if self.RBRect: if self.RBRect:
dc.DrawRectanglePointSize(*self.RBRect) dc.DrawRectangle(*self.RBRect)
self.RBRect = ((x, y), (w, h) ) self.RBRect = ((x, y), (w, h) )
dc.DrawRectanglePointSize(*self.RBRect) dc.DrawRectangle(*self.RBRect)
self.Canvas._RaiseMouseEvent(event,FloatCanvas.EVT_FC_MOTION) self.Canvas._RaiseMouseEvent(event,FloatCanvas.EVT_FC_MOTION)
def OnLeftDown(self, event): def OnLeftDown(self, event):