public Size DrawBattery(Bitmap screen, Point batteryPosition, int batteryWidth, int batteryHeight,
int borderThickness, Color batteryColor, Color backColor, bool charging, int batteryLevel)
{
//calculate filler
double fillerWidth = (batteryWidth - (borderThickness*1));
double percent = ((double)batteryLevel * 0.01);
double actualFillerWidth = fillerWidth*percent;
//calculate nub
double nubHight = batteryHeight*0.5;
double nubWidth = batteryHeight*0.1;
double nubTop = (((double) batteryHeight)/2) - (nubHight/2);
Point nubPosition = new Point(batteryPosition.X + batteryWidth,
batteryPosition.Y + (int) System.Math.Floor(nubTop));
//draw filler
int paintedFiller = (int) actualFillerWidth;
if (paintedFiller < 0) paintedFiller = 0;
screen.DrawRectangle(backColor, 1, batteryPosition.X + 1, batteryPosition.Y + 1, paintedFiller,
batteryHeight - 2, 0, 0, batteryColor, 0, 0, batteryColor, 0, 0, 255);
//draw main battery outline
screen.DrawRectangle(batteryColor, borderThickness, batteryPosition.X, batteryPosition.Y, batteryWidth,
batteryHeight, 0, 0, backColor, 0, 0, backColor, 0, 0, 0);
//draw battery nub
screen.DrawRectangle(batteryColor, 1, nubPosition.X, nubPosition.Y, (int) nubWidth, (int) nubHight, 0, 0,
batteryColor, 0, 0, batteryColor, 0, 0, 255);
//draw inner border
var batterySize = new Size(batteryWidth + (int) nubWidth, batteryHeight);
if (charging)
{
//draw charging indicator
double iconHeight = (int)(nubHight*0.20);
double iconTop = batteryPosition.Y + ((double)batteryHeight/2 - iconHeight/2)+1;
double iconLeft = batteryPosition.X + 4;
double iconWidth = (int)(iconLeft + actualFillerWidth - 5);
screen.DrawLine(backColor, (int)iconHeight, (int)iconLeft, (int)iconTop, (int)iconWidth, (int)iconTop);
}
return batterySize;
}
public void PaintSkinnyHands(Bitmap screen, DateTime time, Point center)