加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

什么(0 << 12)在Swift中意味着什么?

发布时间:2020-12-14 05:39:15 所属栏目:百科 来源:网络整理
导读:在文档中,我发现枚举案例定义为: kCGBitmapByteOrderDefault = (0 12) 据我所知,这意味着位移零12次……仍为零.我错过了什么? 每个 Apple Doc for CGBitmapInfo: The byte order constants specify the byte ordering of pixel formats. …If the code is
在文档中,我发现枚举案例定义为:
kCGBitmapByteOrderDefault = (0 << 12)

据我所知,这意味着位移零12次……仍为零.我错过了什么?

每个 Apple Doc for CGBitmapInfo:

The byte order constants specify the byte ordering of pixel formats.

…If the code is not written correctly,it’s possible to misread the data which leads to colors or alpha that appear wrong.

kCGBitmapByteOrder的各种常量主要映射到CGImageByteOrder中类似命名的常量,它没有“默认值”.

这些值详见in the docs for CGImageByteOrderInfo

您询问的是默认值,正如您所注意到的那样,位移0仍为0,但正如Rob所说,前面/后面的位仍然很重要.

您缺少的是其他选项:

kCGBitmapByteOrder16Little =(1 << 12)
16位小端格式.

kCGBitmapByteOrder32Little =(2<< 12)
32位小端格式.

kCGBitmapByteOrder16Big =(3<< 12)
16位,大端格式.

kCGBitmapByteOrder32Big =(4<< 12)
32位,大端格式.

它们使用不同的值,具体取决于16位与32位图像,以及您是否首先关注最小或最重要的数字.

“默认”(0<<<<<<<<<<<<<<<<<<< 12&gt使用这些其他选项对它们的解释方式与使用“默认”的方式有不同的影响

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读