ios4.1中的CGImageMaskCreate

时间:2012-10-29 11:13:29

标签: iphone animation uiimageview uiimage imagemagick

我正在使用以下屏蔽代码: -

- (UIImage*) maskImage:(UIImage *)im withMask:(UIImage *)maskImage {

    CGImageRef maskRef = maskImage.CGImage;

    CGImageRef mask = CGImageMaskCreate(CGImageGetWidth(maskRef),
                                        CGImageGetHeight(maskRef),
                                        CGImageGetBitsPerComponent(maskRef),
                                        CGImageGetBitsPerPixel(maskRef),
                                        CGImageGetBytesPerRow(maskRef),
                                        CGImageGetDataProvider(maskRef), NULL, false);

    CGImageRef masked = CGImageCreateWithMask([im CGImage], mask);
    return [UIImage imageWithCGImage:masked];

}

0 个答案:

没有答案