Objective c 调整CGImageRef的大小而不进行反链接
我正在尝试调整10x10像素CGImageRef的大小,如下所示:Objective c 调整CGImageRef的大小而不进行反链接,objective-c,xcode,scaling,nsimage,cgimageref,Objective C,Xcode,Scaling,Nsimage,Cgimageref,我正在尝试调整10x10像素CGImageRef的大小,如下所示: CGImageRef imageRef = CGImageCreateWithImageInRect(screenShot, CGRectMake(mouseLoc.x-5, screen_height-mouseLoc.y-5, 10, 10)); CGContextRef mainViewContentContext = CGBitmapContextCreate (NULL, maskImage.size.width,
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像素的图像,但放大后的图像看起来有抗锯齿(看起来)试试
CGContextSetInterpolationQuality
:
// disable interpolation like this:
CGContextSetInterpolationQuality(mainViewContentContext, kCGInterpolationNone);
// now draw
有趣的问题。大多数情况下,人们要求的是相反的。只是为了便于人们参考和谷歌搜索,这里发生的事情被称为插值,而不是抗锯齿。同样的事情:(我没有变得完美pixels@Marek我误解了你的问题。我所做的例子强制执行HQ插值更新。。。