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); }
public override void Draw(IDrawingToolkit tk, Area area) { double linepos; if (!UpdateDrawArea(tk, area, Area)) { return; } tk.Begin(); if (needle == null) { string path = Path.Combine(Config.IconsDir, StyleConf.TimelineNeedleUP); Image img = Image.LoadFromFile(path); needle = tk.CreateSurface(img.Width, img.Height, img); } if (Selected) { tk.FillColor = Config.Style.PaletteActive; tk.StrokeColor = Config.Style.PaletteActive; } else { tk.FillColor = LineColor; tk.StrokeColor = LineColor; } tk.LineWidth = StyleConf.TimelineLineSize; linepos = OffsetY + Height / 2 + StyleConf.TimelineLineSize / 2; if (StopX - StartX <= needle.Width / 2) { double c = movingPos == SelectionPosition.Left ? StopX : StartX; tk.DrawSurface(needle, new Point(c - needle.Width / 2, linepos - 9)); } else { tk.DrawLine(new Point(StartX, linepos), new Point(StopX, linepos)); tk.DrawSurface(needle, new Point(StartX - needle.Width / 2, linepos - 9)); tk.DrawSurface(needle, new Point(StopX - needle.Width / 2, linepos - 9)); } if (ShowName) { tk.FontSize = StyleConf.TimelineFontSize; tk.FontWeight = FontWeight.Bold; tk.FillColor = Config.Style.PaletteActive; tk.StrokeColor = Config.Style.PaletteActive; tk.DrawText(new Point(StartX, OffsetY), StopX - StartX, Height / 2, TimeNode.Name); } tk.End(); }
void CreateBackBufferSurface() { IDrawingToolkit tk = App.Current.DrawingToolkit; ResetBackbuffer(); backBufferSurface = tk.CreateSurface((int)Width, (int)Height); using (IContext c = backBufferSurface.Context) { tk.Context = c; DrawBackBuffer(tk); } }
void CreateBackBufferSurface() { IDrawingToolkit tk = App.Current.DrawingToolkit; ResetBackbuffer(); backBufferSurface = tk.CreateSurface((int)Width, (int)Height); using (IContext c = backBufferSurface.Context) { tk.Context = c; tk.TranslateAndScale(new Point(-Position.X, -Position.Y), new Point(1, 1)); DrawBackground(tk); DrawIcon(tk); } }
void CreateBackBufferSurface() { IDrawingToolkit tk = Config.DrawingToolkit; ResetBackbuffer(); backBufferSurface = tk.CreateSurface((int)Width, (int)Height); using (IContext c = backBufferSurface.Context) { tk.Context = c; tk.TranslateAndScale(new Point(-Position.X, -Position.Y), new Point(1, 1)); DrawButton(tk); DrawImage(tk); DrawText(tk); } }
public override void Draw(IDrawingToolkit tk, Area area) { double linepos; if (!UpdateDrawArea (tk, area, Area)) { return; } tk.Begin (); if (needle == null) { string path = Path.Combine (Config.IconsDir, StyleConf.TimelineNeedleUP); Image img = Image.LoadFromFile (path); needle = tk.CreateSurface (img.Width, img.Height, img); } if (Selected) { tk.FillColor = Config.Style.PaletteActive; tk.StrokeColor = Config.Style.PaletteActive; } else { tk.FillColor = LineColor; tk.StrokeColor = LineColor; } tk.LineWidth = StyleConf.TimelineLineSize; linepos = OffsetY + Height / 2 + StyleConf.TimelineLineSize / 2; if (StopX - StartX <= needle.Width / 2) { double c = movingPos == SelectionPosition.Left ? StopX : StartX; tk.DrawSurface (needle, new Point (c - needle.Width / 2, linepos - 9)); } else { tk.DrawLine (new Point (StartX, linepos), new Point (StopX, linepos)); tk.DrawSurface (needle, new Point (StartX - needle.Width / 2, linepos - 9)); tk.DrawSurface (needle, new Point (StopX - needle.Width / 2, linepos - 9)); } if (ShowName) { tk.FontSize = StyleConf.TimelineFontSize; tk.FontWeight = FontWeight.Bold; tk.FillColor = Config.Style.PaletteActive; tk.StrokeColor = Config.Style.PaletteActive; tk.DrawText (new Point (StartX, OffsetY), StopX - StartX, Height / 2, TimeNode.Name); } tk.End (); }
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 (); } tk.DrawImage (fd.Freehand); } img = surface.Copy (); surface.Dispose (); return img; }