This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (UIImage *)createGrayCopy:(UIImage *)source | |
| { | |
| CGSize imageSize = source.size; | |
| CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceGray(); | |
| size_t bytesPerRow = 0; | |
| bytesPerRow = imageSize.width * CGColorSpaceGetNumberOfComponents(colorspace); | |
| CGContextRef context = CGBitmapContextCreate (NULL, imageSize.width, imageSize.height, CGImageGetBitsPerComponent(source.CGImage), bytesPerRow, colorspace, kCGBitmapAlphaInfoMask & kCGImageAlphaNone); | |
| CGColorSpaceRelease(colorspace); | |
| if (context == NULL) { | |
| return nil; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (CALayer *)shadowLayer | |
| { | |
| CALayer *shadowLayer = [CALayer layer]; | |
| NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); | |
| NSString *documentsPath = [paths objectAtIndex:0]; | |
| NSString *filePath = [documentsPath stringByAppendingPathComponent:@"shadow.png"]; | |
| NSData *imageData = [NSData dataWithContentsOfFile:filePath]; | |
| UIImage *shadowImage; |