本文整理汇总了C#中PaintDotNet.ColorBgra.ToColor方法的典型用法代码示例。如果您正苦于以下问题:C# ColorBgra.ToColor方法的具体用法?C# ColorBgra.ToColor怎么用?C# ColorBgra.ToColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PaintDotNet.ColorBgra
的用法示例。
在下文中一共展示了ColorBgra.ToColor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
protected override ColorBgra Render(int x, int y, ColorBgra initial, Surface source)
{
var shade = initial.ToColor().GetBrightness();
if (Math.Abs(shade - BgShade) > ShadeThreshold) return initial;
var norm = Normalize(initial);
if (Math.Abs(BgNormal.R - norm.R) > ColorThreshold
|| Math.Abs(BgNormal.G - norm.G) > ColorThreshold
|| Math.Abs(BgNormal.B - norm.B) > ColorThreshold) {
return initial;
}
var alpha = (byte)(Math.Min(255, Math.Max(0,
Math.Max(Math.Max(
Math.Abs(BgColor.R - initial.R),
Math.Abs(BgColor.G - initial.G)),
Math.Abs(BgColor.B - initial.B)))
* (1d - AlphaFalloff)));
return ColorBgra.FromBgra(initial.B, initial.G, initial.R, alpha);
}
示例2: Apply
public override ColorBgra Apply(ColorBgra color)
{
//adjust saturation
byte intensity = color.GetIntensityByte();
color.R = Utility.ClampToByte((intensity * 1024 + (color.R - intensity) * satFactor) >> 10);
color.G = Utility.ClampToByte((intensity * 1024 + (color.G - intensity) * satFactor) >> 10);
color.B = Utility.ClampToByte((intensity * 1024 + (color.B - intensity) * satFactor) >> 10);
HsvColor hsvColor = HsvColor.FromColor(color.ToColor());
int hue = hsvColor.Hue;
hue += hueDelta;
while (hue < 0)
{
hue += 360;
}
while (hue > 360)
{
hue -= 360;
}
hsvColor.Hue = hue;
ColorBgra newColor = ColorBgra.FromColor(hsvColor.ToColor());
newColor = blendOp.Apply(newColor);
newColor.A = color.A;
return newColor;
}
示例3: RenderColorAddIcon
private void RenderColorAddIcon(ColorBgra newColor)
{
if (this.colorAddIcon == null)
{
this.colorAddIcon = new Bitmap(16, 16, PixelFormat.Format32bppArgb);
}
using (Graphics g = Graphics.FromImage(this.colorAddIcon))
{
Rectangle rect = new Rectangle(0, 0, this.colorAddIcon.Width - 2, this.colorAddIcon.Height - 2);
Utility.DrawColorRectangle(g, rect, newColor.ToColor(), true);
g.DrawImage(this.colorAddOverlay, 0, 0);
}
this.colorAddButton.Image = this.colorAddIcon;
this.colorAddButton.Invalidate();
}
示例4: SyncHsvFromRgb
/// <summary>
/// Whenever a color is changed via RGB methods, call this and the HSV
/// counterparts will be sync'd up.
/// </summary>
/// <param name="newColor">The RGB color that should be converted to HSV.</param>
private void SyncHsvFromRgb(ColorBgra newColor)
{
if (ignore == 0)
{
ignore++;
HsvColor hsvColor = HsvColor.FromColor(newColor.ToColor());
Utility.SetNumericUpDownValue(hueUpDown, hsvColor.Hue);
Utility.SetNumericUpDownValue(saturationUpDown, hsvColor.Saturation);
Utility.SetNumericUpDownValue(valueUpDown, hsvColor.Value);
SetColorGradientValuesHsv(hsvColor.Hue, hsvColor.Saturation, hsvColor.Value);
SetColorGradientMinMaxColorsHsv(hsvColor.Hue, hsvColor.Saturation, hsvColor.Value);
colorWheel.HsvColor = hsvColor;
ignore--;
}
}