skyilyskyily.blog.chinaunix.net
skyily
全部博文(144)
2010年(16)
2009年(128)
Zane_Yu
tasteswe
zwrvvv
xiao888l
zimuqing
leilelei
Phyllis6
jonathan
denghai1
wbdwbd04
itTangze
lifj1234
18141908
AAABug
分类: WINDOWS
2009-04-10 20:35:50
:请把RGB(565)格式数据改成RGB(888)格式,即用三个byte表示原来两个byte的数据565: | byte0 | byte1 | | x1 x2 x3 x4 x5 x6 x7 x8 | x9 x10 x11 x12 x13 x14 x15 x16 |888: | byte0 | byte1 | byte2 | | 0 0 0 x1 x2 x3 x4 x5 | 0 0 x6 x7 x8 x9 x10 x11 | 0 0 0 x12 x13 x14 x15 x16 |程序:#include <stdio.h>void rgb565_2_rgb888(unsigned short *rgb565, unsigned int *rgb888){ *rgb888 = ((*rgb565) & 0xf800); *rgb888 = ((*rgb888) << 8); *rgb888 = ((*rgb888) | ((*rgb565 & 0x07e0) << 5)); *rgb888 = (*rgb888) | (((*rgb565) & 0x001f) << 3); printf("%d\n", *rgb888);}int main(void){ unsigned short rgb565 = 8; unsigned int rgb888 = 0; rgb565_2_rgb888(&rgb565, &rgb888); return 0;}
输出:64
上一篇:c栈的记忆
下一篇:链表的删除del
登录 注册