2010-12-06 5 views
3

または "募集:"のような名声を上げている他のもの。カメラビューにフレームをオーバーレイして、(捕獲されたものとオーバーレイフレーム)を得られた写真を保存して使用して

-The次いで、ユーザは、写真とオーバーレイと写真は、コードで使用可能な画像を生じる1つ

-Theに結合されるであろう取ります。

ここから始めるにはどのようなアイディアが必要ですか。どれチュートリアルなど

乾杯

答えて

3
それはそれはあなたがカメラによって渡さ取得1から少し違って見える可能イメージのプレビューに適用される変換を扱う、少しトリッキーを取得しますが、ここですることができます

基本的な考え方である:

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { 

UIImage *img = [info objectForKey:UIImagePickerControllerOriginalImage]; 

// Here we are throwing away lots of image resolution -- but since our art is built for the 320 x 480 screen 
// and we are worried about uploading bandwidth, crunching the image down from ~1600 x 2400 to 320 x 480 just makes sense 
// note that the proportion is a little different, so the picture is slightly stretched in the y-axis, but this is augmented reality, so we like that 

// note that hardwareScreenSize has to be determined by checking UIDeviceHardware 

UIGraphicsBeginImageContext(hardwareScreenSize); 


[img drawInRect:CGRectMake(0, ((hardwareScreenSize.height - hardwareScreenSize.height)/2), hardwareScreenSize.width, hardwareScreenSize.height)]; 


// this scales overlayImage to fit ontop of camera image 
[(UIImage *)overlayImage drawInRect:CGRectMake(0, 0, hardwareScreenSize.width, hardwareScreenSize.height)]; 

UIImage *finalImage = UIGraphicsGetImageFromCurrentImageContext(); 
[finalImage retain]; 

UIGraphicsEndImageContext(); 
+0

iが[(UIImage *)overlayImage drawInRect:CGRectMake(0、0、hardwareScreenSize.width、hardwareScreenSize.height)]を使用する場合、オーバーレイ画像を与える。しかし、私はオーバーレイ画像のxとyの位置を変更すると、新しいxとyのサイズを与えることはありませんスナップショットを取る。 – Ram

関連する問題