public static void DrawQuests(SKCanvas c, BaseBundle icon) { using SKPaint paint = new SKPaint { IsAntialias = true, FilterQuality = SKFilterQuality.High, TextSize = 27, Color = SKColors.White, TextAlign = SKTextAlign.Left, Typeface = Text.TypeFaces.BundleDisplayNameTypeface }; int y = icon.HeaderHeight + 50; foreach (Quest q in icon.Quests) { DrawQuestBackground(c, icon, y, true); paint.TextSize = 27; paint.ImageFilter = null; paint.Color = SKColors.White; paint.TextAlign = SKTextAlign.Left; paint.Typeface = Text.TypeFaces.BundleDisplayNameTypeface; if (!string.IsNullOrEmpty(q.Description)) { if ((ELanguage)Properties.Settings.Default.AssetsLanguage == ELanguage.Arabic) { SKShaper shaper = new SKShaper(paint.Typeface); float shapedTextWidth; while (true) { SKShaper.Result shapedText = shaper.Shape(q.Description, paint); shapedTextWidth = shapedText.Points[^ 1].X + paint.TextSize / 2f;
public void Draw(SKCanvas c) { c.DrawRect(new SKRect(0, 0, Width, Height), new SKPaint { IsAntialias = true, FilterQuality = SKFilterQuality.High, Shader = SKShader.CreateLinearGradient( new SKPoint(Width / 2, Height), new SKPoint(Width, Height / 4), new SKColor[2] { SKColor.Parse("01369C"), SKColor.Parse("1273C8") }, SKShaderTileMode.Clamp) }); int textSize = 45; SKPaint namePaint = new SKPaint { IsAntialias = true, FilterQuality = SKFilterQuality.High, Typeface = Text.TypeFaces.DisplayNameTypeface, TextSize = textSize, Color = SKColors.White, TextAlign = SKTextAlign.Left }; SKPaint optionPaint = new SKPaint { IsAntialias = true, FilterQuality = SKFilterQuality.High, Typeface = Text.TypeFaces.DisplayNameTypeface, TextSize = 20, Color = SKColor.Parse("EEFFFF"), TextAlign = SKTextAlign.Left }; if ((ELanguage)Properties.Settings.Default.AssetsLanguage == ELanguage.Arabic) { SKShaper shaper = new SKShaper(namePaint.Typeface); float shapedTextWidth; while (true) { SKShaper.Result shapedText = shaper.Shape(OptionDisplayName, namePaint); shapedTextWidth = shapedText.Points[^ 1].X + namePaint.TextSize / 2f;
public static void DrawCenteredMultilineText(SKCanvas canvas, string text, int maxLineCount, int size, int margin, ETextSide side, SKRect area, SKPaint paint) { float lineHeight = paint.TextSize * 1.2f; List <Line> lines = SplitLines(text, paint, area.Width - margin); if (lines == null) { return; } if (lines.Count <= maxLineCount) { maxLineCount = lines.Count; } float height = maxLineCount * lineHeight; float y = area.MidY - height / 2; SKShaper shaper = (ELanguage)Settings.Default.AssetsLanguage == ELanguage.Arabic ? new SKShaper(paint.Typeface) : null; for (int i = 0; i < maxLineCount; i++) { Line line = lines[i]; y += lineHeight; float x = side switch { ETextSide.Center => area.MidX - line.Width / 2, ETextSide.Right => size - margin - line.Width, ETextSide.Left => margin, _ => area.MidX - line.Width / 2 }; string lineText = line.Value.TrimEnd(); if (shaper == null) { canvas.DrawText(lineText, x, y, paint); } else { if (side == ETextSide.Center) { SKShaper.Result shapedText = shaper.Shape(lineText, paint); float shapedTextWidth = shapedText.Points[^ 1].X + paint.TextSize / 2f;
private void DrawHeaderText(SKCanvas c) { using SKPaint paint = new SKPaint { IsAntialias = true, FilterQuality = SKFilterQuality.High, Typeface = Text.TypeFaces.BundleDisplayNameTypeface, TextSize = 50, Color = SKColors.White, TextAlign = SKTextAlign.Left, }; string text = DisplayName.ToUpper(); int x = 300; if ((ELanguage)Properties.Settings.Default.AssetsLanguage == ELanguage.Arabic) { SKShaper shaper = new SKShaper(paint.Typeface); float shapedTextWidth; while (true) { SKShaper.Result shapedText = shaper.Shape(text, paint); shapedTextWidth = shapedText.Points[^ 1].X + paint.TextSize / 2f;