本文整理汇总了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);
}
示例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);
}