i want to implement 3D image manipulation(i.e., image edit,re-size,rotate,zoom-in & zoom-out).
please give me your ideas as soon as possible.
Silverlight 2.0 does not support true 3D. Silverlight 3 will support a perspective projection simulated 3D (think 3D images in PowerPoint).
For standard image manipulation you have a few ways to go. If you just want to do rotation and resizing for display purposes, you can set a RenderTransform on the image object. This does not actually change the bits in the image but just cases them to be drawn differently.
If you want to learn about full image processing, see this other post on StackOverflow:
Image Processing
Related
I am working on a Chart Control,
I need to implement the Chart Snapshot feature for capturing a vector based image in high quality of Curves and Texts, in any requested size.
Can anyone suggest me any solution or a pointer to resolve this problem.
Any kind of help in deeply appreciated.
If you have to save your image in a vector format you can using tracing. Potrace is an open source bitmap-to-vector tracer library (but considers that bitmap tracing is imperfect). Also considers that wpf is linked closely with XAML, a vector graphics markup languages, so you may want convert raster graphics to XAML (though Charles Petzold you can't embed a bitmap in a XAML file)
If you need to draw a vector image you can use the Shape element that provides a base class for shape elements, such as Ellipse, Polygon, and Rectangle; and add the shape as Panel child. If you are dealing with thousands of shape I suggest to use the DrawingVisual class, a visual object that can be used to render vector graphics on the screen, and its RenderOpen method.
To zoom you have to work with transformations, in particular ScaleTrasnform and apply the transformation to your panel or to your shapes.
Hope this help.
You can take a look at XamlToy but I have not already try it.
http://xamltoys.codeplex.com/
I have a Viewport3D object containing a scene of hierarchical Model3D objects (grouped in Model3DGroups).
I need to "attach" 2D objects to 3D elements in the scene.
I read some articles on 3D projection but I couldn't fully understand how to apply my WPF scene data to those solutions.
What is the proper way to do that? I also tried Petzold.Media3D library but I didn't understand how to use it...
Thanks
I think you are looking for the Viewport2DVisual3D class. It allows you to render any Visual2D into the 3D space.
Searching the web for more info on this class will give you examples and videos explaining how it works.
Anyway, if you are doing any WPF 3D you also need to know about the Helix Toolkit - an awesome (free) WPF 3D toolkit.
It has two classes added recently that might also be relevant to what you are doing:
BillboardVisual3D (quad that always faces camera) and
TextBillboardVisual3D (text that always faces camera).
There are useful if you want to make some 2D image that must always face towards the 3D camera.
I'm working on SEM image processing application, written in WPF. I have an image display control, derived from Canvas, which displays image & overlays using DrawingVisuals (one for each "layer"). It also implements Zoom & Pan using scale & translate transform, applied on DrawingVisuals.
When I zoom in the image to see individual pixels, they are displayed smooth, evidently using bilinear filtering to stretch the bitmap (no surprise, as WPF is rendered through Direct3D). However, for my use case, I would rather see individual pixels as sharp boxes, as usual in any image editor like Photoshop. That's why user of my app zooms the image -> to be able to operate on pixel level.
Is there such option in WPF (other than manually stretching the bitmap before displaying it)? I was not able to find anything.
thanks in advance,
Zbynek Vrastil
Czech Republic
Finally found an answer, with some help from Experts Exchange. Class RenderOptions defines attached property BitmapScalingMode, which can be set to NearestNeighbor. So,
RenderOptions.SetBitmapScalingMode(imageDisplay, BitmapScalingMode.NearestNeighbor);
does the trick.
Zbynek Vrastil
Hate to put a dampener on things, but if NearestNeighbor works like GDI+, then this will give you a limited success. As you increase magnification in areas of high contrast you might not get the desired results. In GDI+ you find blacks becoming blue, and whites becoming red - again I stress in areas of high contrast! If this isn't the case in WPF, think yourself lucky!
Perhaps a WCF developer could confirm that?
I've found that there are more options to consider, but I can only speak for the GDI+ Graphics class, which might be useful to someone.
Graphics graph = e.Graphics;
graph.InterpolationMode = InterpolationMode.NearestNeighbor;
graph.CompositingQuality = CompositingQuality.AssumeLinear;
graph.SmoothingMode = SmoothingMode.None;
This works for me. I think the SmoothingMode is the trick. Hope this helps someone else out there.
i was learning 3d animation in wpf.. and most tutorials would make an image 3d then play with it alittle ..moving and changing dimensions..
so it got me wondering.. is it possible to add some type of data container (like a grid canvas.. or whatever).. and make it move in 3d dimensons too ?
i am not talking about skewing.. i am talking about real 3d movement..
What a lot of examples do in .Net3.0 is use visual brush to draw the visual of the control/data container on a surface in 3D space. And then map the mouse and keyboard events back to the 2D control (through a translation).
They are a lot of examples that illustrate this. (one for instance is)
An alternative is to use a panel that layouts your control in 3D space using one of the thriple opensource project Or you could read the code (since it's opensource) as a starting point.
I have created a 3D structure(basically an image) dynamically using kit3D.However,I wanted to zoom only a small segment of the whole structure.My entire image is loaded altogather at a time,so I am not considering using deep zoom.
Is there anyway where I can zoom only a part of a dynamically generated image in silverlight??
Thank you,
Ramya
You can use a Scale RenderTransform to increase the size of the image, then use a clip to only show one part of it, thus giving the effect of zoom.
Alternatively you can use a ViewBox from the Silverlight toolkit
I'd use a MultiScaleTileSource for that. It's a callback based system - it requests Deep Zoom tiles from a function you implement when the user zooms or pans.
Here's some sample code, and here's a full working example that pulls map tiles dynamically from Virtual Earth.
This example may be helpful.
there is an example of use silverlight 3 and Virtual Earth on http://www.silverenlightenment.com/