MCPcopy Index your code
hub / github.com/pyfa-org/Pyfa / DrawGradientBar

Function DrawGradientBar

gui/utils/draw.py:37–59  ·  view source on GitHub ↗
(width, height, gStart, gEnd, gMid=None, fillRatio=4)

Source from the content-addressed store, hash-verified

35
36
37def DrawGradientBar(width, height, gStart, gEnd, gMid=None, fillRatio=4):
38 if width == 0 or height == 0:
39 return None
40 canvas = wx.Bitmap(round(width), round(height))
41
42 mdc = wx.MemoryDC()
43 mdc.SelectObject(canvas)
44
45 r = wx.Rect(0, 0, width, height)
46 r.SetHeight(round(height / fillRatio))
47
48 if gMid is None:
49 gMid = gStart
50
51 mdc.GradientFillLinear(r, gStart, gMid, wx.SOUTH)
52 r.SetTop(r.GetHeight())
53 r.SetHeight(round(height * (fillRatio - 1) / fillRatio + (1 if height % fillRatio != 0 else 0)))
54
55 mdc.GradientFillLinear(r, gMid, gEnd, wx.SOUTH)
56
57 mdc.SelectObject(wx.NullBitmap)
58
59 return canvas
60
61
62def GetPartialText(dc, text , maxWidth, defEllipsis="..."):

Callers 1

RenderGradientBarFunction · 0.85

Calls 1

GetHeightMethod · 0.45

Tested by

no test coverage detected