Objective c 将YUV框架转换为CGV上下文
如何将YUV帧数据写入CGContext 请帮帮我Objective c 将YUV框架转换为CGV上下文,objective-c,frame,cgcontext,yuv,Objective C,Frame,Cgcontext,Yuv,如何将YUV帧数据写入CGContext 请帮帮我 非常感谢。关于您需要执行的操作以及一些伪代码的一般路线图如下所示: 首先创建要绘制的CG位图上下文。的像素格式列表可用。正如你在iOS上看到的那样,你唯一的选择是一些16或32 bpp的RGB风格和alpha通道。Mac OS X上有更多的选项,但您仍然希望使用一些RGB风格 CGColorSpaceRef rgbColorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef frameCont
非常感谢。关于您需要执行的操作以及一些伪代码的一般路线图如下所示:
CGColorSpaceRef rgbColorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef frameContext = CGBitmapContextCreate(NULL, w, h, 8, bytesPerRow, rgbColorSpace, kCGImageAlphaNoneSkipFirst);
CGColorSpaceRelease(rgbColorSpace);
void * data = CGBitmapContextGetData(frameContext);
CGImageRef frameImage = CGBitmapContextCreateImage(frameContext);
CGContextDrawImage(myCGContext, myCGRect, frameImage);