gisempire100
捉鬼专家
捉鬼专家
  • 注册日期2004-08-13
  • 发帖数552
  • QQ
  • 铜币2462枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1095回复:0

sRGB和scRGB的区别

楼主#
更多 发布于:2008-01-03 00:03
<DIV class=postbody>
<P>.net FrameWork 3.0 后,我们会发现有两个Color数据结构。<BR>一个是:System.Drawing.Color<BR>一个是:System.Windows.Media.Color</P>
<P><STRONG>这两个结构有啥区别呢?</STRONG></P>
<P>下面是对这两个类的属性的一个简单比较:</P>
<TABLE cellSpacing=0 cellPadding=2 width=616 border=1>

<TR>
<TD vAlign=top width=69> </TD>
<TD vAlign=top width=249><STRONG>System.Drawing.Color Structure</STRONG></TD>
<TD vAlign=top width=295><STRONG>System.Windows.Media.Color Structure</STRONG></TD></TR>
<TR>
<TD vAlign=top width=70>所在组件</TD>
<TD vAlign=top width=249>System.Drawing.dll</TD>
<TD vAlign=top width=295>PresentationCore.dll</TD></TR>
<TR>
<TD vAlign=top width=71>支持的版本</TD>
<TD vAlign=top width=249>
<P>.NET Framework<BR>Supported in: 3.5, 3.0 SP1, 3.0, 2.0 SP1, 2.0, 1.1, 1.0
<P>.NET Compact Framework<BR>Supported in: 3.5, 2.0, 1.0
<P>XNA Framework<BR>Supported in: 1.0</P></TD>
<TD vAlign=top width=295>
<P>.NET Framework<BR>Supported in: 3.5, 3.0 SP1, 3.0</P></TD></TR>
<TR>
<TD vAlign=top width=71>A</TD>
<TD vAlign=top width=249>Gets the alpha component value of this Color structure. </TD>
<TD vAlign=top width=295>Gets or sets the sRGB alpha channel value of the color.</TD></TR>
<TR>
<TD vAlign=top width=72>B</TD>
<TD vAlign=top width=249>Gets the blue component value of this Color structure.</TD>
<TD vAlign=top width=295>Gets or sets the sRGB blue channel value of the color.</TD></TR>
<TR>
<TD vAlign=top width=72>G</TD>
<TD vAlign=top width=249>Gets the green component value of this Color structure.</TD>
<TD vAlign=top width=295>Gets or sets the sRGB green channel value of the color.</TD></TR>
<TR>
<TD vAlign=top width=72>R</TD>
<TD vAlign=top width=249>Gets the red component value of this Color structure.</TD>
<TD vAlign=top width=295>Gets or sets the sRGB red channel value of the color.</TD></TR>
<TR>
<TD vAlign=top width=72>ScA</TD>
<TD vAlign=top width=249>不支持</TD>
<TD vAlign=top width=295>Gets or sets the ScRGB alpha channel value of the color.</TD></TR>
<TR>
<TD vAlign=top width=72>ScB</TD>
<TD vAlign=top width=249>不支持</TD>
<TD vAlign=top width=295>Gets or sets the ScRGB blue channel value of the color.</TD></TR>
<TR>
<TD vAlign=top width=72>ScG</TD>
<TD vAlign=top width=249>不支持</TD>
<TD vAlign=top width=295>Gets or sets the ScRGB green channel value of the color.</TD></TR>
<TR>
<TD vAlign=top width=72>ScR</TD>
<TD vAlign=top width=249>不支持</TD>
<TD vAlign=top width=295>Gets or sets the ScRGB red channel value of the color.</TD></TR>
<TR>
<TD vAlign=top width=72>获得系统支持的一些颜色</TD>
<TD vAlign=top width=249>在Color中定义了141种系统预定义的颜色<BR>调用方法如下:<BR>System.Drawing.Color.AliceBlue</TD>
<TD vAlign=top width=295>不在Color中定义,而是Colors中定义,获得方法类似下面写法:<BR>System.Windows.Media.Colors.AliceBlue<BR>系统一共预定义了141个颜色。</TD></TR>
<TR>
<TD vAlign=top width=72>小结</TD>
<TD vAlign=top width=249>只支持 sRGB。向下兼容</TD>
<TD vAlign=top width=295>同时支持 sRGB、ScRGB。不兼容3.0以下的版本</TD></TR></TABLE>
<P>我们可以在上面看到,关键是sRGB和ScRGB两种颜色表示方法。这两种有啥差别呢?我们来看下面三副图,先来感性的看看:
<P><IMG src="http://blog.joycode.com/images/blog.joycode.com/ghj/1489/r_srbg.png"></P>
<P>这幅图的巧妙之外在于它通过“归一化”,用两维平面来表示三个数据。X轴是红色的比例,Y轴是绿色的比例,而Z轴是蓝色的比例,虽然Z轴没有画出来,但它的比例数据可以很方便地计算出来。比方红是0.2,绿是0.3,那么蓝就是0.5。因为它们三者加起来必须等于1,不然怎么叫“归一化”呢!图上任何一点的蓝色分量,你都可以用这个方法计算出来。
<P>图中的“舌形”色域空间,是人眼能够辨别的色彩空间,它的边缘围绕一道从波长从380到700(毫微米)的光谱,中间就是用红、绿、蓝三种颜色按不同比例调配出来的颜色。
<P>而图中的三角的区域,是 sRGB 可以表示的颜色范围。显然有一些我们人类可以看到的颜色,但是sRGB来描述的。
<P><IMG src="http://blog.joycode.com/images/blog.joycode.com/ghj/1489/r_scrgb.gif">
<P>上面这幅图对比了 sRGB、人眼、ScRGB 可以表示的颜色范围。
<P><IMG src="http://blog.joycode.com/images/blog.joycode.com/ghj/1489/r_sRGBandscRGB.jpg">
<P>上面这幅图是sRGB和ScRGB两幅图的比较,注意看放大了的云彩。
<P><STRONG>sRGB 和 scRGB 的转换</STRONG> </P>
<P>在 System.Windows.Media.Color 结构中,scRGB原色其实是被储存成单精度(single-precision)的浮点数。想要容纳scRGB颜色空间,Color 结构包含四个主要的property,类型都是float,分别为ScA、ScR、ScG、ScB。<BR>这些property和A、R、G、B property 会相互影响,改编G property也会造成ScG property的改变,反之亦然。</P>
<P>当G property 为0,ScG property 也会为0;当G property 为255,ScG property 就会为1。在这个范围之内,<BR>关系并非是线性的,如下表所示。</P>
<TABLE cellSpacing=2 cellPadding=2 width=298 border=0>

