         case .Right:
             transform = CGAffineTransformTranslate(CGAffineTransformMakeRotation(rad(-90)), -image.size.width, 0)
         case .Down:
-            transform = CGAffineTransformTranslate(CGAffineTransformMakeRotation(rad(-180)), -image.size.width, -image.size.height)
+            transform = CGAffineTransformTranslate(CGAffineTransformMakeRotation(rad(-180)),
+                                                   -image.size.width, -image.size.height)
         default:
             transform = CGAffineTransformIdentity
         }
         transform = CGAffineTransformScale(transform, image.scale, image.scale)
         cutout = CGRectApplyAffineTransform(cutout, transform)
         
-        print("img \(image.size)")
-        print("cutout x=\(cutout.origin.x) y=\(cutout.origin.y) w=\(cutout.size.width) h=\(cutout.size.height))")
         guard let retRef = CGImageCreateWithImageInRect(cgimg, cutout) else {
             return nil
         }

            self.response = response
            
            dispatch_async(dispatch_get_main_queue()) {
                self.picker = UIImagePickerController()
                self.picker!.delegate = self
                self.picker!.sourceType = .Camera
                self.picker!.cameraCaptureMode = .Photo
                
                // set overlay
                if let overlay = request.query["overlay"] where overlay.count == 1 {
                    print(["BRCameraPlugin] overlay = \(overlay)"])
                    let screenBounds = UIScreen.mainScreen().bounds
                    if overlay[0] == "id" {
                        self.picker!.showsCameraControls = false
                        self.picker!.allowsEditing = false
                        self.picker!.hidesBarsOnTap = true
                        self.picker!.navigationBarHidden = true
                        
                        let overlay = IDCameraOverlay(frame: screenBounds)
                        overlay.delegate = self
                        overlay.backgroundColor = UIColor.clearColor()
                        self.picker!.cameraOverlayView = overlay
                    }
                }
                
                self.controller.presentViewController(self.picker!, animated: true, completion: nil)
            }
            
            return response

import Foundation

@available(iOS 8.0, *)
@objc public class BRCameraPlugin: NSObject, BRHTTPRouterPlugin, UIImagePickerControllerDelegate,
                                   UINavigationControllerDelegate, CameraOverlayDelegate {
    
    let controller: UIViewController
    var response: BRHTTPResponse?
