을합니다. 나는 CGContext의 크기를 조정하는 기능 개발 :
void MPResizeContextWithNewSize(CGContextRef *c, CGSize s) {
size_t bitsPerComponents = CGBitmapContextGetBitsPerComponent(*c);
size_t numberOfComponents = CGBitmapContextGetBitsPerPixel(*c)/bitsPerComponents;
CGContextRef newContext = CGBitmapContextCreate(NULL, s.width, s.height, bitsPerComponents, sizeof(UInt8)*s.width*numberOfComponents,
CGBitmapContextGetColorSpace(*c), CGBitmapContextGetBitmapInfo(*c));
// Copying context content
CGImageRef im = CGBitmapContextCreateImage(*c);
CGContextDrawImage(newContext, CGRectMake(0, 0, CGBitmapContextGetWidth(*c), CGBitmapContextGetHeight(*c)), im);
CGImageRelease(im);
CGContextRelease(*c);
*c = newContext;
}
이 UIGraphicsBeginImageContext(...)
기능에 의해 제공되는 컨텍스트 작동하는지 모르겠어요,하지만 당신은 CGBitmapContextCreate
에 수동으로 컨텍스트를 작성하는 경우, 그것은 작동합니다.
당신이 물어봤을 때 도움이 되었으면 좋겠다.
이것은 내가 필요로하는 것이 아니며 그리기 공간을 늘려야한다. – Moonkid
[this] (http://juliuspaintings.co.uk/cgi-bin/paint_css/more_cocoa_examples/090-CGImage-scale.pl) 링크 체크 아웃. makeContextOfSize를 사용하여 CGContext를 만드는 데 도움이됩니다. – Anil