public static void DrawToBottom(SKCanvas c, BaseIcon icon, SKTextAlign align, string text) { if (string.IsNullOrEmpty(text)) { return; } using (var paint = new SKPaint { IsAntialias = true, FilterQuality = SKFilterQuality.High, Typeface = ChicTypefaces.BurbankBigRegularBlack, TextSize = icon.Height * (align == SKTextAlign.Left ? BOTTOM_TEXT_SIZE_RATIO : ChicRatios.Get(30)), Color = SKColors.White, TextAlign = align }) { var five = (int)(icon.Height * ChicRatios.Get(5)); if (align == SKTextAlign.Left) { c.DrawText(text, five, icon.Height - five, paint); } else { c.DrawText(text, icon.Width - five - (int)(icon.Height * ChicRatios.Get(27.5f)), icon.Height - five, paint); } } }
public static void DrawVbuck(SKCanvas c, BaseIcon icon) { var two = (int)(icon.Height * ChicRatios.Get(2)); var vbuckSize = (int)(icon.Height * ChicRatios.Get(27.5f)); using (var paint = new SKPaint { IsAntialias = true, FilterQuality = SKFilterQuality.High, }) c.DrawBitmap(SKBitmap.Decode(Program.Root + "Resources/T-VBuck-128.png"), new SKRect(icon.Width - vbuckSize - two, icon.Height - vbuckSize - two, icon.Width - two, icon.Height - two), paint); }
public static void DrawDisplayName(SKCanvas c, BaseIcon icon) { string text = icon.DisplayName; if (string.IsNullOrEmpty(text)) { return; } int x = (int)(icon.Height * ChicRatios.Get(5)); int y = (int)(icon.Height * STARTER_POSITION_RATIO + icon.Height * NAME_TEXT_SIZE_RATIO); using (var namePaint = new SKPaint { IsAntialias = true, FilterQuality = SKFilterQuality.High, Typeface = ChicTypefaces.BurbankBigCondensedBold, TextSize = icon.Height * NAME_TEXT_SIZE_RATIO, Color = SKColors.White, //TextAlign = SKTextAlign.Left, ImageFilter = SKImageFilter.CreateDropShadow(0, 0, icon.Height * 0.009765625f, icon.Height * 0.009765625f, SKColors.Black) }) { using (var paint = new SKPaint { IsAntialias = true, FilterQuality = SKFilterQuality.High, Typeface = ChicTypefaces.BurbankBigCondensedBold, TextSize = icon.Height * ChicRatios.Get(23), Color = SKColors.White, ImageFilter = SKImageFilter.CreateDropShadow(0, 0, icon.Height * ChicRatios.Get(5), icon.Height * ChicRatios.Get(5), SKColors.Black) }) { while (namePaint.MeasureText(icon.DisplayName) + paint.MeasureText(icon.BundleInfo) > icon.Width - x * 5) { namePaint.TextSize--; if (paint.TextSize > icon.Height * ChicRatios.Get(20)) { paint.TextSize--; } } } c.DrawText(text, x, y, namePaint); } }
public static void DrawPreviewImage(SKCanvas c, BaseIcon icon) { int x = (icon.Width - icon.Height) / 2; int y = 0; /*Console.WriteLine(x); * Console.WriteLine(y); * Console.WriteLine(icon.IconImage.Width); * Console.WriteLine(icon.IconImage.Height); * Console.WriteLine(icon.Width); * Console.WriteLine(icon.Height);*/ using (var filter = SKImageFilter.CreateDropShadow(0, 0, icon.Height * ChicRatios.Get(5), icon.Height * ChicRatios.Get(5), SKColors.Black)) using (var paint = new SKPaint { IsAntialias = true, FilterQuality = SKFilterQuality.High, ImageFilter = filter }) c.DrawBitmap(icon.IconImage, new SKRect(x, y, x + icon.Height, y + icon.Height), paint); }
public static void DrawBackground(SKCanvas c, BaseIcon icon) { /*var pathTop = new SKPath { FillType = SKPathFillType.EvenOdd }; * pathTop.MoveTo(icon.Margin, icon.Margin); * pathTop.LineTo(icon.Margin + icon.Width, icon.Margin); * pathTop.LineTo(icon.Margin + icon.Width, icon.Margin + 20); * pathTop.LineTo(icon.Margin, icon.Margin + 30); * pathTop.Close(); * c.DrawPath(pathTop, new SKPaint * { * IsAntialias = true, * FilterQuality = SKFilterQuality.High, * Color = new SKColor(30, 30, 30), //new SKColor(206, 155, 181), * ImageFilter = SKImageFilter.CreateDropShadow(0, 3, 5, 5, SKColors.Black, null, new SKImageFilter.CropRect(SKRect.Create(icon.Margin, icon.Margin, icon.Width - icon.Margin, icon.Height - icon.Margin))) * });*/ using (var rarityPath = new SKPath { FillType = SKPathFillType.EvenOdd }) { rarityPath.MoveTo(0, icon.Height); rarityPath.LineTo(0, icon.Height - icon.Height * ChicRatios.Get(75)); rarityPath.LineTo(icon.Width, icon.Height - icon.Height * ChicRatios.Get(85)); rarityPath.LineTo(icon.Width, icon.Height); rarityPath.Close(); SKColor rarityColor = icon.RarityColors[0]; using (var filter = SKImageFilter.CreateDropShadow(0, -3, icon.Height * ChicRatios.Get(5), icon.Height * ChicRatios.Get(5), SKColors.Black)) using (var paint = new SKPaint { IsAntialias = true, FilterQuality = SKFilterQuality.High, Color = rarityColor, ImageFilter = filter }) c.DrawPath(rarityPath, paint); } using (var pathBottom = new SKPath { FillType = SKPathFillType.EvenOdd }) { pathBottom.MoveTo(0, icon.Height); pathBottom.LineTo(0, icon.Height - icon.Height * ChicRatios.Get(65)); pathBottom.LineTo(icon.Width, icon.Height - icon.Height * ChicRatios.Get(75)); pathBottom.LineTo(icon.Width, icon.Height); pathBottom.Close(); c.DrawPath(pathBottom, new SKPaint { IsAntialias = true, FilterQuality = SKFilterQuality.High, Color = new SKColor(30, 30, 30) }); } using (var pathBottomBottom = new SKPath { FillType = SKPathFillType.EvenOdd }) { pathBottomBottom.MoveTo(0, icon.Height); pathBottomBottom.LineTo(0, icon.Height - icon.Height * ChicRatios.Get(22)); pathBottomBottom.LineTo(icon.Width, icon.Height - icon.Height * ChicRatios.Get(32)); pathBottomBottom.LineTo(icon.Width, icon.Height); pathBottomBottom.Close(); c.DrawPath(pathBottomBottom, new SKPaint { IsAntialias = true, FilterQuality = SKFilterQuality.High, Color = new SKColor(20, 20, 20) }); } }