Ejemplo n.º 1
0
        public object Create(Context context)
        {
            GtkContext c  = (GtkContext)WidgetRegistry.GetBackend(context);
            var        pl = Pango.CairoHelper.CreateLayout(c.Context);

            return(pl);
        }
Ejemplo n.º 2
0
 public object CreateContext(object backend)
 {
     Cairo.Surface sf = (Cairo.Surface) backend;
     GtkContext ctx = new GtkContext ();
     ctx.Context = new Cairo.Context (sf);
     return ctx;
 }
Ejemplo n.º 3
0
        public object CreateContext(object backend)
        {
            Cairo.Surface sf  = (Cairo.Surface)backend;
            GtkContext    ctx = new GtkContext();

            ctx.Context = new Cairo.Context(sf);
            return(ctx);
        }
Ejemplo n.º 4
0
        public void DrawTextLayout(object backend, TextLayout layout, double x, double y)
        {
            Pango.Layout pl  = (Pango.Layout)WidgetRegistry.GetBackend(layout);
            GtkContext   ctx = (GtkContext)backend;

            Gdk.GC gc = ctx.Widget.Style.BlackGC;
            ctx.Widget.GdkWindow.DrawLayout(gc, (int)x, (int)y, pl);
        }
Ejemplo n.º 5
0
        public void DrawTextLayout(object backend, TextLayout layout, double x, double y)
        {
            Pango.Layout pl  = (Pango.Layout)WidgetRegistry.GetBackend(layout);
            GtkContext   ctx = (GtkContext)backend;

            ctx.Context.MoveTo(x, y);
            Pango.CairoHelper.ShowLayout(ctx.Context, pl);
        }
Ejemplo n.º 6
0
 public object CreateContext(Widget w)
 {
     GtkContext ctx = new GtkContext ();
     var b = (IGtkWidgetBackend)WidgetRegistry.GetBackend (w);
     if (!b.Widget.IsRealized) {
         Cairo.Surface sf = new Cairo.ImageSurface (Cairo.Format.ARGB32, 1, 1);
         Cairo.Context c = new Cairo.Context (sf);
         ctx.Context = c;
         ctx.TempSurface = sf;
     } else {
         ctx.Context = Gdk.CairoHelper.Create (b.Widget.GdkWindow);
     }
     return ctx;
 }
Ejemplo n.º 7
0
        public void DrawImage(object backend, object img, double x, double y, double alpha)
        {
            Gdk.Pixbuf pb  = (Gdk.Pixbuf)img;
            GtkContext ctx = (GtkContext)backend;

            Gdk.CairoHelper.SetSourcePixbuf(ctx.Context, pb, x, y);
            if (alpha == 1)
            {
                ctx.Context.Paint();
            }
            else
            {
                ctx.Context.PaintWithAlpha(alpha);
            }
        }
Ejemplo n.º 8
0
        public object CreateContext(Widget w)
        {
            GtkContext ctx = new GtkContext();
            var        b   = (IGtkWidgetBackend)WidgetRegistry.GetBackend(w);

            if (!b.Widget.IsRealized)
            {
                Cairo.Surface sf = new Cairo.ImageSurface(Cairo.Format.ARGB32, 1, 1);
                Cairo.Context c  = new Cairo.Context(sf);
                ctx.Context     = c;
                ctx.TempSurface = sf;
            }
            else
            {
                ctx.Context = Gdk.CairoHelper.Create(b.Widget.GdkWindow);
            }
            return(ctx);
        }
