Ejemplo n.º 1
0
        protected static Image RenderFrameDrawing(IDrawingToolkit tk, Area area, FrameDrawing fd, Image image)
        {
            Image    img;
            ISurface surface;

            Log.Debug("Rendering frame drawing with ROI: " + area);
            surface = tk.CreateSurface((int)area.Width, (int)area.Height);
            using (IContext c = surface.Context) {
                tk.Context = c;
                tk.TranslateAndScale(new Point(-area.Start.X, -area.Start.Y), new Point(1, 1));
                tk.DrawImage(image);
                foreach (Drawable d in fd.Drawables)
                {
                    ICanvasSelectableObject obj = CanvasFromDrawableObject(d);
                    obj.Draw(tk, null);
                    obj.Dispose();
                }
                if (fd.Freehand != null)
                {
                    tk.DrawImage(fd.Freehand);
                }
            }
            img = surface.Copy();
            surface.Dispose();
            return(img);
        }
Ejemplo n.º 2
0
        ICanvasSelectableObject Add(IBlackboardObject drawable)
        {
            ICanvasSelectableObject cso = Utils.CanvasFromDrawableObject(drawable);

            AddObject(cso);
            return(cso);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Reset the list of select objects
 /// </summary>
 public void ClearSelection()
 {
     foreach (Selection sel in Selections)
     {
         ICanvasSelectableObject po = sel.Drawable as ICanvasSelectableObject;
         po.Selected = false;
     }
     if (Objects != null)
     {
         foreach (ICanvasSelectableObject cso in Objects)
         {
             cso.Selected = false;
         }
     }
     Selections.Clear();
 }
Ejemplo n.º 4
0
 public void Paste()
 {
     if (copiedItems != null && copiedItems.Count > 0)
     {
         var selectionsCopy = Selections.ToList();
         ClearSelection();
         foreach (Selection sel in selectionsCopy)
         {
             ICanvasDrawableObject selectionDrawable = sel.Drawable as ICanvasDrawableObject;
             if (selectionDrawable == null)
             {
                 continue;
             }
             var copy = (Drawable)(selectionDrawable.IDrawableObject).Clone();
             copy.Move(SelectionPosition.All, new Point(copy.Area.TopLeft.X + 20, copy.Area.TopLeft.Y + 20),
                       new Point(copy.Area.TopLeft.X, copy.Area.TopLeft.Y));
             drawing.Drawables.Add(copy);
             ICanvasSelectableObject copyView = Add(copy);
             UpdateSelection(new Selection(copyView, sel.Position, sel.Accuracy), false);
         }
         SelectionChanged(Selections);
         widget?.ReDraw();
     }
 }