views:

232

answers:

2

Hi to all,

I am developing one game where I want to magnify the image where magnifier image is placed. For that I am using the concept of masking. After masking I am zooming the image but looks blur. And I want image should be clearer like we r looking through rifle magnifier. So if any one have solution then kindly reply

+1  A: 

are you sure that the problem is the masking?

perhaps your resources are too low resolution? high resolution images scaled down always look better than low resolution images scaled up. Maybe you need to look at the problem backwards... so that your image when looking through the rifle magnifier [scope?] is viewed at a 1:1 resolution and when not viewed through the scope it is zoomed out (1:2 resolution?). so this way your 'normal' mode is the zoomed out mode and the "magnified view" is actually just the image at 1:1.

kent
If I do simple masking without zooming it looks good but I want to zoom it. You are right may be its a problem because of low resolution but I have image of 293*184. And I am making it very small is like 40*30. If i will zoom it, I think it have to look better. But it not I don't know why it look blur.
Jyotsna
A: 

If you have A UIImage whose size is 293x184 but you create a UIImageView with an initial size of 40x30, the iPhone SCALES the UIImage to fit according to the property: contentMode. Default contentMode is: UIViewContentModeScaleToFill, which scales your image.

So even though you started with a large image, it is now only 40x30 and rendered at 40x30. When you zoom it is STILL 40x30, but rendered at some larger size which is causing the blur.

One solution would be to replace the image after the zoom, then you would have a completely new UIImage at full resolution.

[self.view setFrame:reallyBigFrame];
[self.view setImage:newUIImage];

Another would be initially place the UIImage in a full size 293x184 UIImageView, then use an AffineTransform to scale it down:

view.transform = CGAffineTransformScale(view.transform, 0.25, 0.25);
Corey Floyd