本文整理汇总了C#中ColorFormat.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ColorFormat.ToString方法的具体用法?C# ColorFormat.ToString怎么用?C# ColorFormat.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ColorFormat
的用法示例。
在下文中一共展示了ColorFormat.ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestParameterSerialization
public void TestParameterSerialization()
{
var decoder = new PackedDecoder();
var p = new List<Parameter>();
decoder.WriteParameters(p);
Assert.AreNotEqual(0, p.Count);
var c1 = p.Count;
decoder.WriteParameters(p);
Assert.AreEqual(c1, p.Count);
decoder.ColorBPP = 4;
var cf = new ColorFormat(12, 5, 6, 4, 1, 3, 18, 1);
decoder.ColorFormat = cf;
((IPictureDecoderController)decoder).Width = 13;
((IPictureDecoderController)decoder).Height = 21;
decoder.WriteParameters(p);
Assert.AreEqual(1.ToString(), p.First(z => z.Name == "ppbyp").Value);
Assert.AreEqual(cf.ToString(), p.First(z => z.Name == "ColorFormat").Value);
Assert.AreEqual("13", p.First(z => z.Name == "Width").Value);
Assert.AreEqual("21", p.First(z => z.Name == "Height").Value);
var d2 = new PackedDecoder();
d2.ReadParameters(p);
Assert.AreEqual(4, d2.ColorBPP);
Assert.AreEqual(cf, d2.ColorFormat);
Assert.AreEqual(13, ((IPictureDecoderController)decoder).Width);
Assert.AreEqual(21, ((IPictureDecoderController)decoder).Height);
}
示例2: TestSerialize
public void TestSerialize()
{
{
var cf = new ColorFormat(16, 8, 8, 8, 0, 8, 24, 8);
Assert.AreEqual("S24:8,16:8,8:8,0:8", cf.ToString());
}
{
var cf = new ColorFormat(0, 4, 4, 4, 8, 4, 0, 0);
Assert.AreEqual("S0:0,0:4,4:4,8:4", cf.ToString());
}
{
var cf = new ColorFormat(16, 8, 8, 8, 0, 8, 24, 8);
Assert.AreEqual("S24:8,16:8,8:8,0:8", cf.ToString());
}
{
var cf = new ColorFormat(11, 5, 5, 6, 0, 5, 0, 0);
Assert.AreEqual("S0:0,11:5,5:6,0:5", cf.ToString());
}
{
var cf = new ColorFormat(10, 5, 5, 5, 0, 5, 15, 1);
Assert.AreEqual("S15:1,10:5,5:5,0:5", cf.ToString());
}
}