Moved duplicate code from shipbrowser items OnPaint in gui.utils.drawUtils

This commit is contained in:
HomeWorld
2010-12-09 16:55:41 +02:00
parent 94ececb715
commit 79a524f7bb
2 changed files with 32 additions and 22 deletions

21
gui/utils/drawUtils.py Normal file
View File

@@ -0,0 +1,21 @@
import wx
def DrawGradientBar(width, height, gStart, gEnd, gMid = None):
canvas = wx.EmptyBitmap(width,height)
mdc = wx.MemoryDC()
mdc.SelectObject(canvas)
r = wx.Rect(0, 0, width, height)
r.height = r.height / 2
if gMid is None:
gMid = gStart
mdc.GradientFillLinear(r, gStart, gEnd, wx.SOUTH)
r.top = r.height
mdc.GradientFillLinear(r, gMid, gEnd, wx.NORTH)
mdc.SelectObject(wx.NullBitmap)
return canvas