本文整理汇总了C#中System.Drawing.Color.ToColor4方法的典型用法代码示例。如果您正苦于以下问题:C# System.Drawing.Color.ToColor4方法的具体用法?C# System.Drawing.Color.ToColor4怎么用?C# System.Drawing.Color.ToColor4使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Drawing.Color
的用法示例。
在下文中一共展示了System.Drawing.Color.ToColor4方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCachedLinearGradientBrush
private LinearGradientBrush GetCachedLinearGradientBrush(Color color1, Color color2)
{
long kh = color1.ToArgb(); // high bits
long kl = color2.ToArgb(); // low bits
var colorKey = (kh << 32) | kl;
LinearGradientBrush brush;
if (!m_linearGradients.TryGetValue(colorKey, out brush))
{
var stops = new GradientStop[2];
stops[0].Color = color1.ToColor4();
stops[0].Position = 0;
stops[1].Color = color2.ToColor4();
stops[1].Position = 1;
using (var stopCollection = new GradientStopCollection(m_renderTarget, stops, Gamma.StandardRgb, ExtendMode.Clamp))
{
var props = new LinearGradientBrushProperties();
brush = new LinearGradientBrush(m_renderTarget, props, stopCollection);
}
m_linearGradients.Add(colorKey, brush);
}
return brush;
}
示例2: Clear
/// <summary>
/// Clears the drawing area to the specified color</summary>
/// <param name="color">The color to which the drawing area is cleared</param>
public void Clear(Color color)
{
m_renderTarget.Clear(color.ToColor4());
}