Example #1
0
 public TextBlock(Font font, SKColor color, string text, GlyphAnimation glyphAnimation)
 {
     Font           = font;
     Color          = color;
     Text           = text ?? "";
     GlyphAnimation = glyphAnimation;
 }
Example #2
0
        /// <summary>
        /// Draw a measuredspan (ie a substring) of the glyphspan
        /// </summary>
        /// <param name="x">Left coordinate</param>
        /// <param name="y">Bottom coordinate of the text baseline</param>
        /// <param name="measuredSpan"></param>
        public static void DrawGlyphSpan(this SKCanvas canvas, GlyphSpan glyphSpan, float x, float y, SKColor color, MeasuredSpan measuredSpan, GlyphAnimation glyphAnimation = null)
        {
            if (canvas == null)
            {
                return;
            }

            if (color.Alpha == 0)
            {
                return;
            }

            if (measuredSpan.glyphstart < 0)
            {
                return;
            }

            if (measuredSpan.glyphend < 0)
            {
                return;
            }

            // paint the "substring" blocks
            if (glyphAnimation == null)
            {
                glyphSpan.PaintBlocks(canvas, measuredSpan.glyphstart, measuredSpan.glyphend, x, y, color);
            }
            else
            {
                glyphSpan.PaintBlocks(canvas, measuredSpan.glyphstart, measuredSpan.glyphend, x, y, color, glyphAnimation);
            }
        }