public override void Render(DrawingContext context) { var render = new ColorSquareRender(Bounds, null, ColorToRender, StrokeColor, StrokeWidth); SquareRender = render; context.Custom(render); }
public override void Render(DrawingContext context) { var source = Source; var mem = new MemoryStream(); Source.Save(mem); if (source != null && mem.Length > 0 && Bounds.Width > 0 && Bounds.Height > 0) { Rect viewPort = new Rect(Bounds.Size); Size sourceSize = source.Size; Vector scale = Stretch.CalculateScaling(Bounds.Size, sourceSize, StretchDirection); Size scaledSize = sourceSize * scale; Rect destRect = viewPort .CenterRect(new Rect(scaledSize)) .Intersect(viewPort); Rect sourceRect = new Rect(sourceSize) .CenterRect(new Rect(destRect.Size / scale)); var interpolationMode = RenderOptions.GetBitmapInterpolationMode(this); context.Custom(new BlurImageRender(mem, destRect, sourceRect, BlurLevel, BlurLevel, null)); // Dispatcher.UIThread.InvokeAsync(InvalidateVisual, DispatcherPriority.Background); } }
public override void Render(DrawingContext context) { var noSkia = new FormattedText("Current rendering API is not Skia", CultureInfo.CurrentCulture, FlowDirection.LeftToRight, Typeface.Default, 12, Brushes.Black); context.Custom(new CustomDrawOp(new Rect(0, 0, Bounds.Width, Bounds.Height), noSkia)); Dispatcher.UIThread.InvokeAsync(InvalidateVisual, DispatcherPriority.Background); }
public override void Render(DrawingContext context) { var noSkia = new FormattedText() { Text = "Current rendering API is not Skia" }; context.Custom(new CustomDrawOp(new Rect(0, 0, Bounds.Width, Bounds.Height), noSkia)); Dispatcher.UIThread.InvokeAsync(InvalidateVisual, DispatcherPriority.Background); }
public override void Render(DrawingContext context) { if (this.ProjectWidth == 0 || double.IsInfinity(this.ProjectWidth)) { ProjectChanged(); } UpdateVerticalSlider(this, null); UpdateHorizontalSlider(this, null); UpdateMinZoomValue(); context.Custom(new DominoRenderer(this)); ForceRedraw = false; }
protected void RenderCustomHsvDial(DrawingContext context) { var sw = new Stopwatch(); sw.Start(); //var f = new FormattedText() { Text = "Available for Skia Rendering only" }; context.Custom(new ColorHSVWheelRender(Bounds, null, 0f, (Color)this.FindResource("ThemeBorderLowColor"))); //Dispatcher.UIThread.InvokeAsync(InvalidateVisual, DispatcherPriority.Background); sw.Stop(); Debug.WriteLine($"takes {sw.ElapsedMilliseconds} MS to render"); }
public override void Render(DrawingContext context) { try { this.Bounds = new Rect(new Point(0, 0), new Size(this.Width, this.Height)); context.Custom(_RenderOperation); // не совсем понятно чем отличается IvokeAsync и Post, мне кажется порядком вызова Dispatcher.UIThread.InvokeAsync(InvalidateVisual, DispatcherPriority.Background); //Dispatcher.UIThread.Post(InvalidateVisual, DispatcherPriority.Background); base.Render(context); } catch (Exception e) { Console.WriteLine(e); throw; } }
public override void Render(DrawingContext context) { if (!_isInitialized) { CreateWindow(); OnRendererInitialized(); _isInitialized = true; } if (!IsStarted || Image == null) { return; } if (DrawOperation != null) { context.Custom(DrawOperation); } base.Render(context); }
public override void Render(DrawingContext context) { base.Render(context); _diagramRenderer.SetGuitarModel(ViewModels.MainViewModel.GuitarModel); context.Custom(_customDrawingOp); //Dispatcher.UIThread.InvokeAsync(InvalidateVisual, DispatcherPriority.Background); var diagramWidth = _diagramRenderer.GetDiagramWidth() * 4; var diagramHeight = _diagramRenderer.GetFretboardHeight() * 2; if (this.Width != diagramWidth) { this.Width = diagramWidth; } if (this.Height != diagramWidth) { this.Height = diagramHeight; } }
public override void Render(DrawingContext context) { base.Render(context); if (ChordDefinition != null) { _diagramRenderer.CurrentChordDiagrams = ViewModels.MainViewModel.GuitarModel.GetChordDiagramsByGroup(ChordDefinition.ChordGroup.ToString()); } context.Custom(_customDrawingOp); //Dispatcher.UIThread.InvokeAsync(InvalidateVisual, DispatcherPriority.Background); var diagramWidth = _diagramRenderer.GetRequiredWidthPerChord() * _diagramRenderer.ChordsPerRow; if (this.Width != diagramWidth) { this.Width = diagramWidth; } if (this.Height != 500) { this.Height = 500; } }
public override void Render(DrawingContext context) { base.Render(context); context.Custom(new ColorWheelRender(Bounds, null, StrokeWidth)); }
public override void Render(DrawingContext context) { context.Custom(new TriangleWheelRender(Bounds, Color, null)); base.Render(context); }
public override void Render(DrawingContext context) { // Render elements context.Custom(new ElementRenderOperation(new Rect(0, 0, Bounds.Width, Bounds.Height))); Dispatcher.UIThread.InvokeAsync(InvalidateVisual, DispatcherPriority.Background); }
public override void Render(DrawingContext context) { context.Custom(sketchDraw); base.Render(context); Dispatcher.UIThread.InvokeAsync(InvalidateVisual, DispatcherPriority.Background); }