5

我正在尝试调整 10x10 像素 CGImageRef 的大小,如下所示:

CGImageRef imageRef = CGImageCreateWithImageInRect(screenShot, CGRectMake(mouseLoc.x-5, screen_height-mouseLoc.y-5, 10, 10));

CGContextRef mainViewContentContext = CGBitmapContextCreate (NULL, maskImage.size.width, maskImage.size.height, 8, maskImage.size.height*4, colorSpace, kCGImageAlphaPremultipliedFirst);

CGContextDrawImage(mainViewContentContext, NSMakeRect(0,0, maskImage.size.width, maskImage.size.height), imageRef);

然后我需要像这样制作一个 250x250 像素的图像但是放大后的图像看起来上面有抗锯齿(看起来像这样

4

1 回答 1

6

尝试CGContextSetInterpolationQuality

// disable interpolation like this:
CGContextSetInterpolationQuality(mainViewContentContext, kCGInterpolationNone);
// now draw
于 2011-08-29T17:07:44.023 回答