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(); }
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(); } }