Documentation/fb/cmap_xfbdev

Chinese translated version of Documentation/filesystems/ecryptfs


If you have any comment or update to the content, please contact the
original document maintainer directly.  However, if you have a problem
communicating in English you can also ask the Chinese maintainer for
help.  Contact the Chinese maintainer if this translation is outdated
or if there is a problem with the translation.




Chinese maintainer: 朱司仪  331954465@qq.com
---------------------------------------------------------------------
Documentation/fb/cmap_xfbdev的中文翻译




如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文
交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻
译存在问题,请联系中文版维护者。


中文版维护者: 朱司仪  331954465@qq.com
中文版翻译者: 朱司仪  331954465@qq.com
中文版校译者: 朱司仪  331954465@qq.com




以下为正文
---------------------------------------------------------------------
                      =============
                      Documentation/fb/cmap_xfbdev
                      =============
 
 
Understanding fbdev's cmap
了解fbdev的CMAP
--------------------------


These notes explain how X's dix layer uses fbdev's cmap structures.


这些笔记解释X的DIX层如何使用fbdev的CMAP结构的。




*. example of relevant structures in fbdev as used for a 3-bit grayscale cmap
struct fb_var_screeninfo {
        .bits_per_pixel = 8,
        .grayscale      = 1,
        .red =          { 4, 3, 0 },
        .green =        { 0, 0, 0 },
        .blue =         { 0, 0, 0 },
}
struct fb_fix_screeninfo {
        .visual =       FB_VISUAL_STATIC_PSEUDOCOLOR,
}
for (i = 0; i < 8; i++)
info->cmap.red[i] = (((2*i)+1)*(0xFFFF))/16;
memcpy(info->cmap.green, info->cmap.red, sizeof(u16)*8);
memcpy(info->cmap.blue, info->cmap.red, sizeof(u16)*8);




*。fbdev的有关结构的例子,如用于一个3位的灰度与cmap
结构fb_var_screeninfo{
        .bits_per_pixel = 8,
        .grayscale      = 1,
        .red =          { 4, 3, 0 },
        .green =        { 0, 0, 0 },
        .blue =         { 0, 0, 0 },
}
struct fb_fix_screeninfo {
        .visual =       FB_VISUAL_STATIC_PSEUDOCOLOR,
}
for (i = 0; i < 8; i++)
info->cmap.red[i] = (((2*i)+1)*(0xFFFF))/16;
memcpy(info->cmap.green, info->cmap.red, sizeof(u16)*8);
memcpy(info->cmap.blue, info->cmap.red, sizeof(u16)*8);




*. X11 apps do something like the following when trying to use grayscale.
for (i=0; i < 8; i++) {
char colorspec[64];
memset(colorspec,0,64);
sprintf(colorspec, "rgb:%x/%x/%x", i*36,i*36,i*36);
if (!XParseColor(outputDisplay, testColormap, colorspec, &wantedColor))
printf("Can't get color %s\n",colorspec);
XAllocColor(outputDisplay, testColormap, &wantedColor);
grays[i] = wantedColor;
}
There's also named equivalents like gray1..x provided you have an rgb.txt.




*。X11的应用程序做类似以下时,尝试使用灰度。
for (i=0; i < 8; i++) {
char colorspec[64];
memset(colorspec,0,64);
sprintf(colorspec, "rgb:%x/%x/%x", i*36,i*36,i*36);
if (!XParseColor(outputDisplay, testColormap, colorspec, &wantedColor))
printf("Can't get color %s\n",colorspec);
XAllocColor(outputDisplay, testColormap, &wantedColor);
grays[i] = wantedColor;
}
也叫现金等价物,如GRAY1.. X你有一个rgb.txt。






Somewhere in X's callchain, this results in a call to X code that handles the
colormap. For example, Xfbdev hits the following:


xc-011010/programs/Xserver/dix/colormap.c:


FindBestPixel(pentFirst, size, prgb, channel)


dr = (long) pent->co.local.red - prgb->red;
dg = (long) pent->co.local.green - prgb->green;
db = (long) pent->co.local.blue - prgb->blue;
sq = dr * dr;
UnsignedToBigNum (sq, &sum);
BigNumAdd (&sum, &temp, &sum);


某处在X的callchain的,这将导致一个呼叫到X的代码的处理
色彩对照表。例如,Xfbdev的击中如下:
xc-011010/programs/Xserver/dix/colormap.c:


FindBestPixel(pentFirst, size, prgb, channel)


dr = (long) pent->co.local.red - prgb->red;
dg = (long) pent->co.local.green - prgb->green;
db = (long) pent->co.local.blue - prgb->blue;
sq = dr * dr;
UnsignedToBigNum (sq, &sum);
BigNumAdd (&sum, &temp, &sum);




co.local.red are entries that were brought in through FBIOGETCMAP which come
directly from the info->cmap.red that was listed above. The prgb is the rgb
that the app wants to match to. The above code is doing what looks like a least
squares matching function. That's why the cmap entries can't be set to the left
hand side boundaries of a color range.


条目co.local.red被带到在FBIOGETCMAP通过来
直接从信息> cmap.red的,上面列出。该prgb RGB
该应用程序要匹配。上面的代码是做什么的看起来像一个至少
广场匹配功能。这就是为什么与cmap项不能被设定于左侧
手侧边界的颜色范围。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值