当前位置: 首页>>代码示例>>C#>>正文


C# RGB.GetUchar方法代码示例

本文整理汇总了C#中RGB.GetUchar方法的典型用法代码示例。如果您正苦于以下问题:C# RGB.GetUchar方法的具体用法?C# RGB.GetUchar怎么用?C# RGB.GetUchar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RGB的用法示例。


在下文中一共展示了RGB.GetUchar方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ApplyDarkening

        /* Apply limb darkening by cosine rule. */
        Pixel ApplyDarkening(int width, int height, int x, Vector3 sv, double dysq,
			 RGB rgb)
        {
            double dx = 2 * ((width / 2 - x) / ((double) height));
              double dxsq = dx * dx;

              double di = sv.X * dx + sv.Y + sv.Z * Math.Sqrt(1.0 - dxsq);
              di = Math.Min(1.0, Math.Max(0.0, di));

              // Calculate  atmospheric absorption  based on the
              // thickness of atmosphere traversed by  light  on
              // its way to the surface.

              double ds = Math.Min(1.0, Math.Sqrt(dxsq + dysq));
              double dsq = ds * ds;
              double athfac = Math.Sqrt(atthick * atthick - 1.0);
              double dsat = atSatFac * ((Math.Sqrt(atthick * atthick - dsq) -
                 Math.Sqrt(1.0 * 1.0 - dsq)) / athfac);

              double inx = planetAmbient + (1.0 - planetAmbient) * di;

              byte ir, ig, ib;
              rgb.GetUchar(out ir, out ig, out ib);

              ir = (byte) ((ir * (1.0 - dsat) + 127 * dsat) * inx);
              ig = (byte) ((ig * (1.0 - dsat) + 127 * dsat) * inx);
              ib = (byte) ((ib * (1.0 - dsat) + 255 * dsat) * inx);

              return new Pixel(ir, ig, ib);
        }
开发者ID:unhammer,项目名称:gimp-sharp,代码行数:31,代码来源:Planet.cs

示例2: ReplaceColor

 void ReplaceColor(ref Gdk.Color color, RGB rgb)
 {
     var colors = new Gdk.Color[]{color};
       var colormap = Colormap.System;
       colormap.FreeColors(colors, 1);
       byte red, green, blue;
       rgb.GetUchar(out red, out green, out blue);
       color = new Gdk.Color(red, green, blue);
       colormap.AllocColor (ref color, true, true);
 }
开发者ID:unhammer,项目名称:gimp-sharp,代码行数:10,代码来源:PreviewRenderer.cs


注:本文中的RGB.GetUchar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。