Пример #1
0
        private string TextStrokeFill(ICanvasRenderingContext2D ctx)
        {
            string fillText = "fill. う~ぱ~";
            string strokeText = "stroke. う~ぱ~";

            ctx.textBaseLine = "top";
            ctx.font = "32pt Arial";

            ctx.fillStyle = "orange"; // shadow color
            ctx.fillText(fillText, 22, 22);
            ctx.fillStyle = "red";
            ctx.fillText(fillText, 20, 20);

            ctx.strokeStyle = "blue";
            ctx.strokeText(strokeText, 20, 80);
            return @"Originals\Text\TextStrokeFill.png";
        }
Пример #2
0
        private string TextSizes(ICanvasRenderingContext2D ctx)
        {
            int w = 500;
            int h = 800;
            string fillText = "AWawあ漢字!?@";
            ctx.textBaseLine = "top";

            grid(ctx, w, h, 10, 5, "SkyBlue", "steelblue");

            int i = 0;
            string txt;
            int v;
            var ary = new[] {6, 7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 24, 28, 32, 36};
            ctx.strokeStyle = "black";
            int iz = ary.Length;
            for (; i < iz; ++i)
            {
                v = ary[i];
                txt = v + "pt;" + fillText;
                ctx.font = v + "pt Arial";
                ctx.strokeText(txt, 10, i*35 + 10);
            }

            return @"Originals\Text\TextOnGrid.png";
        }