Questions tagged [drawingvisual]

DrawingVisual is a visual object that can be used to render vector graphics on the screen. It's part of the Microsoft .NET Framework 3.0+.

DrawingVisual is a lightweight drawing class that is used to render shapes, images, or text. This class is considered lightweight because it does not provide layout, input, focus, or event handling, which improves its performance. For this reason, drawings are ideal for backgrounds and clip art.

DrawingVisual part of the Microsoft .NET Framework 3.0+.

44 questions
2
votes
1 answer

Performance of Shapes versus DrawingVisual

MSDN writes: DrawingVisual is a lightweight drawing class that is used to render shapes, images, or text. This class is considered lightweight because it does not provide layout, input, focus, or event handling, which improves its performance. For…
Andrey Potapov
  • 29
  • 2
  • 14
1
vote
3 answers

Hierarchical change notifications in an object hierarchy

I have a recursive hierarchy of three kinds of object in a C# library. Let's call them Boxes, Nuts and Bolts. Boxes can contain other Boxes, or Nuts and Bolts. Nuts and Bolts obviously can't contain anything. Let's assume each Box has…
deadlyvices
  • 873
  • 6
  • 18
1
vote
1 answer

Bitmap cache on DrawingVisual has blurry parts

Recently I switched to DrawingVisuals to increase the performance of our trending graphs (especially zooming and panning). Here's the code I have: blocksToBeRendered = (baseItem as AvgCurve).GetStreamGeometryBlocks(ActualWidth, ActualHeight,…
Toon Casteele
  • 2,479
  • 15
  • 25
1
vote
1 answer

Width and Height of the Image in RenderTargetBitmap in WPF

Using the below code I'm drawing on DrawingVisual then rendering it to an Image using RenderTargetBitmap. The final Image is later added to a Canvas and displayed on the screen. My problem is with the pixelWidth and pixelHeight arguments the…
Vahid
  • 5,144
  • 13
  • 70
  • 146
1
vote
0 answers

Drawingvisual use Pen from a Pen property

My main aim is to update drawingvisuals thicknesses when I zoom on canvas. It takes very long time to update each drawingvisual if there are too much drawing visuals (like 100.000 lines) in the canvas. So I decided to have a Pen property in my…
msnmz
  • 11
  • 2
1
vote
0 answers

how to use Drawingvisual in wpf?

i have a screen that shows thousands of points and refresh rate is 10 ms. first i had problem because rendering was slow and jittery. i searched internet people suggest me to convert shapes to visual because shapes have a lot of events and is heavy…
M.R
  • 11
  • 1
  • 4
1
vote
1 answer

Overlay geometry objects in WPF such that each has the same dimensions but different transformations

I have been stuck with this issue for a week now and have tried multiple approaches. I have a drawing of a balance scale as shown below. I have split up this image into two such that the base + vertical shaft represent one image while the horizontal…
Raheel Khan
  • 14,205
  • 13
  • 80
  • 168
1
vote
1 answer

WPF: Fast clearing a VisualHost with thousands of Children

In a WPF application I'm using a VisualHost with a Children collection. This children collection contains around 10000-30000 DrawingVisuals. Drawing these DrawingVisuals takes around 600 ms. Thats OK for me, but clearing the Children collection via…
Knasterbax
  • 7,895
  • 1
  • 29
  • 23
1
vote
1 answer

Why does continual removing and re-adding of a DrawingVisual cause a constant increase in memory usage?

I've got a WPF program that uses a Canvas within a Window, over-ridden to become a Graphics_Canvas, which looks like this: class Graphics_Canvas : Canvas { private List visuals = new List(); protected override…
Greg
  • 1,673
  • 4
  • 20
  • 27
1
vote
3 answers

Multiple thread image compositing

I'm using WPF imaging to composite text, 3d graphics and images together using a DrawingVisual. The result is then rendered into a RenderTargetBitmap and saved to disk as a jpeg. All of this happens in code with no visual window. It's working well…
0
votes
0 answers

WPF userControl Render successed,and Append drawing never show on Screen?

this is very simple example to show my question. 1 public class TestControl : UserControl { public TestControl() { } protected override void OnRender(DrawingContext context) { …
张成龙
  • 11
  • 1
0
votes
1 answer

Forcing a DrawingVisual to redraw

I'm trying to draw a random sqaure using the DrawingVisual class, and a "New Square" Button to replace the square with newly generated one. I'm not able to figure out how to Force the DrawingVisual to redraw. I'm not looking for alternative…
0
votes
0 answers

How to draw GIFs better in DrawingVisual?

I am trying to draw giftu in DrawingVisual. Here are some codes that I have tried,But the performance is very poor. Used up to 22% of cpu (AMD Ryzen 7 5800H) and 50% of gpu(rtx 3060) and 4GB of RAM when drawing a 1924*934, 434 fps gif. And it…
absurd
  • 19
  • 2
0
votes
0 answers

How to make DrawingVisual objects in C# have unique Pen Brush colour, but share the same thickness

I'm building an application that can load in Vector files and display them on a Canvas. To zoom and pan efficiently I'm using DrawingVisual shapes for my background maps that don't change often. In order to keep the line thickness the same…
Richard
  • 439
  • 3
  • 25
0
votes
1 answer

Is the a MVVM WPF way to implement DrawingVisual based on an ObservableCollection

My Application displays a lot of lines and polygons/paths on a canvas. My ViewModel holds a series of ObservableCollections that represent different items to be drawn. The issue I have is the application is very slow to zoom and pan. Zoom and pan is…
Richard
  • 439
  • 3
  • 25