project_files/HedgewarsMobile/Classes/UIImageExtra.m
author koda
Mon, 30 Aug 2010 05:42:03 +0200
changeset 3791 98072b3871c1
parent 3778 2e61bb50cc57
child 3829 81db3c85784b
permissions -rw-r--r--
help page for ingame, some other fixes here and there
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
     1
//
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
     2
//  UIImageExtra.m
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
     3
//  HedgewarsMobile
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
     4
//
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
     5
//  Created by Vittorio on 08/04/10.
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
     6
//  Copyright 2010 __MyCompanyName__. All rights reserved.
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
     7
//
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
     8
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
     9
#import "UIImageExtra.h"
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    10
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    11
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    12
@implementation UIImage (extra)
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
    13
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    14
-(UIImage *)scaleToSize:(CGSize) size {
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
    15
    DLog(@"warning - this is a very expensive operation, you should avoid using it");
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
    16
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
    17
    // Create a bitmap graphics context; this will also set it as the current context
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
    18
    UIGraphicsBeginImageContext(size);
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
    19
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
    20
    // Draw the scaled image in the current context
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
    21
    [self drawInRect:CGRectMake(0, 0, size.width, size.height)];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
    22
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
    23
    // Create a new image from current context
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
    24
    UIImage* scaledImage = UIGraphicsGetImageFromCurrentImageContext();
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
    25
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
    26
    // Pop the current context from the stack
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
    27
    UIGraphicsEndImageContext();
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
    28
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
    29
    // Return our new scaled image (autoreleased)
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
    30
    return scaledImage;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    31
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    32
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    33
-(UIImage *)mergeWith:(UIImage *)secondImage atPoint:(CGPoint) secondImagePoint {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    34
    // create a contex of size of the background image
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    35
    return [self mergeWith:secondImage atPoint:secondImagePoint atSize:self.size];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    36
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    37
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    38
-(UIImage *)mergeWith:(UIImage *)secondImage atPoint:(CGPoint) secondImagePoint atSize:(CGSize) resultingSize {
3778
2e61bb50cc57 add a nice group of hogs in lobby page
koda
parents: 3697
diff changeset
    39
    if (secondImage == nil) {
2e61bb50cc57 add a nice group of hogs in lobby page
koda
parents: 3697
diff changeset
    40
        DLog(@"Warning, secondImage == nil");
2e61bb50cc57 add a nice group of hogs in lobby page
koda
parents: 3697
diff changeset
    41
        return self;
2e61bb50cc57 add a nice group of hogs in lobby page
koda
parents: 3697
diff changeset
    42
    }
2e61bb50cc57 add a nice group of hogs in lobby page
koda
parents: 3697
diff changeset
    43
    
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
    44
    // Create a bitmap graphics context; this will also set it as the current context
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    45
    UIGraphicsBeginImageContext(resultingSize);
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
    46
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
    47
    // draw the background image in the current context
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    48
    [self drawAtPoint:CGPointMake(0,0)];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
    49
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
    50
    // draw the image on top of the first image (because the context is the same)
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    51
    [secondImage drawAtPoint:secondImagePoint];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
    52
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    53
    // create an image from the current contex (not thread safe)
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    54
    UIImage *resultImage = UIGraphicsGetImageFromCurrentImageContext();
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
    55
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    56
    // free drawing contex
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    57
    UIGraphicsEndImageContext();
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
    58
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    59
    // return the resulting autoreleased image
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    60
    return resultImage;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    61
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    62
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    63
-(id) initWithContentsOfFile:(NSString *)path andCutAt:(CGRect) rect {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    64
    // load image from path
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    65
    UIImage *image = [[UIImage alloc] initWithContentsOfFile: path];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
    66
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    67
    if (nil != image) {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    68
        // get its CGImage representation with a give size
3621
a8ddf681ba7d initial support for customizing weaponset
koda
parents: 3573
diff changeset
    69
        CGImageRef cgImage = CGImageCreateWithImageInRect([image CGImage], rect);
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
    70
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    71
        // clean memory
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    72
        [image release];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
    73
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    74
        // create a UIImage from the CGImage (memory must be allocated already)
3621
a8ddf681ba7d initial support for customizing weaponset
koda
parents: 3573
diff changeset
    75
        UIImage *sprite = [self initWithCGImage:cgImage];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
    76
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    77
        // clean memory
3621
a8ddf681ba7d initial support for customizing weaponset
koda
parents: 3573
diff changeset
    78
        CGImageRelease(cgImage);
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    79
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    80
        // return resulting image
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    81
        return sprite;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    82
    } else {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    83
        DLog(@"error - image == nil");
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    84
        return nil;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    85
    }
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    86
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    87
3621
a8ddf681ba7d initial support for customizing weaponset
koda
parents: 3573
diff changeset
    88
-(UIImage *)cutAt:(CGRect) rect {
a8ddf681ba7d initial support for customizing weaponset
koda
parents: 3573
diff changeset
    89
    CGImageRef cgImage = CGImageCreateWithImageInRect([self CGImage], rect);
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
    90
3621
a8ddf681ba7d initial support for customizing weaponset
koda
parents: 3573
diff changeset
    91
    UIImage *res = [UIImage imageWithCGImage:cgImage];
a8ddf681ba7d initial support for customizing weaponset
koda
parents: 3573
diff changeset
    92
    CGImageRelease(cgImage);
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
    93
3621
a8ddf681ba7d initial support for customizing weaponset
koda
parents: 3573
diff changeset
    94
    return res;
a8ddf681ba7d initial support for customizing weaponset
koda
parents: 3573
diff changeset
    95
}
a8ddf681ba7d initial support for customizing weaponset
koda
parents: 3573
diff changeset
    96
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
    97
-(UIImage *)convertToGrayScale {
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
    98
    // Create image rectangle with current image width/height
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
    99
    CGRect imageRect = CGRectMake(0, 0, self.size.width, self.size.height);
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
   100
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   101
    // Grayscale color space
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   102
    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray();
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
   103
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   104
    // Create bitmap content with current image size and grayscale colorspace
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   105
    CGContextRef context = CGBitmapContextCreate(nil, self.size.width, self.size.height, 8, 0, colorSpace, kCGImageAlphaNone);
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
   106
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   107
    // Draw image into current context, with specified rectangle
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   108
    // using previously defined context (with grayscale colorspace)
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   109
    CGContextDrawImage(context, imageRect, [self CGImage]);
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
   110
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   111
    // Create bitmap image info from pixel data in current context
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   112
    CGImageRef imageRef = CGBitmapContextCreateImage(context);
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
   113
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
   114
    // Create a new UIImage object
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   115
    UIImage *newImage = [UIImage imageWithCGImage:imageRef];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
   116
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   117
    // Release colorspace, context and bitmap information
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   118
    CGColorSpaceRelease(colorSpace);
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   119
    CGContextRelease(context);
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   120
    CFRelease(imageRef);
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
   121
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   122
    // Return the new grayscale image
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   123
    return newImage;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   124
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   125
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   126
// by http://iphonedevelopertips.com/cocoa/how-to-mask-an-image.html turned into a category by koda
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   127
-(UIImage*) maskImageWith:(UIImage *)maskImage {
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   128
    // prepare the reference image
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   129
    CGImageRef maskRef = [maskImage CGImage];
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
   130
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   131
    // create the mask using parameters of the mask reference
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   132
    CGImageRef mask = CGImageMaskCreate(CGImageGetWidth(maskRef),
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   133
                                        CGImageGetHeight(maskRef),
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   134
                                        CGImageGetBitsPerComponent(maskRef),
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   135
                                        CGImageGetBitsPerPixel(maskRef),
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   136
                                        CGImageGetBytesPerRow(maskRef),
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   137
                                        CGImageGetDataProvider(maskRef), NULL, false);
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
   138
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   139
    // create an image in the current context
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   140
    CGImageRef masked = CGImageCreateWithMask([self CGImage], mask);
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   141
    CGImageRelease(mask);
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
   142
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   143
    UIImage* retImage = [UIImage imageWithCGImage:masked];
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   144
    CGImageRelease(masked);
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
   145
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   146
    return retImage;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   147
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   148
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   149
// by http://blog.sallarp.com/iphone-uiimage-round-corners/ turned into a category by koda
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   150
void addRoundedRectToPath(CGContextRef context, CGRect rect, CGFloat ovalWidth, CGFloat ovalHeight) {
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   151
    CGFloat fw, fh;
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   152
    if (ovalWidth == 0 || ovalHeight == 0) {
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   153
        CGContextAddRect(context, rect);
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   154
        return;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   155
    }
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   156
    CGContextSaveGState(context);
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   157
    CGContextTranslateCTM (context, CGRectGetMinX(rect), CGRectGetMinY(rect));
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   158
    CGContextScaleCTM (context, ovalWidth, ovalHeight);
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   159
    fw = CGRectGetWidth (rect) / ovalWidth;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   160
    fh = CGRectGetHeight (rect) / ovalHeight;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   161
    CGContextMoveToPoint(context, fw, fh/2);
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   162
    CGContextAddArcToPoint(context, fw, fh, fw/2, fh, 1);
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   163
    CGContextAddArcToPoint(context, 0, fh, 0, fh/2, 1);
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   164
    CGContextAddArcToPoint(context, 0, 0, fw/2, 0, 1);
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   165
    CGContextAddArcToPoint(context, fw, 0, fw, fh/2, 1);
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   166
    CGContextClosePath(context);
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   167
    CGContextRestoreGState(context);
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   168
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   169
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
   170
-(UIImage *)makeRoundCornersOfSize:(CGSize) sizewh {
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   171
    CGFloat cornerWidth = sizewh.width;
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   172
    CGFloat cornerHeight = sizewh.height;
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   173
    CGFloat w = self.size.width;
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   174
    CGFloat h = self.size.height;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
   175
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   176
    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   177
    CGContextRef context = CGBitmapContextCreate(NULL, w, h, 8, 4 * w, colorSpace, kCGImageAlphaPremultipliedFirst);
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
   178
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   179
    CGContextBeginPath(context);
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   180
    CGRect rect = CGRectMake(0, 0, w, h);
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   181
    addRoundedRectToPath(context, rect, cornerWidth, cornerHeight);
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   182
    CGContextClosePath(context);
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   183
    CGContextClip(context);
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
   184
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   185
    CGContextDrawImage(context, CGRectMake(0, 0, w, h), [self CGImage]);
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
   186
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   187
    CGImageRef imageMasked = CGBitmapContextCreateImage(context);
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   188
    CGContextRelease(context);
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   189
    CGColorSpaceRelease(colorSpace);
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
   190
3573
c84067629035 complete configuration for schemes
koda
parents: 3547
diff changeset
   191
    UIImage *newImage = [UIImage imageWithCGImage:imageMasked];
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   192
    CGImageRelease(imageMasked);
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3621
diff changeset
   193
3547
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   194
    return newImage;
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   195
}
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   196
02875b1145b7 i <3 mercurial
koda
parents: 3546
diff changeset
   197
@end