grabScreen

This might be something others find useful in relation to grabscreen…I was having an issue with the iphonescreengrab only returning portrait photos to the photo album, but the image saving function wasn’t calling all of the setter methods, in particular the image orientation, so I added that in with an if statement to decide when to use each one depending on how you’re holding the device

This is my “quick” method of modifying it, but I’m sure there is a more efficient way to do it…

At the very end of the ofxiPhoneScreenGrab function, comment out this:

  
//UIImage *image = [[UIImage alloc] initWithCGImage:imageRef];  

and delete everything below it, and add in this stuff (all below CGDataProviderRelease)

  
     if ([UIDevice currentDevice].orientation==UIDeviceOrientationLandscapeLeft ||  
         [UIDevice currentDevice].orientation==UIDeviceOrientationUnknown||  
         [UIDevice currentDevice].orientation==UIDeviceOrientationPortrait||  
         [UIDevice currentDevice].orientation==UIDeviceOrientationFaceUp||  
         [UIDevice currentDevice].orientation==UIDeviceOrientationFaceDown)  
        { //If the user is not holding the device portrait, make photo landscape left  
         UIImage *image = [[UIImage alloc] initWithCGImage:imageRef scale:1.0 orientation:UIImageOrientationLeft];  
       
        CGImageRelease(imageRef);  
          
        SaveDelegate *saveDelegate = [SaveDelegate new];  
        saveDelegate.delegate = delegate;  
        UIImageWriteToSavedPhotosAlbum(image, saveDelegate, @selector(image:didFinishSavingWithError:contextInfo:), nil);  
     }  
     else if([UIDevice currentDevice].orientation==UIDeviceOrientationLandscapeRight) { //Landscape Right  
         UIImage *image = [[UIImage alloc] initWithCGImage:imageRef scale:1.0 orientation:UIImageOrientationRight];  
           
         CGImageRelease(imageRef);  
           
         SaveDelegate *saveDelegate = [SaveDelegate new];  
         saveDelegate.delegate = delegate;  
         UIImageWriteToSavedPhotosAlbum(image, saveDelegate, @selector(image:didFinishSavingWithError:contextInfo:), nil);  
     }  
  
     else if([UIDevice currentDevice].orientation==UIDeviceOrientationPortrait || [UIDevice currentDevice].orientation==UIDeviceOrientationPortraitUpsideDown) {   
         //Portrait only  
         UIImage *image = [[UIImage alloc] initWithCGImage:imageRef scale:1.0 orientation:UIImageOrientationUp];  
           
         CGImageRelease(imageRef);  
           
         SaveDelegate *saveDelegate = [SaveDelegate new];  
         saveDelegate.delegate = delegate;  
         UIImageWriteToSavedPhotosAlbum(image, saveDelegate, @selector(image:didFinishSavingWithError:contextInfo:), nil);  
     }  

this is a bit of an old thread, but i will try it anyway.

i am on OF 0.8.0 for ios and get black images to when using ofxiOSScreenGrab(NULL)

i tried is on a couple of different apple devices for ios 6.1.3 and 6.0

it seems to take images and place them in to the album folder but they are all black.

thanks.
s.

ok got it.
ofxiOSScreenGrab has to be called in draw() not update()

Hey,

does anybody found a solution for OpenGL ES and Antialiasing with FBOs?

iOSWindow->enableAntiAliasing(4); is not working for me, since i need my draw loop in an pixel array later. Sounds like it´s the same issue like the screengrab thing.

if found this (maybe) solution for c++, but don´t have a clue how to port this to of:

Or is the only real solution to draw any lines 4x larger and then scale it down?

thanks,
A.