[英]How to use constants to decode a bitmap
从这里开始:
CGBitmapInfo sampleCGImageBitmapInfo = CGImageGetBitmapInfo(sampleCGImage);
如何使用CGImage参考中定义的常量来确定图像中使用的字节顺序。 我想针对常数kCGBitmapByteOrder32Little和kCGBitmapByteOrder32Big进行测试。 我想知道如何编写代码。 一个很好的答案将是这样的:
...
NSLog(@"kCGBitmapByteOrder32Big = %___", ____);
您可以针对使用CGBitmapInfo定义的常量进行测试,如下所示:
sampleCGImageBitmapInfo = sampleCGBitmapInfo & kCGBitmapByteOrderMask;
if (sampleCGBitmapInfo == kCGBitmapByteOrderDefault)
{
NSLog (@"Default byte order.\n");
}
else if (sampleCGBitmapInfo == kCGBitmapByteOrder16Little)
{
NSLog (@"16 bit little endian\n");
}
else //... etc. for the other CGBitmapByteOrder constants
有关详细信息,请参见“常量”部分中的此处 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.