本文整理汇总了C#中ColorMine.ColorSpaces.Rgb类的典型用法代码示例。如果您正苦于以下问题:C# Rgb类的具体用法?C# Rgb怎么用?C# Rgb使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Rgb类属于ColorMine.ColorSpaces命名空间,在下文中一共展示了Rgb类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WhiteRgbToLch
public void WhiteRgbToLch()
{
var knownColor = new Rgb { R = 255, G = 255, B = 255, };
var expectedColor = new Lch { L = 100, C = .01166, H = 296.813, };
ExpectedValuesForKnownColor(knownColor,expectedColor);
}
示例2: WhiteRgbToRgb
public void WhiteRgbToRgb()
{
var knownColor = new Rgb { R = 255, G = 255, B = 255, };
var expectedColor = new Rgb { R = 255, G = 255, B = 255, };
ExpectedValuesForKnownColor(knownColor,expectedColor);
}
示例3: WhiteRgbToHsl
public void WhiteRgbToHsl()
{
var knownColor = new Rgb { R = 255, G = 255, B = 255, };
var expectedColor = new Hsl { H = 0, S = 0, L = 100, };
ExpectedValuesForKnownColor(knownColor,expectedColor);
}
示例4: WhiteRgbToLab
public void WhiteRgbToLab()
{
var knownColor = new Rgb { R = 255, G = 255, B = 255, };
var expectedColor = new Lab { L = 100, A = 0.00526, B = -.0104, };
ExpectedValuesForKnownColor(knownColor,expectedColor);
}
示例5: GetDifferenceUsingCie1976Comparison
public double GetDifferenceUsingCie1976Comparison(Rgb color1, Rgb color2)
{
var colorRgb1 = new Rgb { R = color1.R, G = color1.G, B = color1.B };
var colorRgb2 = new Rgb { R = color2.R, G = color2.G, B = color2.B };
return _comparer.Compare(colorRgb1, colorRgb2);
}
示例6: WhiteRgbToCmyk
public void WhiteRgbToCmyk()
{
var knownColor = new Rgb { R = 255, G = 255, B = 255, };
var expectedColor = new Cmyk { C = 0, M = 0, Y = 0, K = 0, };
ExpectedValuesForKnownColor(knownColor,expectedColor);
}
示例7: ToListLabInfo
public static List<LabInfo> ToListLabInfo(List<PixelInfo> pixelInfo)
{
var labInfo = new List<LabInfo>();
var labList = new List<Lab>();
var listColors = new List<Color>();
var listLabLists = new List<List<Lab>>();
foreach (var pixInfo in pixelInfo)
{
foreach (var pix in pixInfo.PixelData)
{
var rgb = new Rgb();
rgb.R = pix.red;
rgb.G = pix.green;
rgb.B = pix.blue;
labList.Add(rgb.To<Lab>());
}
listLabLists.Add(new List<Lab>(labList));
listColors.Add(pixInfo.Color);
labList.Clear();
}
for (int i = 0; i < listColors.Count; i++)
{
labInfo.Add(new LabInfo(listLabLists[i], listColors[i]));
}
return labInfo;
}
示例8: WhiteRgbToXyz
public void WhiteRgbToXyz()
{
var knownColor = new Rgb { R = 255, G = 255, B = 255, };
var expectedColor = new Xyz { X = 95.050, Y = 100, Z = 108.900, };
ExpectedValuesForKnownColor(knownColor,expectedColor);
}
示例9: PaletteTile
protected PaletteTile(int id, double widthAndHeight, Rgb rgb)
{
Id = id;
Width = widthAndHeight;
Height = widthAndHeight;
Rgb = rgb;
}
示例10: DarkVioletCmykToRgb
public void DarkVioletCmykToRgb()
{
var knownColor = new Cmyk { C = .29858, M = 1, Y = 0, K = .17255, };
var expectedColor = new Rgb { R = 148, G = 0, B = 211, };
ExpectedValuesForKnownColor(knownColor,expectedColor);
}
示例11: ReturnsZeroForSameColors
public void ReturnsZeroForSameColors()
{
var compareColor = new Rgb {R = 140, G = 130, B = 23};
// Todo, should be mocking!!
var a = new Rgb();
a.Initialize(compareColor);
var b = new Rgb();
b.Initialize(compareColor);
ReturnsExpectedValueForKnownInput(0.0, a, b);
}
示例12: ToLabData
public static List<Lab> ToLabData(List<PixelData> pixelData)
{
var labData = new List<Lab>();
foreach (var pix in pixelData)
{
var rgb = new Rgb();
rgb.R = pix.red;
rgb.G = pix.green;
rgb.B = pix.blue;
labData.Add(rgb.To<Lab>());
}
return labData;
}
示例13: FindBestTile
public PaletteTile FindBestTile(Rgb rgb)
{
var minimumDeltaE = double.MaxValue;
PaletteTile result = null;
foreach (var tileInfo in _tiles)
{
var deltaE = GetDifferenceUsingCie1976Comparison(tileInfo.Rgb, rgb);
if (deltaE < minimumDeltaE)
{
minimumDeltaE = deltaE;
result = tileInfo;
}
}
return result;
}
示例14: Calculate
public Rgb Calculate(Bitmap bitmap)
{
double rSum = 0;
double gSum = 0;
double bSum = 0;
for (var y = 0; y < bitmap.Height; y++)
{
for (var x = 0; x < bitmap.Width; x++)
{
var pixel = bitmap.GetPixel(x, y);
var rgb = new Rgb{ R = pixel.R, G = pixel.G, B = pixel.B };
// var lab= rgb.To<Lab>();
rSum += rgb.R;
gSum += rgb.G;
bSum += rgb.B;
}
}
var pixelCount = bitmap.Width * bitmap.Height;
return new Rgb(rSum / pixelCount, gSum / pixelCount, bSum / pixelCount);
}
示例15: GoldenrodRgbToYxy
public void GoldenrodRgbToYxy()
{
var knownColor = new Rgb { R = 218, G = 165, B = 32, };
var expectedColor = new Yxy { Y1 = 41.920, X = .46457, Y2 = .45684, };
ExpectedValuesForKnownColor(knownColor,expectedColor);
}