Lets say I have a Canvas with one Image centered on the screen. When I move the image away from the center, lets say to the upper right corner, I want it to be skewed as if the Canvas was a perspective 3d-camera with a certain FOV. Can this be done somehow? Im playing around with the Perspective-property in Silverlight for WP7 but I cant get the effect Im after.
I believe this may be what you're looking for: How to Set this Kind of Perspective Transform in Matrix3D?
Related
I've been trying to get coordinates from Minecraft and putting them on an WPF canvas for a map viewer. However, most of it does not work and it is not centered. How would you go about with doing this?
Help is appreciated!
Update #1:
I'll be a bit more descriptive of what I want. I'd like to show positions (not images or terrain and stuff) on a WPF Canvas. What I am trying to do is making a navigation system showing lines from certain coordinates to other coordinates. One thing I've tried was making the canvas as big as a Minecraft map, but that didn't work well. https://www.codeproject.com/Articles/85603/A-WPF-custom-control-for-zooming-and-panning I've been using that with no problems, but the thing is that I want to actually translate in game coordinates to coordinates on the maps for waypoints and such.
Sorry for the lack of detail at first!
What is the correct way to zoom in and out of a scene in SceneKit?
So when I enable the standard camera control in a scene and pinch in and out the scene gets bigger and smaller. What is that pinch really doing?
Is it changing the scale of the whole scene? Is it moving the camera closer?
I want to implement the same effect but programmatically.
What should I do to obtain the same effect?
When you pinch it's the field of view (xFox and yFov properties) of your camera that's changed. Changing the field of view is not the best way to zoom because it can dramatically change the perspective.
Moving the camera closer to your object is a good solution.
Also note that the "free camera" behavior is suitable for 3D viewers (such as Preview.app) but will rapidly become frustrating in any other app. At this point you might want to implement your own camera controller.
At any given point the camera has a position in space, it has a rotation for each of its own axis compared to each of the world axis, to have a zoom in and zoom out, you have to move the camera in the +z/-z axis direction.
Along the Cameras own Z/-Z axis.
For those on OSX, I used this in my SCNView subclass:
override func scrollWheel(theEvent: NSEvent) {
let cam = pointOfView!.camera
cam!.xFov = cam!.xFov - Double(theEvent.deltaY)
cam!.yFov = cam!.yFov - Double(theEvent.deltaY)
}
There are two (minor) problems that could be addressed with a little extra code. One is that the values can go negative, at which point the image is flipped inside-out. The other is that mouse acceleration can cause the zoom level to go too fast if you really spin the wheel. Limits on both of these would be a good idea, but in my app the behaviour was fine as it is above.
I have an ximage which I want to zoom in on, and display. I'm currently taking the naive approach:
allocate bigger image
use nearest-neighbor interpolation to fill it in.
put the whole image on a pixmap.
Which works, but slowly, and crawls once I approach bigger zoom levels, like 800%. The gimp, however, can zoom in to 3200% and still feel snappy. What's the approach taken here? Should I only fill one screen at a time? But then what about scrolling: wouldn't performing interpolation, and an XPutImage, and an XCopyArea on each expose kill performance?
I'm not expert in Xlib, but in my opinion a good approach would be to draw only the zoomed part, instead of computing the interpolation of the entire image.
For scrolling, if you are looking for performances, you may copy the part of the old zoom which is still visible in the new position, and compute the interpolation of the "discovered" pixels. For example, when scrolling down, you may copy the bottom of the previous image and paste it higher, and then compute/draw the new visible stuff at the bottom.
Most modern X11 applications don't use Xlib directly much, if at all. My guess would be that Gimp is rendering the zoomed image into a buffer itself and drawing that to the window, rather than working with the image in an XImage.
What i'm trying to do is making a "light projector" with visible ray(like with fog) also called volumetric light;
and which project a image (bitmap) ;
Because i would like to keep this project connected with a wpf application ( to get brush, position, rotation from data), i've choose to use WPF 3D
But it seem that WPF can't handle light projection or render ray.
So to do that, i have extruded each pixel of my source bitmap into a polygon colored by a solidColorBrush of the pixel color.
and keep the pixel order with (x,y) position.
For performance issue, i've set all the bitmaps to 32x32 px ( 1024 polygon for only one light !!)
But the result is too pixelated as you can see on the picture.
Moreover, it probably take much memory for nothing ...
my question is, how can i make it smooth or even rethink the extrusion system to optimize performance ...
Is any other tehnology that can be integrated into a wpf application and do that better or easier ?
Thanks, and sorry my English is pretty bad ...
alt text http://www.visualdmx.fr/pic_example.png
I have an app with a bunch of controls in it and I want to place a set of cross hairs on top of it. My first attack used a PictureBox and ran into this problem. The solution that fellow proposes, seems a bit... verbose for what I need.
Is there a simple way draw on top of my form? Note that I don't even need the drawing to be part of a control as it doesn't need to do anything but just be there.
This eventually worked. I had to play some games though because most of the controls I wanted to draw on were not where it expected them to be.
Also, it ran into issues when controls were moved; it failed to redraw and stuff moved with the underlying control. This was fixed by forcing invalidation from the move event for anything that might move.
Does a PictureBox with a transparent image have the same problem as a Panel with BackColor set to Transparent? I'm thinking you could have a PictureBox with the crosshair image in it and move that around, instead of drawing it yourself...