Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 05-25-2010, 06:45 PM   #1 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 4
crazyA is on a distinguished road
Exclamation cameraViewTransform translation -- every single hair has been pulled out

In the live camera preview, I simply want to scale the view. As it is currently, the top left corner of the preview is fixed, and as I scale the view with:

picker.cameraViewTransform = CGAffineTransformScale(picker.cameraViewTransform, zoomFactor, zoomFactor*1.12412);

the image successfully grows by "zoomFactor", but the top left corner stays fixed to the origin. I am trying to get the preview to grow by zoom factor, and also shift up and to the left. Performing a CGAffineTransformTranslate builds fine, but has no effect at all. I know this can be done, as I've seen it implemented in many different apps. I have scoured my books and the internet as well to no avail. Any help will be greatly appreciated.
crazyA is offline   Reply With Quote
Old 05-26-2010, 03:22 PM   #2 (permalink)
Registered Member
 
Join Date: May 2010
Posts: 4
crazyA is on a distinguished road
Smile Problem solved

Well I figured it out after about 4 more hours. I thought I would post what I did to help anyone who may be in a similar situation. It is actually only a few lines of code and works perfectly.

First, since I want a full screen overlay without distortion of the image, the incoming view must be scaled (I don't know how to put the code boxes into my entry on the forum):

//set the cameraViewTransform so that the preview fills the entire screen in
// y-direction. also stretch x-direction to prevent distortion of image //dimensions.

//set zoom to 2x zoom
float zoom = 2.0;

cameraPicker.cameraViewTransform = CGAffineTransformMakeScale(1.12412, 1.12412);

//create cg affine transform to scale down the overlay view by zoom
//this prevents the overlay view from growing with the live preview

CGAffineTransform stepDown = CGAffineTransformMakeScale(1.0/zoom, 1.0/zoom);
[overlay setTransform:stepDown];

//create cg affine transform to scale up the preview;
CGAffineTransform stepUp = CGAffineTransformMakeScale(zoom, zoom);
[cameraPicker.view setTransform:stepUp];


And that is it. No more problems.

If anyone has any comments or knows of a better way to do this I would like to hear. Hopefully in the least I can save someone from the grief I have endured for the last two days.

-Alex
crazyA is offline   Reply With Quote
Old 09-14-2011, 04:57 AM   #3 (permalink)
Registered Member
 
Join Date: Sep 2011
Posts: 5
parthasaradhi.y is on a distinguished road
Post all the item (buttons and toolbars)are disappering only camera view is displaying

Quote:
Originally Posted by crazyA View Post
Well I figured it out after about 4 more hours. I thought I would post what I did to help anyone who may be in a similar situation. It is actually only a few lines of code and works perfectly.

First, since I want a full screen overlay without distortion of the image, the incoming view must be scaled (I don't know how to put the code boxes into my entry on the forum):

//set the cameraViewTransform so that the preview fills the entire screen in
// y-direction. also stretch x-direction to prevent distortion of image //dimensions.

//set zoom to 2x zoom
float zoom = 2.0;

cameraPicker.cameraViewTransform = CGAffineTransformMakeScale(1.12412, 1.12412);

//create cg affine transform to scale down the overlay view by zoom
//this prevents the overlay view from growing with the live preview

CGAffineTransform stepDown = CGAffineTransformMakeScale(1.0/zoom, 1.0/zoom);
[overlay setTransform:stepDown];

//create cg affine transform to scale up the preview;
CGAffineTransform stepUp = CGAffineTransformMakeScale(zoom, zoom);
[cameraPicker.view setTransform:stepUp];


And that is it. No more problems.

If anyone has any comments or knows of a better way to do this I would like to hear. Hopefully in the least I can save someone from the grief I have endured for the last two days.

-Alex
Hey Alex nice code but when iam using that in my app.. after touching zoom in button its is zooming but all the buttons and tollbars are hiding can you help me about this..please send code mailid: parthasaradhi.y@gmail.com
parthasaradhi.y is offline   Reply With Quote
Reply

Bookmarks

Tags
camera, transform, translate, view

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 315
10 members and 305 guests
ajay123123, ashaman64, baja_yu, ChrisYates, guusleijsten, HemiMG, newDev, pkIDSF, Sami Gh, Steven.C
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,648
Threads: 94,113
Posts: 402,878
Top Poster: BrianSlick (7,990)
Welcome to our newest member, brandon6031
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 07:53 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0