Matlab zoom or pan an image while 'Clipping' is 'off' - matlab

I try displaying image with non standard aspect ratio (width>>height) in my GUI.
But when I zoom-in the image is clipped to the original axes position. I've managed to solve this problem by setting the 'Clipping' property to 'off'. But now for some reason the pan and zoom tools are only active while the mouse hovers over the initial position of the image (the position it had before I zoomed in).
Here is a piece of code for demonstration (I'm using Matlab 2011a, but also noticed the problem in other versions):
I = repmat(imread('cameraman.tif'), [1 20]);
figure,
h=imshow(I);
set(h,'Clipping','off')
(Just run those lines and try zooming in once or twice. The zoom/pan tools will only work in the area where the image initially was.)
Is there a way of zooming in without clipping the image, and yet getting the pan and zoom tools to work all over the enlarged image?

Related

How do I make Pixel Perfect Camera scale like Normal Camera in Unity 2D

This is my scene
Right now if I use resolutions that aren't 16:9 the Pixel Perfect Camera zooms out quite a lot showing parts that shouldn't be shown.
How do I get it to scale like the Normal Camera which just cuts out parts outside the borders?
The Reference Resolution is currently set to 320x180, I tried changing the Reference Resolution to other resolutions (640x360, etc) but that changed nothing.
Tried Pixel Snapping on/off.
Cropping the X and Y does a good job at hiding the outside borders places but makes the screen too small for non 16:9 resolutions.

Cocos2d-x zoom in zoom out in rendertexture

I are working on a coloring game for kids.I have used bucket fill and it working fine but the problem is coloring image contains some small areas which are impossible to fill by touching on it. I wanted to Implement zoom in and zoom out so that kids can zoom in to small area fill it and zoom out. I have tried scaling rendertexture but it scale around anchor point. Is there a way that I can scale around the touch location ?
Scaling will always be done around the anchor point. You have to reposition your RenderTexture, after scaling, so your touch location remains centered.

Pan and zoom toolbar issue - Matlab 2016a

I added to a Matlab GUI Pan and Zoom toolbars so I can move over the image presented in the axes.
After I mark a point (and adding coordinate text) and use the pan and/or zoom the marked text is shown outside the image Axes all over the GUI (it move as I pan and zoom).
The Axes, pan and zoom toolbar and the ui.figure 'Clipping' property is set to on.
There is no code as I use the toolbar and therefore how can it be solve?
Image example (White represent the outside of the Axes):

iPhone: Properly scaling lines / circle drawn in drawRect

I am drawing custom annotations over an image (circle, arrow etc) in my iPhone app. I allow pinch zooming & drag gestures for these annotations. These annotations are custom made AnnotationView with drawRect drawing circle / line etc.
I am finding issues with zooming
Try 1: The zoom is applied by scale transformation to the AnnotationView. Result: the annotations become blurred.
Try 2: To avoid blurring, I added redrawing with co-ords multiplied by scale factor instead of directly manipulating the transformation. This works without blurring, but, soon the circle etc goes out of the views bounds & is clipped.
I could use a bigger frame (size of full image), but, I am keeping the smaller frame so that I can easily move it back to position when it is dragged out of the window by user's zoom / pan gestures.
Question:
Is there a better way to manage this? I would like to zoom without blurring, while also having the ability to move it back to position if it is dragged out of original image bounds.

How to draw a light effect over a texture on iPhone using UIKit/Quartz

I have a scene with a background image (a lit room), and a black image (shadow) over that. I need to be able to move my finger over the background and reveal some parts of the scene, simulating a dim light source in a dark room.
My current approach was to generate a mask depending on the position of the touch, and then applying that mask to the shadow image. The problem is I'm generating a new mask and applying it every time I receive a touch event. It's a large image (800x600) and this causes the performance to go down and it increases a lot the memory usage, eventually crashing the game (I think I don't have any memory leaks, but that's not warrantied... anyway the performance itself isn't acceptable).
Can anyone think of a better approach (which doesn't involve using OpenGL ES -- that's not an option in this project) to do this?
To go with my comments above.
Maybe to get around the different shadow levels you could also have a grid of views (squares) between the image and the shadow view. each grid square has a different alpha opacity and when the spot is over a grid square, the grid square's alpha opacity changes to 0. when the spot moves off the grid square it's alpha opacity changes back to it's default.
Without more information it is a little difficult to know whether this approach will work in your case but what you could do is generate a single mask image, say, a radial alpha gradient and then apply an affine transform to it to shape it according to the touches. This can be used to simulate a torch/flashlight beam.
I would try this: use one view with a custom drawRect implemetation: first draw the shadow image (in grayscale) then a bright spot image in white an alpha. And finally the background image in a 'multiply' blend mode.
Just a thought, does the shadow has to be an image? Perhaps you could simply fill the shadow layer with a color and mask it then? This way the memory usage should be less and the effect should be nearly identical (if not exactly the same).
There is no reason to generate a new mask on every touch move. Instead, let the mask be initialized once and manipulate it (reset it's frame) as needed upon touch events.