コード例 #1
0
 static private void GetSolidFillColor()
 {
     Photoshop.ActionReference reference = new Photoshop.ActionReference();
     reference.PutEnumerated(PhotoshopApplication.StringIDToTypeID("contentLayer"), PhotoshopApplication.CharIDToTypeID("Ordn"), PhotoshopApplication.CharIDToTypeID("Trgt"));
     Photoshop.ActionDescriptor descriptor      = PhotoshopApplication.ExecuteActionGet(reference);
     Photoshop.ActionList       actionList      = descriptor.GetList(PhotoshopApplication.CharIDToTypeID("Adjs"));
     Photoshop.ActionDescriptor solidColorLayer = actionList.GetObjectValue(0);
     Photoshop.ActionDescriptor color           = solidColorLayer.GetObjectValue(PhotoshopApplication.CharIDToTypeID("Clr "));
     double red   = color.GetDouble(PhotoshopApplication.CharIDToTypeID("Rd  "));
     double green = color.GetDouble(PhotoshopApplication.CharIDToTypeID("Grn "));
     double blue  = color.GetDouble(PhotoshopApplication.CharIDToTypeID("Bl  "));
 }
コード例 #2
0
ファイル: Action.cs プロジェクト: solarbluseth/thecodingfrog
        private void listFonts(Photoshop.Document __docRef, string __filename, bool __messageWhenDone)
        {
            //MessageBox.Show(__filename);

            Photoshop.ActionReference __ref = new Photoshop.ActionReference();
            Photoshop.ActionDescriptor __desc = new Photoshop.ActionDescriptor();
            Regex __RegexObj = new Regex("^</Layer group");
            List<string> __fonts = new List<string>();

            __ref.PutEnumerated(__appRef.CharIDToTypeID("Dcmn"), __appRef.CharIDToTypeID("Ordn"), __appRef.CharIDToTypeID("Trgt") );
            int __count = __appRef.ExecuteActionGet(__ref).GetInteger(__appRef.CharIDToTypeID("NmbL")) + 1;
            //MessageBox.Show(__count.ToString());
            for(int i = 1; i < __count; i++)
            {
                __ref = new Photoshop.ActionReference();
                __ref.PutIndex( __appRef.CharIDToTypeID("Lyr "), i);
                __desc = __appRef.ExecuteActionGet(__ref);
                string __layerName = __desc.GetString(__appRef.CharIDToTypeID("Nm  "));
                string __layerType = __appRef.TypeIDToStringID(__desc.GetEnumerationValue( __appRef.StringIDToTypeID("layerSection")));

                if (__RegexObj.IsMatch(__layerName))
                    continue;

                if( __desc.HasKey(__appRef.StringIDToTypeID("textKey")))
                {
                    Photoshop.ActionDescriptor __list = __desc.GetObjectValue(__appRef.CharIDToTypeID("Txt "));
                    Photoshop.ActionList __tsr = __list.GetList(__appRef.CharIDToTypeID("Txtt"));
                    //MessageBox.Show(__tsr.Count.ToString());
                    for(var j = 0; j < __tsr.Count; j++)
                    {
                        //MessageBox.Show("ok");
                        Photoshop.ActionDescriptor __tsr0 = __tsr.GetObjectValue(j);
                        Photoshop.ActionDescriptor __textStyle = __tsr0.GetObjectValue(__appRef.CharIDToTypeID("TxtS"));
                        string __font = __textStyle.GetString(__appRef.CharIDToTypeID("FntN"));
                        string __style = __textStyle.GetString(__appRef.CharIDToTypeID("FntS"));
                        //MessageBox.Show(__font + "-" + __style);
                        if (!__fonts.Contains(__font + "-" + __style))
                            __fonts.Add(__font + "-" + __style);
                    }
                }
            }
            //MessageBox.Show(__fonts.Count.ToString());
            addFont(__docRef, __fonts, __filename, __messageWhenDone);
        }