Example #1
0
        private string Composite(ICanvasRenderingContext2D ctx, string compositeType)
        {
            // draw rectangle
            ctx.fillStyle = "#09f";
            ctx.fillRect(15, 15, 70, 70);

            // set composite property
            ctx.globalCompositeOperation = compositeType;

            // draw circle
            ctx.fillStyle = "#f30";
            ctx.beginPath();
            ctx.arc(75, 75, 35, 0, Math.PI*2, true);
            ctx.fill();
            ctx.commit();
            return @"Originals\Compositions\" + compositeType + ".png";
        }
        private string sample21(ICanvasRenderingContext2D ctx)
        {
            ctx.translate(75, 75);

            for (int i = 1; i < 6; i++)
            {
                // Loop through rings (from inside to out)
                ctx.save();
                ctx.fillStyle = "rgb(" + (51*i) + "," + (255 - 51*i) + ",255)";

                for (int j = 0; j < i*6; j++)
                {
                    // draw individual dots
                    ctx.rotate((float) Math.PI*2/(i*6));
                    ctx.beginPath();
                    ctx.arc(0, i*12.5F, 5, 0, Math.PI*2, true);
                    ctx.fill();
                    ctx.commit();
                }

                ctx.restore();
            }
            return @"Originals\Transformations\sample21.png";
        }