Cleanup in shipbrowser items OnPaint (last step till final optimization)

This commit is contained in:
HomeWorld
2010-12-09 18:11:09 +02:00
parent f18ca8991b
commit 7c4a63a81a
2 changed files with 74 additions and 43 deletions

View File

@@ -1,4 +1,36 @@
import wx
import gui.utils.colorUtils as colorUtils
def RenderGradientBar(windowColor, width, height, sFactor, eFactor, mFactor = None):
if sFactor == 0 and eFactor == 0 and mFactor == None:
return DrawFilledBitmap(width,height, windowColor)
gStart = colorUtils.GetSuitableColor(windowColor, sFactor)
if mFactor:
gMid = colorUtils.GetSuitableColor(windowColor, mFactor)
else:
gMid = None
gEnd = colorUtils.GetSuitableColor(windowColor, eFactor)
return DrawGradientBar(width, height, gStart, gEnd, gMid)
def DrawFilledBitmap(width, height, color):
canvas = wx.EmptyBitmap(width,height)
mdc = wx.MemoryDC()
mdc.SelectObject(canvas)
mdc.SetBrush(wx.Brush(color))
mdc.Clear()
mdc.SelectObject(wx.NullBitmap)
return canvas
def DrawGradientBar(width, height, gStart, gEnd, gMid = None):
canvas = wx.EmptyBitmap(width,height)