From b31ebe984ebc497928898b4d2531c61d46b3394f Mon Sep 17 00:00:00 2001 From: fqassem Date: Mon, 25 Jun 2012 21:28:19 -0400 Subject: [PATCH] changed camera code, should work --- ar-project.xcodeproj/project.pbxproj | 6 ++--- ar-project/ARViewController.m | 16 +++++++++++- ar-project/MainStoryboard_iPad.storyboard | 32 +---------------------- 3 files changed, 19 insertions(+), 35 deletions(-) diff --git a/ar-project.xcodeproj/project.pbxproj b/ar-project.xcodeproj/project.pbxproj index 20187ff..8053844 100755 --- a/ar-project.xcodeproj/project.pbxproj +++ b/ar-project.xcodeproj/project.pbxproj @@ -141,9 +141,6 @@ DD0E2C1C157EC2B600F3AAF9 = { isa = PBXGroup; children = ( - CE7135EE159801B500ED347E /* ImageIO.framework */, - CE7135EC1597FE3B00ED347E /* CoreMedia.framework */, - CE7135E91597FE3000ED347E /* CoreVideo.framework */, DD0E2C31157EC2B700F3AAF9 /* ar-project */, DD0E2C2A157EC2B700F3AAF9 /* Frameworks */, DD0E2C28157EC2B700F3AAF9 /* Products */, @@ -161,6 +158,9 @@ DD0E2C2A157EC2B700F3AAF9 /* Frameworks */ = { isa = PBXGroup; children = ( + CE7135EE159801B500ED347E /* ImageIO.framework */, + CE7135EC1597FE3B00ED347E /* CoreMedia.framework */, + CE7135E91597FE3000ED347E /* CoreVideo.framework */, DDD116FA1587C3F900490B53 /* MapKit.framework */, DD847AD9157FD2C100855FEA /* CoreLocation.framework */, DD0E2C6B157ECA1900F3AAF9 /* AVFoundation.framework */, diff --git a/ar-project/ARViewController.m b/ar-project/ARViewController.m index c69e892..53191ba 100755 --- a/ar-project/ARViewController.m +++ b/ar-project/ARViewController.m @@ -114,7 +114,21 @@ -(IBAction)captureView:(id)sender NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageSampleBuffer]; UIImage *image = [[UIImage alloc] initWithData:imageData]; - _sharedPicture = image; + UIImage *overlay = imageView.image; + + UIGraphicsBeginImageContext(image.size); + + // Use existing opacity as is + [image drawInRect:CGRectMake(0,0,image.size.width,image.size.height)]; + + // Apply supplied opacity if applicable + [image drawInRect:CGRectMake(0,0,overlay.size.width,overlay.size.height) blendMode:kCGBlendModeNormal alpha:0.8]; + + UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); + + UIGraphicsEndImageContext(); + + _sharedPicture = newImage; }]; [self showMessage]; } diff --git a/ar-project/MainStoryboard_iPad.storyboard b/ar-project/MainStoryboard_iPad.storyboard index f82153e..1f4f92c 100755 --- a/ar-project/MainStoryboard_iPad.storyboard +++ b/ar-project/MainStoryboard_iPad.storyboard @@ -246,6 +246,7 @@ + @@ -279,37 +280,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -