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
0
votes
1 answer

How to programatically resize a DrawingVisual?

So, I'm new to WPF Drawing. For performance reasons, I've had to switch from regular controls like ContentControl and UserControl to more light-weight elements like DrawingVisual. I am working on a diagramming app which would probably have a max of…
heapoverflow
  • 85
  • 1
  • 8
0
votes
0 answers

How to add WPF FrameworkElements and DrawingVisuals to the same canvas

I am building a simple CAD program. For speed purposes I am using DrawingVisuals. In order to facilitate this I created a custom Canvas class that inherits from Canvas. I override VisualChildrenCount and GetVisualChild inside this class …
David
  • 181
  • 13
0
votes
1 answer

How to calculate the size of a DropShadowEffect?

I'm trying to get an image and apply a drop shadow to it and save back as an image. So far, the only way to do that, while not using third party solutions is to use the DropShadowEffect in a DrawingVisual: var drawingVisual = new…
Nicke Manarin
  • 3,026
  • 4
  • 37
  • 79
0
votes
0 answers

Scheme for tracking DrawingVisual in WPF DrawingVisual

I'm creating a CAD program in WPF that adds and deletes lines and rectangles, both of which are described by a PathGeometry. When I get further along with the program, it will contain a great variety of different PathGeometries, each of which make…
0
votes
2 answers

WPF keyboard events not firing for FrameworkElement subclass with only visuals

I created a subclass of FrameworkElement that has a collection of Visuals : public class GameElement : FrameworkElement { private VisualCollection Visuals { get; } public GameElement() { this.KeyDown += this.OnKeyDown; …
0
votes
3 answers

How to convert Image to ImageSource

I don't know if I'm even asking the right question; so apologies in advance. I am writing some PNGs to a canvas and I also want to simultaneously copy the PNGs to a bitmap. I want the PNGs to appear in the same locations on the bitmap as they do on…
zetar
  • 1,225
  • 2
  • 20
  • 45
0
votes
1 answer

Blur effect on image: different result before and after saving

I have a bug in my image editor with the blur tool. When I select the rectangle to set the blur effect, and when I apply, result is a bit different see: To create the "Before" I do: var blurredImage = ExtractImageToBlur(); // extract the selected…
mlemay
  • 1,622
  • 2
  • 32
  • 53
0
votes
1 answer

Trying to learn DrawingVisual and StreamGeometry

In my application I have to draw a line that contains of a lot of points (up to 100.000 if needed). Initially I used a Polyline but this turned out to be way too slow for the larger amounts of points. I've been doing some reading up and came to…
user3692104
  • 189
  • 2
  • 13
0
votes
0 answers

Drawing Lines in WPF - DrawingVisual Performance Issue

I have implemented two versions of line drawing code - one using WPF shapes (lines), and another using StreamGeometry and DrawingVisual. DrawingVisual should be faster, but I have found the exact opposite. The initial draw, and subsequent resizing…
Satellite
  • 531
  • 1
  • 8
  • 16
0
votes
0 answers

Saving Canvas to BMP only for the desired Canvas Size

I am having a canvas with different objects in it, the can be moved around .. Then i want to save the canvas to an BMP or PNG .. no problem, it works. But if there is some object outside of the canvas, the output image will be with the desired…
slaesh
  • 16,659
  • 6
  • 50
  • 52
0
votes
1 answer

Change the properties of a local class that draws on DrawingVisual

I have defined a Drawing class that derives from the FrameworkElement. I'm using this to draw on the DrawingVisual. In my XAML I have included this local class. Now my question is how can I bind the properties of this class to a variable or how can…
Vahid
  • 5,144
  • 13
  • 70
  • 146
0
votes
0 answers

WPF Canvas, Framework element has red border

I'm using a canvas to host various framework elements. Each framework element is itself a host to a DrawingVisual. Each Framework element that is added at design time, appears fine (i.e. as expected) in the canvas at runtime. For those framework…
Muckers Mate
  • 399
  • 8
  • 23
0
votes
1 answer

Custom DrawingVisual making application sluggish

I'm wanting to render a bezier curve that will contain many hundreds of points. This curve doesn't need to be hit testable or interactable in any way, so I thought I'd try a Visual as that seems to be the most light weight. Using the code below…
pastillman
  • 1,104
  • 2
  • 16
  • 27
-4
votes
2 answers

Lazy Rendering of DrawingVisual

I'm trying to change a custom WPF element to use a visual tree, so that background layers can be changed without needing to throw away the whole retained render. At the same time, a layer might be affected by more than one property, so I'd like to…
Ben Voigt
  • 277,958
  • 43
  • 419
  • 720
1 2
3