Exemplo n.º 1
0
        public void DrawSurface(Point start, double width, double height, ISurface surface, ScaleMode mode, bool masked = false)
        {
            //FIXME: This still needs support for masked surfaces
            double scaleX, scaleY;
            Point  offset;

            BaseImage <Pixbuf> .ScaleFactor((int)(surface.Width *surface.DeviceScaleFactor),
                                            (int)(surface.Height *surface.DeviceScaleFactor),
                                            (int)width, (int)height, mode, out scaleX, out scaleY, out offset);

            CContext.Save();
            CContext.Translate(offset.X + start.X, offset.Y + start.Y);
            CContext.Scale(scaleX, scaleY);
            if (masked)
            {
                CContext.PushGroup();
            }
            ImageSurface image = surface.Value as ImageSurface;

            CContext.SetSourceSurface(image, 0, 0);
            CContext.Rectangle(0, 0, image.Width, image.Height);
            CContext.Fill();
            if (masked)
            {
                var src = CContext.PopGroup();
                SetColor(FillColor);
                CContext.Mask(src);
                src.Dispose();
            }
            CContext.Restore();
        }
Exemplo n.º 2
0
 public void DrawRectangle(Point start, double width, double height)
 {
     CContext.Rectangle(new global::Cairo.Rectangle(start.X + LineWidth / 2,
                                                    start.Y + LineWidth / 2,
                                                    width - LineWidth,
                                                    height - LineWidth));
     StrokeAndFill(false);
 }
Exemplo n.º 3
0
 public void Clip(Area area)
 {
     if (!disableScalling)
     {
         CContext.Rectangle(area.Start.X, area.Start.Y,
                            area.Width, area.Height);
         CContext.Clip();
     }
 }
Exemplo n.º 4
0
        public void DrawSurface(ISurface surface, Point p = null)
        {
            ImageSurface image;

            image = surface.Value as ImageSurface;
            if (p == null)
            {
                CContext.SetSourceSurface(image, 0, 0);
                CContext.Paint();
            }
            else
            {
                CContext.SetSourceSurface(image, (int)p.X, (int)p.Y);
                CContext.Rectangle(p.X, p.Y, image.Width, image.Height);
                CContext.Fill();
            }
        }
Exemplo n.º 5
0
 public void Clip(Area area)
 {
     CContext.Rectangle(area.Start.X, area.Start.Y,
                        area.Width, area.Height);
     CContext.Clip();
 }