public void DrawImage(Point start, double width, double height, Image image, bool scale, bool masked = false) { double scaleX, scaleY; Point offset; if (scale) { image.ScaleFactor((int)width, (int)height, out scaleX, out scaleY, out offset); } else { offset = new Point(0, 0); scaleX = width / image.Width; scaleY = height / image.Height; } CContext.Save(); CContext.Translate(start.X + offset.X, start.Y + offset.Y); CContext.Scale(scaleX, scaleY); if (masked) { CContext.PushGroup(); Gdk.CairoHelper.SetSourcePixbuf(CContext, image.Value, 0, 0); CContext.Paint(); var src = CContext.PopGroup(); SetColor(FillColor); CContext.Mask(src); src.Dispose(); } else { Gdk.CairoHelper.SetSourcePixbuf(CContext, image.Value, 0, 0); CContext.Paint(); } CContext.Restore(); }
public void Clear(Color color) { SetColor(color); CContext.Operator = Operator.Source; CContext.Paint(); CContext.Operator = Operator.Over; }
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(); } }
public void DrawImage(Image image) { Gdk.CairoHelper.SetSourcePixbuf(CContext, image.Value, 0, 0); CContext.Paint(); }