Code cleanup in shipbrowser.py - moved GetRoundShape and it support func to utils.drawUtils

This commit is contained in:
HomeWorld
2011-01-14 18:11:55 +02:00
parent e41749fa13
commit e7815bf028
2 changed files with 17 additions and 18 deletions

View File

@@ -81,3 +81,20 @@ def GetPartialText(dc, text , maxWidth):
return drawntext + ellipsis
else:
return text
def GetRoundBitmap( w, h, r ):
maskColor = wx.Color(0,0,0)
shownColor = wx.Color(5,5,5)
b = wx.EmptyBitmap(w,h)
dc = wx.MemoryDC(b)
dc.SetBrush(wx.Brush(maskColor))
dc.DrawRectangle(0,0,w,h)
dc.SetBrush(wx.Brush(shownColor))
dc.SetPen(wx.Pen(shownColor))
dc.DrawRoundedRectangle(0,0,w,h,r)
dc.SelectObject(wx.NullBitmap)
b.SetMaskColour(maskColor)
return b
def GetRoundShape( w, h, r ):
return wx.RegionFromBitmap( GetRoundBitmap(w,h,r) )