Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Classes/DLCImagePickerController.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
- (void)imagePickerControllerDidCancel:(DLCImagePickerController *)picker;
@end

@interface DLCImagePickerController : UIViewController <UINavigationControllerDelegate,UIImagePickerControllerDelegate> {
@interface DLCImagePickerController : UIViewController <UINavigationControllerDelegate,UIImagePickerControllerDelegate,UIPopoverControllerDelegate> {
GPUImageStillCamera *stillCamera;
GPUImageOutput<GPUImageInput> *filter;
GPUImageOutput<GPUImageInput> *blurFilter;
Expand Down
26 changes: 24 additions & 2 deletions Classes/DLCImagePickerController.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ @implementation DLCImagePickerController {
BOOL isStatic;
BOOL hasBlur;
int selectedFilter;
UIPopoverController *popover;
}

@synthesize delegate,
Expand Down Expand Up @@ -299,7 +300,15 @@ -(IBAction)switchToLibrary:(id)sender {
imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePickerController.delegate = self;
imagePickerController.allowsEditing = YES;
[self presentViewController:imagePickerController animated:YES completion:NULL];

if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
[popover dismissPopoverAnimated:YES];
popover = [[UIPopoverController alloc] initWithContentViewController:imagePickerController];
popover.delegate = self;
[popover presentPopoverFromRect:self.libraryToggleButton.bounds inView:self.libraryToggleButton permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
} else {
[self presentViewController:imagePickerController animated:YES completion:NULL];
}
}

-(IBAction)toggleFlash:(UIButton *)button{
Expand Down Expand Up @@ -347,6 +356,13 @@ -(IBAction) switchCamera {
}
}

#pragma mark - UIPopoverControllerDelegate
- (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController {
if (!isStatic) {
[self retakePhoto:nil];
}
}

-(void) prepareForCapture {
[stillCamera.inputCamera lockForConfiguration:nil];
if(self.flashToggleButton.selected &&
Expand Down Expand Up @@ -666,7 +682,13 @@ - (void)imagePickerController:(UIImagePickerController *)picker didFinishPicking
staticPicture = [[GPUImagePicture alloc] initWithImage:outputImage smoothlyScaleOutput:YES];
staticPictureOriginalOrientation = outputImage.imageOrientation;
isStatic = YES;
[self dismissViewControllerAnimated:YES completion:nil];
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
[popover dismissPopoverAnimated:YES];
}
else {
[self dismissViewControllerAnimated:YES completion:nil];
}

[self.cameraToggleButton setEnabled:NO];
[self.flashToggleButton setEnabled:NO];
[self prepareStaticFilter];
Expand Down
2 changes: 2 additions & 0 deletions DLCImagePickerController.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,7 @@
INFOPLIST_FILE = "DLCImagePickerController/DLCImagePickerController-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
WRAPPER_EXTENSION = app;
};
name = Debug;
Expand All @@ -691,6 +692,7 @@
INFOPLIST_FILE = "DLCImagePickerController/DLCImagePickerController-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
WRAPPER_EXTENSION = app;
};
name = Release;
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ About
DLCImagePickerController is a fast, beautiful and fun way to filter and capture your photos with OpenGL and your iPhone.
The majority of the praise should be directed towards BradLarson for his [GPUImage](https://github.com/BradLarson/GPUImage) library.

To see the camera in action [download Backspaces](http://backspac.es/download).
Check out the [video of it in action](http://www.youtube.com/watch?v=2BFljDoJpB8), or check out [more about our project](http://backspac.es/r/EtZtSJyJRB)

Setup
------
Expand Down