所以我有下面的代碼,並在行是const double colorMasking [6]現在它是一個雙重,但如果我清理並建立它說不兼容指針類型傳遞雙應該是浮動。然後,但是如果我改變它浮動的錯誤消失,但一旦我清理並再次構建它說不兼容的指針類型傳遞float應該是雙倍。與我剛剛做的完全相反。任何想法發生了什麼?不管類型傳遞的指針類型不相容?
-(UIImage *)changeWhiteColorTransparent: (UIImage *)image
{
CGImageRef rawImageRef=image.CGImage;
const double colorMasking[6] = {222, 255, 222, 255, 222, 255};
UIGraphicsBeginImageContext(image.size);
CGImageRef maskedImageRef=CGImageCreateWithMaskingColors(rawImageRef, colorMasking);
{
//if in iphone
CGContextTranslateCTM(UIGraphicsGetCurrentContext(), 0.0, image.size.height);
CGContextScaleCTM(UIGraphicsGetCurrentContext(), 1.0, -1.0);
}
CGContextDrawImage(UIGraphicsGetCurrentContext(), CGRectMake(0, 0, image.size.width, image.size.height), maskedImageRef);
UIImage *result = UIGraphicsGetImageFromCurrentImageContext();
CGImageRelease(maskedImageRef);
UIGraphicsEndImageContext();
return result;
}
愚蠢的問題:用該錯誤消息標記哪條線。 – 2015-02-11 02:02:01
如果'colorMasking'是'CGFloat'而不是'double',它會工作嗎? – NobodyNada 2015-02-11 02:02:13
@HotLicks我認爲它是'CGImageRef maskedImageRef = CGImageCreateWithMaskingColors(rawImageRef,colorMasking);',因爲那是他唯一通過'colorMasking'的時間。 – NobodyNada 2015-02-11 02:02:48