<TR>
<TD vAlign=top width=137>scG</TD>
<TD vAlign=top width=153>G</TD></TR>
<TR>
<TD vAlign=top width=137><= 0</TD>
<TD vAlign=top width=153>0</TD></TR>
<TR>
<TD vAlign=top width=137>0.1</TD>
<TD vAlign=top width=153>89</TD></TR>
<TR>
<TD vAlign=top width=137>0.2</TD>
<TD vAlign=top width=153>124</TD></TR>
<TR>
<TD vAlign=top width=137>0.3</TD>
<TD vAlign=top width=153>149</TD></TR>
<TR>
<TD vAlign=top width=137>0.4</TD>
<TD vAlign=top width=153>170</TD></TR>
<TR>
<TD vAlign=top width=137>0.5</TD>
<TD vAlign=top width=153>188</TD></TR>
<TR>
<TD vAlign=top width=137>0.6</TD>
<TD vAlign=top width=153>203</TD></TR>
<TR>
<TD vAlign=top width=137>0.7</TD>
<TD vAlign=top width=153>218</TD></TR>
<TR>
<TD vAlign=top width=137>0.8</TD>
<TD vAlign=top width=153>231</TD></TR>
<TR>
<TD vAlign=top width=137>0.9</TD>
<TD vAlign=top width=153>243</TD></TR>
<TR>
<TD vAlign=top width=137>>=1.0</TD>
<TD vAlign=top width=154>255</TD></TR></TABLE>
<P>ScR 与 R 之间的关系,ScB与B之间的关系,以及ScG与G之间的关系,也都是一样的。ScG的值可以小于0或者大于1,以容纳超出显示器和sRGB数字范围的颜色。</P>
<P>sRGB和scRGB的比较</P>
<P>sRGB目标是使同一网页在不同计算机上显示时的色彩更一致,但只适用于CRT显示器。微软HD Photo项目负责人克劳说,sRGB的挑战在于它只是完整色彩空间的一个子集,当使用sRGB编码时,我们会丢掉一些色彩。 </P>
<P>scRGB色彩空间是sRGB扩展,对于黑色和纯绿色而言,这二者没有任何分别。二者的差别就在于scRGB能够显示人眼无法分辨的颜色,其精细程度也超过了sRGB。
<P>scRGB描述每个点所需要的位数是sRGB 2倍,甚至是4倍。不仅能够使用整数,还能够使用浮点数,提高图像的精细程度。
<P><STRONG>参考资料:</STRONG>
<P>关于scRGB色彩空间<BR><a href="http://hi.baidu.com/cybo/blog/item/8f24ba38bbb584c1d5622597.html" target="_blank" >http://hi.baidu.com/cybo/blog/item/8f24ba38bbb584c1d5622597.html</A></P>
<P>第二章 基本的Brush画刷类 [App = Code + Markup] <BR><a href="http://www.cnblogs.com/rickiedu/archive/2007/04/04/699529.html" target="_blank" >http://www.cnblogs.com/rickiedu/archive/2007/04/04/699529.html</A></P>
<P>GDI+与WPF中的颜色简析<BR><a href="http://blog.csdn.net/johnsuna/archive/2007/08/27/1761061.aspx" target="_blank" >http://blog.csdn.net/johnsuna/archive/2007/08/27/1761061.aspx</A></P>
<P>简述WPF中的图像像素格式(PixelFormats)<BR><a href="http://blog.csdn.net/johnsuna/archive/2007/08/28/1762901.aspx" target="_blank" >http://blog.csdn.net/johnsuna/archive/2007/08/28/1762901.aspx</A></P></DIV>
喜欢0 评分0
A friend is never known till a man has need. ...CL
游客

返回顶部