/// <Docs>The Canvas to which the View is rendered.</Docs> /// <summary> /// Draw the specified canvas. /// </summary> /// <param name="canvas">Canvas.</param> public override void Draw(Android.Graphics.Canvas canvas) { if (Element == null) { base.Draw(canvas); return; } // Should we clip? if (Element.IsClippedToBounds) { canvas.ClipRect(new Android.Graphics.Rect(0, 0, Width, Height), Region.Op.Replace); } // Draws the background and default android setup. Children will also be redrawn here base.Draw(canvas); // Perform custom drawing from the NGraphics subsystems var ncanvas = new CanvasCanvas(canvas); var rect = new NGraphics.Rect(0, 0, Width, Height); Element.Draw(ncanvas, rect); // Redraw children - since we might have a composite control containing both children // and custom drawing code, we want children to be drawn last. The reason for this double- // drawing is that the base.Draw(canvas) call will handle background which is needed before // doing NGraphics drawing - but unfortunately it also draws children - which then will // be drawn below NGraphics drawings. for (var i = 0; i < ChildCount; i++) { GetChildAt(i).Draw(canvas); } }
/// <Docs>The Canvas to which the View is rendered.</Docs> /// <summary> /// Draw the specified canvas. /// </summary> /// <param name="canvas">Canvas.</param> public override void Draw(Android.Graphics.Canvas canvas) { if (Element == null) { base.Draw(canvas); return; } // Draws the background and default android setup. Children will also be redrawn here // base.Draw(canvas); // Set up clipping if (Element.IsClippedToBounds) { canvas.ClipRect(new Android.Graphics.Rect(0, 0, Width, Height)); } // Perform custom drawing from the NGraphics subsystems var ncanvas = new CanvasCanvas(canvas); var rect = new NGraphics.Rect(0, 0, Width, Height); // Fill background ncanvas.FillRectangle(rect, new NGraphics.Color(Element.BackgroundColor.R, Element.BackgroundColor.G, Element.BackgroundColor.B, Element.BackgroundColor.A)); // Custom drawing Element.Draw(ncanvas, rect); // Redraw children - since we might have a composite control containing both children // and custom drawing code, we want children to be drawn last. The reason for this double- // drawing is that the base.Draw(canvas) call will handle background which is needed before // doing NGraphics drawing - but unfortunately it also draws children - which then will // be drawn below NGraphics drawings. base.Draw(canvas); }
public void DrawImage (IImage image, Rect frame, double alpha = 1.0) { var ch = GetChild (ChildType.Image); var s = (Shapes.Rectangle)ch.Shape; s.Width = frame.Width; s.Height = frame.Height; }
public override void Draw(NGraphics.ICanvas canvas, NGraphics.Rect rect) { base.Draw(canvas, rect); rect.Inflate(-10, -10); canvas.DrawRectangle(rect, Pens.Blue, null); }
/// <summary> /// Draw the specified canvas. /// </summary> /// <param name="canvas">Canvas.</param> /// <param name="rect">Rect.</param> public override void Draw(NGraphics.ICanvas canvas, NGraphics.Rect rect) { base.Draw(canvas, rect); canvas.DrawLine(0, rect.Height - 0.5, rect.Width, rect.Height - 0.5, NGraphics.Colors.Gray, 0.5); canvas.DrawEllipse(new Rect(-rect.Width / 3, 0, rect.Width, rect.Width), null, Brushes.Red); }
NPoint CalculateEventPoint(IReadOnlyList <MonitorEvent> events, int index, NRect frame) { var x = (index + 1) * frame.Width / (events.Count + 1); var y = (1 - events[index].Value) * frame.Height; return(new NPoint(x, y)); }
public Text (Rect frame, Font font, TextAlignment alignment = TextAlignment.Left, Pen pen = null, Brush brush = null) : base (pen, brush) { Frame = frame; Font = font; Alignment = alignment; Spans = new List<TextSpan> (); }
public Text (string text, Rect frame, Font font, TextAlignment alignment = TextAlignment.Left, Pen pen = null, Brush brush = null) : base (pen, brush) { Frame = frame; Font = font; Alignment = alignment; Spans = new List<TextSpan> { new TextSpan (text) }; }
public Text(string text, Rect frame, Font font, TextAlignment alignment = TextAlignment.Left, Pen pen = null, Brush brush = null) : base(pen, brush) { String = text; Frame = frame; Font = font; Alignment = alignment; }
public void DrawEllipse (Rect frame, Pen pen = null, Brush brush = null) { var ch = GetChild (ChildType.Ellipse); var s = (Shapes.Rectangle)ch.Shape; s.Width = frame.Width; s.Height = frame.Height; FormatShape (s, pen, brush); }
protected override void OnDraw(Android.Graphics.Canvas canvasDroid) { base.OnDraw(canvasDroid); var canvas = new CanvasCanvas(canvasDroid); var rect = new NGraphics.Rect(GetX(), GetY(), Width, Height); this.Draw(canvas, rect); }
public override void Draw(NGraphics.ICanvas canvas, NGraphics.Rect rect) { if (BackgroundColor == Xamarin.Forms.Color.Transparent && BorderColor == Xamarin.Forms.Color.Transparent) { return; } CustomPainter.Paint(this, canvas, rect); }
public Rect TransformRect (Rect rect) { var bbb = new BoundingBoxBuilder (); bbb.Add (TransformPoint (rect.TopLeft)); bbb.Add (TransformPoint (rect.BottomLeft)); bbb.Add (TransformPoint (rect.BottomRight)); bbb.Add (TransformPoint (rect.TopRight)); return bbb.BoundingBox; }
public override void Draw(ICanvas canvas, Rect rect) { if(DrawingFunction != null) { base.Draw(canvas, rect); return; } var borderColro = NGraphics.Color.FromHSL( BorderColor.Hue, BorderColor.Saturation, BorderColor.Luminosity, BorderColor.A); var pen = new Pen(borderColro, BorderWidth); var fillColor = NGraphics.Color.FromHSL( BackColor.Hue, BackColor.Saturation, BackColor.Luminosity, BackColor.A); var brush = new SolidBrush(fillColor); var padding = BorderWidth <= 0 ? 0.0 : BorderWidth; var newRect = rect.GetInflated(-padding); var curveSize = newRect.Height / 2; canvas.DrawPath(new PathOp []{ new MoveTo(newRect.Left+curveSize, newRect.Top), new LineTo(newRect.Right-curveSize, newRect.Top), new CurveTo( new NGraphics.Point(newRect.Right-curveSize, newRect.Top), newRect.TopRight, new NGraphics.Point(newRect.Right, newRect.Top+curveSize) ), new CurveTo( new NGraphics.Point(newRect.Right, newRect.Bottom-curveSize), newRect.BottomRight, new NGraphics.Point(newRect.Right-curveSize, newRect.Bottom) ), new LineTo(newRect.Left+curveSize, newRect.Bottom), new CurveTo( new NGraphics.Point(newRect.Left+curveSize, newRect.Bottom), newRect.BottomLeft, new NGraphics.Point(newRect.Left, newRect.Bottom-curveSize) ), new CurveTo( new NGraphics.Point(newRect.Left, newRect.Top+curveSize), newRect.TopLeft, new NGraphics.Point(newRect.Left+curveSize, newRect.Top) ), new ClosePath() }, pen, brush); }
void Read (XDocument doc) { var svg = doc.Root; var ns = svg.Name.Namespace; // // Find the defs (gradients) // foreach (var d in svg.Descendants ()) { var idA = d.Attribute ("id"); if (idA != null) { defs [ReadString (idA).Trim ()] = d; } } // // Get the dimensions // var widthA = svg.Attribute ("width"); var heightA = svg.Attribute ("height"); var width = ReadNumber (widthA); var height = ReadNumber (heightA); var size = new Size (width, height); var viewBox = new Rect (size); var viewBoxA = svg.Attribute ("viewBox") ?? svg.Attribute ("viewPort"); if (viewBoxA != null) { viewBox = ReadRectangle (viewBoxA.Value); } if (widthA != null && widthA.Value.Contains ("%")) { size.Width *= viewBox.Width; } if (heightA != null && heightA.Value.Contains ("%")) { size.Height *= viewBox.Height; } // // Add the elements // Graphic = new Graphic (size, viewBox); AddElements (Graphic.Children, svg.Elements (), null, Brushes.Black); }
/// <summary> /// Draw the specified canvas. /// </summary> /// <param name="canvas">Canvas.</param> /// <param name="rect">Rect.</param> public override void Draw(NGraphics.ICanvas canvas, NGraphics.Rect rect) { base.Draw(canvas, rect); var backgroundBrush = new SolidBrush(new NGraphics.Color(BackgroundColor.R, BackgroundColor.G, BackgroundColor.B, BackgroundColor.A)); var curveSize = CornerRadius; var width = rect.Width; var height = rect.Height; canvas.DrawPath(new PathOp [] { new MoveTo(curveSize, 0), // Top Right corner new LineTo(width - curveSize, 0), new CurveTo( new NGraphics.Point(width - curveSize, 0), new NGraphics.Point(width, 0), new NGraphics.Point(width, curveSize) ), new LineTo(width, height - curveSize), // Bottom right corner new CurveTo( new NGraphics.Point(width, height - curveSize), new NGraphics.Point(width, height), new NGraphics.Point(width - curveSize, height) ), new LineTo(curveSize, height), // Bottom left corner new CurveTo( new NGraphics.Point(curveSize, height), new NGraphics.Point(0, height), new NGraphics.Point(0, height - curveSize) ), new LineTo(0, curveSize), new CurveTo( new NGraphics.Point(0, curveSize), new NGraphics.Point(0, 0), new NGraphics.Point(curveSize, 0) ), new ClosePath() }, null, backgroundBrush); }
public override void Draw(NGraphics.ICanvas canvas, NGraphics.Rect rect) { base.Draw(canvas, rect); const double delta = -10.0; const double yOffset = 20; var width = rect.Width; var height = rect.Height; var points = new PathOp[] { new MoveTo(0, yOffset - delta), new CurveTo(new NGraphics.Point(width / 2, yOffset + delta), new NGraphics.Point(width / 2, yOffset + delta), new NGraphics.Point(width, yOffset - delta)), new LineTo(width, height), new LineTo(0, height) }; canvas.DrawPath(points, null, new SolidBrush(new NGraphics.Color(0, 0.722, 1, 1))); }
public override void Draw(NGraphics.ICanvas canvas, NGraphics.Rect rect) { DrawBackground(canvas, rect); LastRect = rect; // 0.65 RadiusAll = Math.Min(rect.Width, rect.Height - textHeight) / 2.0; if (IsTitleOnTop) { Center = new NGraphics.Point(rect.Center.X, rect.Center.Y + textHeight); } else { Center = new NGraphics.Point(rect.Center.X, rect.Center.Y - textHeight); } double pullLength = RadiusAll.Value * PullRatio; double radius = RadiusAll.Value - (RadiusAll.Value * PullRatio); double sumRadian = StartRadian; foreach (var eachSegment in ListItems) { sumRadian = eachSegment.DrawSegment(canvas, rect.Center, radius, sumRadian, pullLength, Font, TextColor, IsNameVisible, PercentColor, IsPercentVisible, ValueColor, IsValueVisible); } Rect rectText; if (IsTitleOnTop) { rectText = new Rect(rect.Center.X, rect.Center.Y - RadiusAll.Value - textHeight / 4.0, 20, 20); } else { rectText = new Rect(rect.Center.X, rect.Center.Y + RadiusAll.Value + textHeight / 4.0, 20, 20); } canvas.DrawText(Title ?? "", rectText, new NGraphics.Font(), NGraphics.TextAlignment.Center, new Pen(TitleColor.ToCross()), new SolidBrush(TitleColor.ToCross())); }
public void DrawText(string text, Rect frame, Font font, TextAlignment alignment = TextAlignment.Left, Pen pen = null, Brush brush = null) { if (string.IsNullOrEmpty (text)) return; if (font == null) throw new ArgumentNullException ("font"); SetBrush (brush); // string fontName = font.Name; // context.SelectFont (font.Name, (nfloat)font.Size, CGTextEncoding.MacRoman); // // context.ShowTextAtPoint ((nfloat)frame.X, (nfloat)frame.Y, text); var pt = frame.TopLeft; using (var atext = new NSMutableAttributedString (text)) { atext.AddAttributes (new CTStringAttributes { ForegroundColorFromContext = true, Font = font.GetCTFont (), }, new NSRange (0, text.Length)); using (var l = new CTLine (atext)) { nfloat asc, desc, lead; var width = l.GetTypographicBounds (out asc, out desc, out lead); context.SaveState (); context.TranslateCTM ((nfloat)(pt.X - width / 2), (nfloat)(pt.Y + desc)); context.TextPosition = CGPoint.Empty; l.Draw (context); context.RestoreState (); } } }
public void DrawRectangle(Rect frame, Pen pen = null, Brush brush = null) { if (pen == null && brush == null) return; DrawElement (() => { context.AddRect (Conversions.GetCGRect (frame)); return frame; }, pen, brush); }
public void DrawImage(IImage image, Rect frame, double alpha = 1.0) { var cgi = image as CGImageImage; if (cgi != null) { var i = cgi.Image; var h = frame.Height; context.SaveState (); context.SetAlpha ((nfloat)alpha); context.TranslateCTM ((nfloat)frame.X, (nfloat)(h + frame.Y)); context.ScaleCTM (1, -1); context.DrawImage (new CGRect (0, 0, (nfloat)frame.Width, (nfloat)frame.Height), cgi.Image); context.RestoreState (); } }
public SurfaceImageSourceCanvas(SurfaceImageSource surfaceImageSource, Rect updateRect, Direct2DFactories factories = null) : base(factories) { sisn = ComObject.As<DXGI.ISurfaceImageSourceNative> (surfaceImageSource); SharpDX.Point offset; var surface = sisn.BeginDraw (updateRect.ToRectangle (), out offset); var dpi = 96.0; var properties = new D2D1.RenderTargetProperties (D2D1.RenderTargetType.Default, new D2D1.PixelFormat (DXGI.Format.Unknown, D2D1.AlphaMode.Unknown), (float)(dpi), (float)(dpi), D2D1.RenderTargetUsage.None, D2D1.FeatureLevel.Level_DEFAULT); Initialize (new D2D1.RenderTarget (this.factories.D2DFactory, surface, properties)); }
void DrawBackground(ICanvas canvas, NGraphics.Rect rect) { canvas.DrawRectangle(rect, new Pen(BackgroundColor.ToCross()), new SolidBrush(BackgroundColor.ToCross())); }
public Point GetAbsoluteEnd(Rect frame) { if (Absolute) return End; return frame.TopLeft + End * frame.Size; }
/// <summary> /// Draws an image /// </summary> /// <param name="image"></param> /// <param name="frame"></param> /// <param name="alpha"></param> public void DrawImage(IImage image, Rect frame, double alpha = 1.0) { var ii = image as BitmapImageImage; if (ii != null) { var imageEl = new Image(); imageEl.Source = ii.Bitmap; imageEl.Width = frame.Width; imageEl.Height = frame.Height; imageEl.RenderTransform = Conversions.GetTransform(CurrentTransform); _canvas.Children.Add(imageEl); Canvas.SetLeft(imageEl, frame.X); Canvas.SetTop(imageEl, frame.Y); } }
public GraphCell() : base() { StackLayout dateLayout; Label dateLabel; /* Used when drawing. */ var points = new List <NPoint>(); var pointSize = new NSize(CaptionSize * 5 / 6); var halfPoint = pointSize / 2; View = dataView = new NControlView { Content = new StackLayout { //BackgroundColor = MainApp.RandomColor(), Orientation = StackOrientation.Horizontal, Children = { (dateLayout = new StackLayout { HorizontalOptions = LayoutOptions.EndAndExpand, //Padding = new Thickness(7, 0), WidthRequest = SpaceUnderGraph, Children = { (dateLabel = new Label { HorizontalTextAlignment = TextAlignment.Center, VerticalOptions = LayoutOptions.CenterAndExpand, Rotation = -90, Style = StyleKit.AutoDarkLabelStyles.Caption, //FontSize = 12, BindingContext = this }) } }) } }, DrawingFunction = (canvas, rect) => { /* Transforms for natural drawing - as in the end, the whole graph is rotated 90 degrees! */ canvas.Rotate(-90); canvas.Translate(-rect.Height, halfPoint.Height); rect = new NRect(NPoint.Zero, new NSize(rect.Size.Height, rect.Size.Width - dateLayout.Width - pointSize.Height)); //canvas.DrawLine(rect.BottomLeft, rect.BottomRight, Colors.Black, 2); if (Data == null) { return; } points.Clear(); /* Add past points */ var yesterday = Data.Yesterday; if (yesterday?.Events?.Count == 1) { var beforeYesterday = yesterday?.Yesterday; points.AddRange(CalculateEventPoints(beforeYesterday?.Events, rect, -2)); } points.AddRange(CalculateEventPoints(yesterday?.Events, rect, -1)); /* Add today's points */ points.AddRange(CalculateEventPoints(Data.Events, rect)); /* Add future points */ var tomorrow = Data.Tomorrow; points.AddRange(CalculateEventPoints(tomorrow?.Events, rect, 1)); if (tomorrow?.Events?.Count == 1) { var afterTomorrow = tomorrow?.Tomorrow; points.AddRange(CalculateEventPoints(afterTomorrow?.Events, rect, 2)); } if (Data.Events.Count > 0) { var path = new Path(pen: new Pen(Colors.Black, pointSize.Width / 4)); path.MoveTo(points[0]); for (int i = 1; i < points.Count; i++) { path.Operations.Add(SplineTo( from: points[i - 1], to: points[i], beforeFrom: i >= 2 ? points[i - 2] : points[i - 1] - (points[i] - points[i - 1]).WithY(0), afterTo: i <= points.Count - 2 ? points[i + 1] : points[i] + (points[i] - points[i - 1]).WithY(0) )); } path.Draw(canvas); } foreach (var p in points) { if (p.X >= -halfPoint.Width && p.X <= rect.Width + halfPoint.Width) { canvas.FillEllipse(p - halfPoint, pointSize, Colors.Black); canvas.FillEllipse(p - halfPoint * 4 / 5, pointSize * 4 / 5, Colors.White); } } /* canvas.DrawText(Math.Round(data.Value * 5 + 1, 1).ToString("F1"), * rect.Center, new NFont(), Colors.Black); */ } }; View.SizeChanged += (sender, e) => dataView.Invalidate(); dateLabel.SetBinding <GraphCell, DateTime, string>(Label.TextProperty, cell => cell.Data.Day, dt => dt.ToString("ddd\ndd/MM")); dateLabel.SizeChanged += (sender, e) => dataView.Invalidate(); }
public Size GetAbsoluteRadius(Rect frame) { if (Absolute) return Radius; return Radius * frame.Size; }
public Point GetAbsoluteCenter(Rect frame) { if (Absolute) return Center; return frame.TopLeft + Center * frame.Size; }
public override void Draw(NGraphics.ICanvas canvas, NGraphics.Rect rect) { //base.Draw(canvas, rect); //canvas.DrawLine(rect.Left, rect.Top, rect.Width, rect.Height, NGraphics.Colors.Blue); //canvas.DrawLine(rect.Width, rect.Top, rect.Left, rect.Height, NGraphics.Colors.Yellow); }
/// <summary> /// Draws text /// </summary> /// <param name="text"></param> /// <param name="frame"></param> /// <param name="font"></param> /// <param name="alignment"></param> /// <param name="pen"></param> /// <param name="brush"></param> public void DrawText(string text, Rect frame, Font font, TextAlignment alignment = TextAlignment.Left, Pen pen = null, NGraphics.Brush brush = null) { var textBlock = new TextBlock(); textBlock.Text = text; textBlock.Width = frame.Width; textBlock.Height = frame.Height; Canvas.SetLeft(textBlock, frame.X); Canvas.SetTop(textBlock, frame.Y); textBlock.FontFamily = new FontFamily(font.Family); textBlock.FontSize = font.Size; switch (alignment) { case TextAlignment.Left: textBlock.TextAlignment = System.Windows.TextAlignment.Left; break; case TextAlignment.Center: textBlock.TextAlignment = System.Windows.TextAlignment.Center; break; case TextAlignment.Right: textBlock.TextAlignment = System.Windows.TextAlignment.Right; break; } if (pen != null) textBlock.Foreground = new SolidColorBrush(new System.Windows.Media.Color { A = pen.Color.A, R = pen.Color.R, G = pen.Color.G, B = pen.Color.B }); textBlock.RenderTransform = Conversions.GetTransform(CurrentTransform); _canvas.Children.Add(textBlock); }
/// <summary> /// Draws an ellipse /// </summary> /// <param name="frame"></param> /// <param name="pen"></param> /// <param name="brush"></param> public void DrawEllipse(Rect frame, Pen pen = null, NGraphics.Brush brush = null) { var ellipseEl = new System.Windows.Shapes.Ellipse(); var offset = pen != null ? pen.Width : 0.0; ellipseEl.Width = frame.Width + offset; ellipseEl.Height = frame.Height + offset; if (brush != null) ellipseEl.Fill = GetBrush(brush); if (pen != null) { ellipseEl.Stroke = GetStroke(pen); ellipseEl.StrokeThickness = pen.Width; } ellipseEl.RenderTransform = Conversions.GetTransform(CurrentTransform); _canvas.Children.Add(ellipseEl); Canvas.SetLeft(ellipseEl, frame.X - offset / 2.0); Canvas.SetTop(ellipseEl, frame.Y - offset / 2.0); }
public void DrawRectangle(Rect frame, Pen pen = null, Brush brush = null) { var p = GetBrush (pen); var b = GetBrush (frame, brush); if (b != null) { renderTarget.FillRectangle (frame.ToRectangleF (), b); } if (p != null) { renderTarget.DrawRectangle (frame.ToRectangleF (), p, (float)pen.Width, GetStrokeStyle (pen)); } }
static IImage RenderSectionToImage (/*this*/ Graphic graphics, Rect sourceFrame, Rect outputFrame, double finalScale, Func<Size, double, IImageCanvas> createPlatformImageCanvas) { var originalSize = graphics.Size; var sectionCanvas = createPlatformImageCanvas (outputFrame.Size, finalScale); // Redraw into final version with any scaling between the original and the output slice. var sliceVerticalScale = outputFrame.Height / sourceFrame.Height; var sliceHorizontalScale = outputFrame.Width / sourceFrame.Width; // Potentially setting ViewBox size smaller to enlarge result. graphics.ViewBox = new Rect (sourceFrame.Position, new Size (originalSize.Width / sliceHorizontalScale, originalSize.Height / sliceVerticalScale)); graphics.Draw (sectionCanvas); return sectionCanvas.GetImage (); }
public void DrawText(string text, Rect frame, Font font, TextAlignment alignment = TextAlignment.Left, Pen pen = null, Brush brush = null) { var layout = new DW.TextLayout (factories.DWFactory, text, GetTextFormat (font), (float)frame.Width, (float)frame.Height); var h = layout.Metrics.Height; renderTarget.DrawTextLayout ((frame.TopLeft - h*Point.OneY).ToVector2 (), layout, GetBrush (frame, brush)); }
public Point GetAbsoluteStart(Rect frame) { if (Absolute) return Start; return frame.TopLeft + Start * frame.Size; }
D2D1.Brush GetBrush(Rect frame, Brush brush) { if (brush == null) return null; var sb = brush as SolidBrush; if (sb != null) { return new D2D1.SolidColorBrush (renderTarget, sb.Color.ToColor4 ()); } var lgb = brush as LinearGradientBrush; if (lgb != null) { if (lgb.Stops.Count < 2) return null; var props = new D2D1.LinearGradientBrushProperties { StartPoint = lgb.GetAbsoluteStart (frame).ToVector2 (), EndPoint = lgb.GetAbsoluteEnd (frame).ToVector2 (), }; return new D2D1.LinearGradientBrush (renderTarget, props, GetStops (lgb.Stops)); } var rgb = brush as RadialGradientBrush; if (rgb != null) { if (rgb.Stops.Count < 2) return null; var rad = rgb.GetAbsoluteRadius (frame); var center = rgb.GetAbsoluteCenter (frame); var focus = rgb.GetAbsoluteFocus (frame); var props = new D2D1.RadialGradientBrushProperties { Center = center.ToVector2 (), RadiusX = (float)rad.Width, RadiusY = (float)rad.Height, GradientOriginOffset = (focus - center).ToVector2 (), }; return new D2D1.RadialGradientBrush (renderTarget, props, GetStops (rgb.Stops)); } // TODO: Radial gradient brushes return new D2D1.SolidColorBrush (renderTarget, Colors.Black.ToColor4 ()); }
public Point GetAbsoluteFocus(Rect frame) { if (Absolute) return Focus; return frame.TopLeft + Focus * frame.Size; }
public void DrawRectangle(Rect frame, Pen pen = null, Brush brush = null) { }
public void DrawEllipse(Rect frame, Pen pen = null, Brush brush = null) { }
IEnumerable <NPoint> CalculateEventPoints(IReadOnlyList <MonitorEvent> events, NRect frame, int offset = 0) { return(events != null?events.Select((ev, i) => CalculateEventPoint(events, i, frame)) .Select(p => p.WithX(p.X + offset * frame.Width)) : new List <NPoint>()); }
public void DrawText(string text, Rect frame, Font font, TextAlignment alignment = TextAlignment.Left, Pen pen = null, Brush brush = null) { }
public void DrawEllipse(Rect frame, Pen pen = null, Brush brush = null) { var p = GetBrush (pen); var b = GetBrush (frame, brush); var c = frame.Center; var s = new D2D1.Ellipse (new Vector2 ((float)c.X, (float)c.Y), (float)(frame.Width / 2.0), (float)(frame.Height / 2.0)); if (b != null) { renderTarget.FillEllipse (s, b); } if (p != null) { renderTarget.DrawEllipse (s, p, (float)pen.Width, GetStrokeStyle (pen)); } }
public void DrawImage(IImage image, Rect frame, double alpha = 1.0) { }
public void DrawImage(IImage image, Rect frame, double alpha = 1.0) { var i = GetImage (image); renderTarget.DrawBitmap (i, frame.ToRectangleF (), (float)alpha, D2D1.BitmapInterpolationMode.Linear); }