Ejemplo n.º 9
0
        public void DrawImage(object backend, object img, double x, double y, double width, double height, double alpha)
        {
            Gdk.Pixbuf pb  = (Gdk.Pixbuf)img;
            GtkContext ctx = (GtkContext)backend;

            ctx.Context.Save();
            double sx = ((double)width) / pb.Width;
            double sy = ((double)height) / pb.Height;

            ctx.Context.Translate(x, y);
            ctx.Context.Scale(sx, sy);
            Gdk.CairoHelper.SetSourcePixbuf(ctx.Context, pb, 0, 0);
            if (alpha == 1)
            {
                ctx.Context.Paint();
            }
            else
            {
                ctx.Context.PaintWithAlpha(alpha);
            }
            ctx.Context.Restore();

/*			var imgs = new Cairo.ImageSurface (Cairo.Format.ARGB32, pb.Width, pb.Height);
 *                      var ic = new Cairo.Context (imgs);
 *                      Gdk.CairoHelper.SetSourcePixbuf (ic, pb, 0, 0);
 *                      if (alpha == 1)
 *                              ic.Paint ();
 *                      else
 *                              ic.PaintWithAlpha (alpha);
 *
 *                      var sp = new Cairo.SurfacePattern (imgs);
 *                      sp.Extend = Cairo.Extend.None;
 *                      ctx.Context.Rectangle (x, y, width, height);
 *                      ctx.Context.Pattern = sp;
 *                      ctx.Context.Fill ();*/
        }
Ejemplo n.º 10
0
 public object CreateContext()
 {
     GtkContext ctx = new GtkContext ();
     if (!IsRealized) {
         Cairo.Surface sf = new Cairo.ImageSurface (Cairo.Format.ARGB32, 1, 1);
         Cairo.Context c = new Cairo.Context (sf);
         ctx.Context = c;
         ctx.TempSurface = sf;
     } else {
         ctx.Context = Gdk.CairoHelper.Create (GdkWindow);
     }
     return ctx;
 }
Ejemplo n.º 11
0
        public void CurveTo(object backend, double x1, double y1, double x2, double y2, double x3, double y3)
        {
            GtkContext gc = (GtkContext)backend;

            gc.Context.CurveTo(x1, y1, x2, y2, x3, y3);
        }
Ejemplo n.º 12
0
        public object Create(Context context)
        {
            GtkContext c = (GtkContext)WidgetRegistry.GetBackend(context);

            return(new Pango.Layout(c.Widget.PangoContext));
        }
Ejemplo n.º 13
0
        public void Restore(object backend)
        {
            GtkContext gc = (GtkContext)backend;

            gc.Context.Restore();
        }
Ejemplo n.º 14
0
        public void Arc(object backend, double xc, double yc, double radius, double angle1, double angle2)
        {
            GtkContext gc = (GtkContext)backend;

            gc.Context.Arc(xc, yc, radius, (angle1 * System.Math.PI) / 180, (angle2 * System.Math.PI) / 180);
        }
Ejemplo n.º 15
0
        public void MoveTo(object backend, double x, double y)
        {
            GtkContext gc = (GtkContext)backend;

            gc.Context.MoveTo(x, y);
        }
Ejemplo n.º 16
0
        public void Save(object backend)
        {
            GtkContext gc = (GtkContext)backend;

            gc.Context.Save();
        }
Ejemplo n.º 17
0
        public void Translate(object backend, double tx, double ty)
        {
            GtkContext gc = (GtkContext)backend;

            gc.Context.Translate(tx, ty);
        }
Ejemplo n.º 18
0
        public void Rotate(object backend, double angle)
        {
            GtkContext gc = (GtkContext)backend;

            gc.Context.Rotate((angle * System.Math.PI) / 180);
        }
Ejemplo n.º 19
0
        public void ResetTransform(object backend)
        {
            GtkContext gc = (GtkContext)backend;

            gc.Context.IdentityMatrix();
        }
Ejemplo n.º 20
0
        public void LineTo(object backend, double x, double y)
        {
            GtkContext gc = (GtkContext)backend;

            gc.Context.LineTo(x + 0.5, y + 0.5);
        }
Ejemplo n.º 21
0
        public void Rectangle(object backend, double x, double y, double width, double height)
        {
            GtkContext gc = (GtkContext)backend;

            gc.Context.Rectangle(x, y, width, height);
        }