I have a WPF control with a GeometryModel3D with DiffuseMaterial using an ImageBrush with data bound ImageSource.
My goal is to display a "cross-section" while hovering the mouse, and for that I can already get the proper position on the object. The problem is: There is no "3D Line" in WPF.
I have made a test drawing the line in the image I use for ImageSource and the visual result is exactely what I want.
So I plan to do the following: generate the base image once, and then draw the appropriate line on it, setting the property used as ImageSource.
I have considered two approaches:
Have the bound ImageSource of type
BitmapImage. Then I create aSystem.Drawing.Bitmaponce with the blank texture (without the line), and then each time I want the line to change position, I recreate theBitmapImagedrawing a line withSystem.Drawing.Graphics;Have the bound ImageSource of type
DrawingGroup. Then I create aSystem.Windows.Media.ImageDrawingonce, and then each time I want the line to change position, I recreate theDrawingGroupby changing only theGeometryDrawingcomposed by one single line.
Is there any inherent advantage of one method over the other?
I must admit that I've never actually tested the performance difference, but I know that the
Drawingclass enables a light-weight way to manipulate basic shapes and images. From theDrawingClass page on MSDN:Conversely, the
BitmapImageclass has all sorts of additional extra functionality and convenience features built into it, making it less light-weight than theDrawingclass. From the Imaging Overview page on MSDN: