Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternative without GPUImage Framework #22

Open
HeyChristian opened this issue May 29, 2014 · 7 comments
Open

Alternative without GPUImage Framework #22

HeyChristian opened this issue May 29, 2014 · 7 comments

Comments

@HeyChristian
Copy link

This is an alternative to NOT using GPUImage Framework, this function can capture a screenshot and place the blur effect.

I added a "AMSmoothAlertView.m" this function to return the image with the effect.

#import "UIImage+ImageEffects.h"


-(UIImage *)blurredSnapshot
{
    // Create the image context
    UIGraphicsBeginImageContextWithOptions(self.bounds.size, NO, self.window.screen.scale);

    // There he is! The new API method
    [self drawViewHierarchyInRect:self.frame afterScreenUpdates:NO];

    // Get the snapshot
    UIImage *snapshotImage = UIGraphicsGetImageFromCurrentImageContext();

    // Now apply the blur effect using Apple's UIImageEffect category
    UIImage *blurredSnapshotImage = [snapshotImage applyDarkEffect];
    //applyLightEffect
    // Or apply any other effects available in "UIImage+ImageEffects.h"
    // UIImage *blurredSnapshotImage = [snapshotImage applyDarkEffect];
    // UIImage *blurredSnapshotImage = [snapshotImage applyExtraLightEffect];

    // Be nice and clean your mess up
    UIGraphicsEndImageContext();

    return blurredSnapshotImage;
}
@HeyChristian
Copy link
Author

@mtonio91
Copy link
Owner

i'll try it and integrate it if it works great ! (interested about performances, could be a solution)
thank you for contributing !

@mtonio91
Copy link
Owner

It appears it's not a blur effect but a dark effect.

@HeyChristian
Copy link
Author

has several highlights in the background, does not look bad with your alerviews
ios simulator screen shot may 30 2014 3 09 05 am

@nvnguyenit
Copy link

Thanks so much! You save my time!

@franciscomxs
Copy link

:+1

@daviddelmonte
Copy link

Thanks a ton for this.. Much faster

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants