Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c 调整CGImageRef的大小而不进行反链接_Objective C_Xcode_Scaling_Nsimage_Cgimageref - Fatal编程技术网

Objective c 调整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,

我正在尝试调整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像素的图像,但放大后的图像看起来有抗锯齿(看起来)

试试
CGContextSetInterpolationQuality

// disable interpolation like this:
CGContextSetInterpolationQuality(mainViewContentContext, kCGInterpolationNone);
// now draw

有趣的问题。大多数情况下,人们要求的是相反的。只是为了便于人们参考和谷歌搜索,这里发生的事情被称为插值,而不是抗锯齿。同样的事情:(我没有变得完美pixels@Marek我误解了你的问题。我所做的例子强制执行HQ插值更新。。。