-
Notifications
You must be signed in to change notification settings - Fork 154
Open
Description
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;
}
Metadata
Metadata
Assignees
Labels
No labels