Esempio n. 1
0
        public static void drawScissor(NvgContext vg, float x, float y, float t)
        {
            vg.Save();

            // Draw first rect and set scissor to it's area.
            vg.Translate(x, y);
            vg.Rotate(NvgUtility.DegToRad(5));
            vg.BeginPath();
            vg.Rect(-20, -20, 60, 40);
            vg.FillColor(new Color(255, 0, 0, 255));
            vg.Fill();
            vg.Scissor(-20, -20, 60, 40);

            // Draw second rectangle with offset and rotation.
            vg.Translate(40, 0);
            vg.Rotate(t);

            // Draw the intended second rectangle without any scissoring.
            vg.Save();
            vg.ResetScissor();
            vg.BeginPath();
            vg.Rect(-20, -10, 60, 30);
            vg.FillColor(new Color(255, 128, 0, 64));
            vg.Fill();
            vg.Restore();

            // Draw second rectangle with combined scissoring.
            vg.IntersectScissor(-20, -10, 60, 30);
            vg.BeginPath();
            vg.Rect(-20, -10, 60, 30);
            vg.FillColor(new Color(255, 128, 0, 255));
            vg.Fill();

            vg.Restore();
        }