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);
        }
Exemple #2
0
        public static void GaussianBlur(double radius)
        {
            PSX.CheckRange(radius, 0, 250);

            // Desc1
            var Desc1 = PSX.MakeNewDescriptor();

            Desc1.PutUnitDouble((int)con.phKeyRadius, (int)con.phUnitPixels, radius);

            // Play the event in photoshop
            PSX.PlayEvent((int)con.phEventGaussianBlur, Desc1, (int)con.phDialogSilent, PSX.PlayBehavior.checkresult);
        }
Exemple #3
0
        public static void AddNoise(int distortion, double amount, int monochromatic)
        {
            PSX.CheckEnum(distortion, (int)con.phEnumUniformDistribution, (int)con.phEnumGaussianDistribution);
            PSX.CheckRange(amount, 0, 400);
            PSX.CheckEnum(monochromatic, PSX.TRUE, PSX.FALSE);
            // Desc1
            var Desc1 = PSX.MakeNewDescriptor();

            Desc1.PutEnumerated((int)con.phKeyDistortion, (int)con.phTypeDistribution, distortion);
            Desc1.PutUnitDouble((int)con.phKeyNoise, (int)con.phUnitPercent, amount);
            Desc1.PutBoolean((int)con.phKeyMonochromatic, monochromatic);

            // Play the event in photoshop
            PSX.PlayEvent((int)con.phEventAddNoise, Desc1, (int)con.phDialogSilent, PSX.PlayBehavior.checkresult);
        }
Exemple #4
0
        public static void UnsharpMask(double amount, double radius, int threshold)
        {
            PSX.CheckRange(amount, 0, 400);
            PSX.CheckRange(radius, 0, 250);
            PSX.CheckRange(threshold, 0, 255);

            // Desc1
            var Desc1 = PSX.MakeNewDescriptor();

            Desc1.PutUnitDouble((int)con.phKeyAmount, (int)con.phUnitPercent, amount);
            Desc1.PutUnitDouble((int)con.phKeyRadius, (int)con.phUnitPixels, radius);
            Desc1.PutInteger((int)con.phKeyThreshold, threshold);

            // Play the event in photoshop
            PSX.PlayEvent((int)con.phEventUnsharpMask, Desc1, (int)con.phDialogSilent, PSX.PlayBehavior.checkresult);
        }
        public static void SaveCopyAsJPEG(string filename, int quality)
        {
            // WORKITEM support matte color

            _start_save(filename);

            PSX.CheckRange(quality, 0, 12);

            // Desc2
            var Desc2 = PSX.MakeNewDescriptor();

            Desc2.PutInteger((int)con.phKeyExtendedQuality, quality);

            // Desc1
            var Desc1 = PSX.MakeNewDescriptor();

            Desc1.PutObject((int)con.phKeyAs, (int)con.phClassJPEGFormat, Desc2);
            // WORKITEM what if they only provided a path
            Desc1.PutPath((int)con.phKeyIn, filename);
            Desc1.PutBoolean((int)con.phKeyCopy, PSX.TRUE);

            _end_save(filename, Desc1);
        }