--- a/project_files/HedgewarsMobile/Classes/UIImageExtra.m Sat Jul 03 15:31:36 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/UIImageExtra.m Sun Jul 04 00:33:59 2010 +0200
@@ -61,16 +61,16 @@
if (nil != image) {
// get its CGImage representation with a give size
- CGImageRef cgImgage = CGImageCreateWithImageInRect([image CGImage], rect);
+ CGImageRef cgImage = CGImageCreateWithImageInRect([image CGImage], rect);
// clean memory
[image release];
// create a UIImage from the CGImage (memory must be allocated already)
- UIImage *sprite = [self initWithCGImage:cgImgage];
+ UIImage *sprite = [self initWithCGImage:cgImage];
// clean memory
- CGImageRelease(cgImgage);
+ CGImageRelease(cgImage);
// return resulting image
return sprite;
@@ -80,6 +80,15 @@
}
}
+-(UIImage *)cutAt:(CGRect) rect {
+ CGImageRef cgImage = CGImageCreateWithImageInRect([self CGImage], rect);
+
+ UIImage *res = [UIImage imageWithCGImage:cgImage];
+ CGImageRelease(cgImage);
+
+ return res;
+}
+
-(UIImage *)convertToGrayScale {
// Create image rectangle with current image width/height
CGRect imageRect = CGRectMake(0, 0, self.size.width, self.size.height);