Exemple #1
0
 static private void UpdateSolidFillColor(Color color)
 {
     Photoshop.ActionDescriptor descriptor = new Photoshop.ActionDescriptor();
     Photoshop.ActionReference  reference  = new Photoshop.ActionReference();
     reference.PutEnumerated(PhotoshopApplication.StringIDToTypeID("contentLayer"), PhotoshopApplication.CharIDToTypeID("Ordn"), PhotoshopApplication.CharIDToTypeID("Trgt"));
     descriptor.PutReference(PhotoshopApplication.CharIDToTypeID("null"), reference);
     Photoshop.ActionDescriptor fillDescriptor  = new Photoshop.ActionDescriptor();
     Photoshop.ActionDescriptor colorDescriptor = new Photoshop.ActionDescriptor();
     colorDescriptor.PutDouble(PhotoshopApplication.CharIDToTypeID("Rd  "), color.R);
     colorDescriptor.PutDouble(PhotoshopApplication.CharIDToTypeID("Grn "), color.G);
     colorDescriptor.PutDouble(PhotoshopApplication.CharIDToTypeID("Bl  "), color.B);
     fillDescriptor.PutObject(PhotoshopApplication.CharIDToTypeID("Clr "), PhotoshopApplication.CharIDToTypeID("RGBC"), colorDescriptor);
     descriptor.PutObject(PhotoshopApplication.CharIDToTypeID("T   "), PhotoshopApplication.StringIDToTypeID("solidColorLayer"), fillDescriptor);
     PhotoshopApplication.ExecuteAction(PhotoshopApplication.CharIDToTypeID("setd"), descriptor);
 }
Exemple #2
0
        /// <summary>
        /// Changes the layer colour.
        /// </summary>
        /// <param name="__col">Color</param>
        private void ChangeLayerColour(Colors __col)
        {
            string __colour;
            Photoshop.ActionDescriptor __desc;
            Photoshop.ActionReference __ref;
            Photoshop.ActionDescriptor __desc2;

            switch (__col)
            {
                case Colors.RED:
                    __colour = "Rd  ";
                    break;
                case Colors.ORANGE:
                    __colour = "Orng";
                    break;
                case Colors.YELLOW:
                    __colour = "Ylw ";
                    break;
                case Colors.GREEN:
                    __colour = "Grn ";
                    break;
                case Colors.BLUE:
                    __colour = "Bl  ";
                    break;
                case Colors.VIOLET:
                    __colour = "Vlt ";
                    break;
                case Colors.GRAY:
                    __colour = "Gry ";
                    break;
                case Colors.NONE:
                    __colour = "None";
                    break;
                default:
                    __colour = "None";
                    break;
            }

            __desc = new Photoshop.ActionDescriptor();
            __ref = new Photoshop.ActionReference();
            __ref.PutEnumerated(__appRef.CharIDToTypeID("Lyr "), __appRef.CharIDToTypeID("Ordn"), __appRef.CharIDToTypeID("Trgt"));
            __desc.PutReference(__appRef.CharIDToTypeID("null"), __ref);

            __desc2 = new Photoshop.ActionDescriptor();
            __desc2.PutEnumerated(__appRef.CharIDToTypeID("Clr "), __appRef.CharIDToTypeID("Clr "), __appRef.CharIDToTypeID(__colour));
            __desc.PutObject(__appRef.CharIDToTypeID("T   "), __appRef.CharIDToTypeID("Lyr "), __desc2);
            __appRef.ExecuteAction(__appRef.CharIDToTypeID("setd"), __desc, Photoshop.PsDialogModes.psDisplayNoDialogs);
        }