//
using System;
-using System.Reflection;
-using System.Runtime.InteropServices;
using Cairo;
using Gtk;
static void oval_path (Cairo.Graphics gr, double xc, double yc, double xr, double yr)
{
- Matrix matrix = gr.Matrix;
-
gr.Translate (xc, yc);
gr.Scale (1.0, yr / xr);
gr.MoveTo (new PointD (xr, 0.0) );
gr.Arc (0, 0, xr, 0, 2 * M_PI);
gr.ClosePath ();
-
- gr.Matrix = matrix;
- //matrix.Destroy();
}
/*
double xc = width / 2;
double yc = height / 2;
- overlay = Surface.CreateSimilar (gr.TargetSurface, Format.ARGB32, width, height);
- punch = Surface.CreateSimilar (gr.TargetSurface, Format.A8, width, height);
- circles = Surface.CreateSimilar (gr.TargetSurface, Format.ARGB32, width, height);
+ Surface target = gr.Target;
+ overlay = target.CreateSimilar (Content.ColorAlpha, width, height);
+ punch = target.CreateSimilar (Content.Alpha, width, height);
+ circles = target.CreateSimilar (Content.ColorAlpha, width, height);
gr.Save ();
- gr.TargetSurface = overlay;
+ gr.Target = overlay;
/* Draw a black circle on the overlay
*/
oval_path (gr, xc, yc, radius, radius);
gr.Fill ();
gr.Save ();
- gr.TargetSurface = punch;
+ gr.Target = punch;
/* Draw 3 circles to the punch surface, then cut
gr.Restore ();
- // FIXME: Operator.OutReverse is not in cairo 1.0
- //gr.Operator = Operator.OutReverse;
+ gr.Operator = Operator.DestOut;
punch.Show (gr, width, height);
* without seams.
*/
gr.Save ();
- gr.TargetSurface = circles;
+ gr.Target = circles;
//gr.Alpha = 0.5;
gr.Operator = Operator.Over;