簡體   English   中英

如何使用常量解碼位圖

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM