/// <summary> /// The opacity passed in will be applied after figuring out the opacity of mode (if mode says 128, and opacity is .5, then /// the final opacity is 64) /// </summary> public void DrawBall(Ball ball, DrawMode mode, CollisionStyle collisionStyle, bool drawRed, double opacity) { Color color; #region Figure out the color if (drawRed) { color = REDCOLOR; } else { color = Color.Gold; } #endregion int finalOpacity; #region Figure out the opacity switch (mode) { case DrawMode.Building: finalOpacity = BUILDINGBALLFILLOPACTIY; break; case DrawMode.Selected: case DrawMode.Standard: finalOpacity = STANDARDBALLFILLOPACTIY; break; default: throw new ApplicationException("Unknown DrawMode: " + mode.ToString()); } finalOpacity = Convert.ToInt32(finalOpacity * opacity); if (finalOpacity < 0) { finalOpacity = 0; } else if (finalOpacity > 255) { finalOpacity = 255; } #endregion // Collision Style DrawCollisionStyle(ball.Position, ball.Radius, collisionStyle); // Fill the circle using (Brush brush = new SolidBrush(Color.FromArgb(finalOpacity, color))) { _viewer.FillCircle(brush, ball.Position, ball.Radius); } #region Draw the edge switch (mode) { case DrawMode.Building: _viewer.DrawCircle(Color.FromArgb(finalOpacity, _buildingPenColor), STANDARDOUTLINEWIDTH, ball.Position, ball.Radius); break; case DrawMode.Standard: _viewer.DrawCircle(Color.FromArgb(finalOpacity, _standardPenColor), STANDARDOUTLINEWIDTH, ball.Position, ball.Radius); break; case DrawMode.Selected: _viewer.DrawCircle_Selected(ball.Position, ball.Radius); break; } #endregion //TODO: Show Stats }