예제 #1
0
        protected void UpdateTexture ()
        {
            text.SetSurfaceSize ((uint) (Width+MarginX),(uint) (Height+MarginY));
            text.Clear ();
            Cairo.Context context = text.Create ();

            double lwidth = 1;
            double hlwidth = lwidth*0.5;
            double width = Width - lwidth;
            double height = Height - lwidth;
            double radius = Math.Min(marginX, marginY)*0.75;

            if ((radius > height / 2) || (radius > width / 2))
                radius = Math.Min(height / 2, width / 2);

            context.MoveTo (hlwidth, hlwidth + radius);
            context.Arc (hlwidth + radius, hlwidth + radius, radius, Math.PI, -Math.PI / 2);
            context.LineTo (hlwidth + width - radius, hlwidth);
            context.Arc (hlwidth + width - radius, hlwidth + radius, radius, -Math.PI / 2, 0);
            context.LineTo (hlwidth + width, hlwidth + height - radius);
            context.Arc (hlwidth + width - radius, hlwidth + height - radius, radius, 0, Math.PI / 2);
            context.LineTo (hlwidth + radius, hlwidth + height);
            context.Arc (hlwidth + radius, hlwidth + height - radius, radius, Math.PI / 2, Math.PI);
            context.ClosePath ();

            context.LineWidth = lwidth;
            context.SetSourceRGB (1.0,1.0,1.0);
            context.Stroke ();

            ((IDisposable) context.Target).Dispose ();
            ((IDisposable) context).Dispose ();
        }
예제 #2
0
        public static void MakeReflection(Cairo.ImageSurface source, CairoTexture dest)
        {
            int w = source.Width + 4;
            int h = source.Height * 2 + 4;

            dest.SetSurfaceSize((uint)w, (uint)h);

            Cairo.Context context = dest.Create();

            MakeReflection(context, source, w, h);

            //((IDisposable) context.Target).Dispose ();
            ((IDisposable)context).Dispose();
        }