本文整理汇总了C#中Gradient.SegmentSetLeftPosition方法的典型用法代码示例。如果您正苦于以下问题:C# Gradient.SegmentSetLeftPosition方法的具体用法?C# Gradient.SegmentSetLeftPosition怎么用?C# Gradient.SegmentSetLeftPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gradient
的用法示例。
在下文中一共展示了Gradient.SegmentSetLeftPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ListParameters
/*
protected override IEnumerable ListParameters()
{
yield return "Type: " + Abbreviations.Get(_type.Value);
yield return ((_dither) ? "With" : "Without") + " Dither";
yield return ((_useMask) ? "With" : "Without") + " Use Mask";
}
*/
public static Gradient CreateGradient(string name, ListParameter colors)
{
Gradient gradient = new Gradient("Photoshop." + name);
gradient.SegmentRangeSplitUniform(0, -1, colors.Count);
int segment = 0;
foreach (ObjcParameter parameter in colors)
{
RGB color;
string type = parameter.GetValueAsString("Type");
switch (type)
{
case "BckC":
color = Context.Background;
break;
case "FrgC":
color = Context.Foreground;
break;
case "UsrS":
color = parameter.GetValueAsColor("Clr");
break;
default:
Console.WriteLine("Gradient-1: " + type);
color = new RGB(0, 0, 0);
break;
}
long location = parameter.GetValueAsLong("Lctn");
long midpoint = parameter.GetValueAsLong("Mdpn");
Console.WriteLine("type: {0}, location: {1}, midpoint: {2}",
type, location, midpoint);
gradient.SegmentSetLeftPosition(segment, location / 4096.0);
gradient.SegmentSetLeftColor(segment, color, 100);
if (segment > 0)
{
gradient.SegmentSetRightColor(segment - 1, color, 100);
}
segment++;
}
return gradient;
}