static public void CreateGradientFillLayer(string layer_name, int gradient_type, double angle, PhotoshopTypeLibrary.IActionDescriptor [] opacity_stops, PhotoshopTypeLibrary.IActionDescriptor [] color_stops) { PSX.CheckRange(angle, 0, 360); PSX.CheckEnum(gradient_type, (int)con.phEnumLinear, (int)con.phEnumRadial); string gradient_name = "Custom Gradient"; // List2 var List2 = PSX.MakeNewList(); PSX.AddDescriptorsToList(List2, opacity_stops, (int)con.phClassTransparencyStop); // List1 var List1 = PSX.MakeNewList(); PSX.AddDescriptorsToList(List1, color_stops, (int)con.phClassColorStop); // Desc4 var Desc4 = PSX.MakeNewDescriptor(); Desc4.PutString((int)con.phKeyName, gradient_name); Desc4.PutEnumerated(1198679110, (int)con.phTypeGradientForm, (int)con.phEnumCustomStops); Desc4.PutDouble((int)con.phKeyInterfaceIconFrameDimmed, 4096); Desc4.PutList((int)con.phKeyColors, List1); Desc4.PutList((int)con.phKeyTransparency, List2); // Desc3 var Desc3 = PSX.MakeNewDescriptor(); Desc3.PutUnitDouble((int)con.phKeyAngle, (int)con.phUnitAngle, angle); Desc3.PutEnumerated((int)con.phKeyType, (int)con.phTypeGradientType, gradient_type); Desc3.PutObject((int)con.phKeyGradient, (int)con.phClassGradient, Desc4); // Desc2 var Desc2 = PSX.MakeNewDescriptor(); Desc2.PutString((int)con.phKeyName, layer_name); Desc2.PutObject((int)con.phKeyType, PSX.StrToID("gradientLayer"), Desc3); // Ref1 var Ref1 = PSX.MakeNewReference(); Ref1.PutClass(PSX.StrToID("contentLayer")); // Desc1 var Desc1 = PSX.MakeNewDescriptor(); Desc1.PutReference((int)con.phKeyNull, Ref1); Desc1.PutObject((int)con.phKeyUsing, PSX.StrToID("contentLayer"), Desc2); // Play the event in photoshop PSX.PlayEvent((int)con.phEventMake, Desc1, (int)con.phDialogSilent, PSX.PlayBehavior.checkresult); }