protected override void onDraw(Context gr) { base.onDraw(gr); Rectangle r = ClientRectangle; Foreground.SetAsSource(gr, r); gr.Rectangle(r, 0.1); gr.Stroke(); r.Width = _pic.Dimensions.Width * zoom / 100; r.Height = _pic.Dimensions.Height * zoom / 100; gr.Save(); editorMutex.EnterReadLock(); gr.Translate(-ScrollX, -ScrollY); if (_pic != null) { _pic.Paint(gr, r); } editorMutex.ExitReadLock(); gr.Restore(); }
void onStartDrag(object sender, EventArgs e) { GraphicObject go = sender as GraphicObject; lock (go.IFace.UpdateMutex) { go.IFace.DragImageHeight = dragIconSize; go.IFace.DragImageWidth = dragIconSize; SvgPicture pic = new SvgPicture(); pic.Load(go.IFace, IconPath); ImageSurface img = new ImageSurface(Format.Argb32, dragIconSize, dragIconSize); using (Context ctx = new Context(img)) { Rectangle r = new Rectangle(0, 0, dragIconSize, dragIconSize); pic.Paint(ctx, r); ctx.Operator = Operator.In; ctx.SetSourceRGBA(1.0, 1.0, 1.0, 1.0); ctx.Rectangle(r); ctx.Fill(); } go.IFace.DragImage = img; } }