private Tuple <Bitmap, SizeF> GetStreakCounterImage(int streakCount) { var font = new Font("Tahoma", ComboService.GetPowerLevelFontSize(streakCount)); var color = ComboService.GetPowerLevelColor(streakCount); var penWidth = ComboService.GetPowerLevelPenWidth(streakCount); var bitmap = new Bitmap(ADORNMENT_WIDTH, ADORNMENT_STREAK_COUNTER_HEIGHT); bitmap.MakeTransparent(); using (var graphics = Graphics.FromImage(bitmap)) { graphics.SmoothingMode = SmoothingMode.AntiAlias; graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; graphics.PixelOffsetMode = PixelOffsetMode.HighQuality; var size = graphics.MeasureString(streakCount.ToString(), font); graphics.DrawString(streakCount.ToString(), font, new SolidBrush(color), new RectangleF(ADORNMENT_WIDTH - size.Width, 0, size.Width, ADORNMENT_STREAK_COUNTER_HEIGHT)); var pen = new Pen(color, penWidth); graphics.DrawLine(pen, ADORNMENT_WIDTH - size.Width, size.Height - 5 + penWidth / 2, ADORNMENT_WIDTH, size.Height - 5 + penWidth / 2); graphics.Flush(); return(new Tuple <Bitmap, SizeF>(bitmap, size)); } }
private Bitmap GetNewMaxExclamationImage(int streakCount) { var font = new Font("Tahoma", ComboService.GetPowerLevelExclamationFontSize(streakCount)); var color = ComboService.GetPowerLevelColor(streakCount); var bitmap = new Bitmap(ADORNMENT_WIDTH, ADORNMENT_EXCLAMATION_HEIGHT); bitmap.MakeTransparent(); using (var graphics = Graphics.FromImage(bitmap)) { graphics.SmoothingMode = SmoothingMode.AntiAlias; graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; graphics.PixelOffsetMode = PixelOffsetMode.HighQuality; var exclamation = "New MAX !!!"; var size = graphics.MeasureString(exclamation, font); graphics.DrawString(exclamation, font, new SolidBrush(color), new RectangleF(ADORNMENT_WIDTH - size.Width, 0, size.Width, ADORNMENT_EXCLAMATION_HEIGHT)); graphics.Flush(); return(bitmap); } }