示例#1
0
 public Effect(Effect effect)
 {
     this.Name = effect.Name;
     this.Version = effect.Version;
     this.Size = effect.Size;
     this.loadedData = effect.loadedData;
 }
示例#2
0
        public Shadow(Effect effect)
            : base(effect)
        {
            BinaryReverseReader reader = base.GetDataReader();

            this.Blur = reader.ReadUInt32();
            this.Angle = reader.ReadUInt32();
            this.Distance = reader.ReadUInt32();

            this.Color = this.ReadColor(reader);

            this.BlendModeSignature = reader.ReadUInt32();
            this.BlendModeKey = reader.ReadUInt32();
            this.Enabled = reader.ReadBoolean();
            this.UseGlobalAngle = reader.ReadBoolean();
            this.Opacity = reader.ReadByte();

            reader.Close();
        }
示例#3
0
        public Glow(Effect effect)
            : base(effect)
        {
            BinaryReverseReader reader = base.GetDataReader();

            uint version = reader.ReadUInt32(); //two version specifications?!?

            this.Blur = reader.ReadUInt32();
            this.Intensity = reader.ReadUInt32();
            this.Color = this.ReadColorWithAlpha(reader);

            this.BlendModeSignature = reader.ReadUInt32();
            this.BlendModeKey = reader.ReadUInt32();
            this.Enabled = reader.ReadBoolean();
            this.UseGlobalAngle = reader.ReadBoolean();
            this.Opacity = reader.ReadByte();

            reader.Close();
        }
示例#4
0
        public Bevel(Effect effect)
            : base(effect)
        {
            BinaryReverseReader reader = base.GetDataReader();

            this.Angle = reader.ReadUInt32();
            this.Strength = reader.ReadUInt32();
            this.Blur = reader.ReadUInt32();

            this.BlendModeSignature = reader.ReadUInt32();
            this.BlendModeKey = reader.ReadUInt32();

            this.ShadowBlendModeSignature = reader.ReadUInt32();
            this.ShadowBlendModeKey = reader.ReadUInt32();

            this.Color = this.ReadColorWithAlpha(reader);
            this.ShadowColor = this.ReadColorWithAlpha(reader);

            this.Enabled = reader.ReadBoolean();
            this.UseGlobalAngle = reader.ReadBoolean();
            this.Inverted = reader.ReadBoolean();

            reader.Close();
        }
示例#5
0
        private void ReadPSDChannelTag(BinaryReverseReader reader)
        {
            string sHeader = new string(reader.ReadChars(4));

            if (sHeader != "8BIM")
            {
                reader.BaseStream.Position -= 4;               //back it up before throwing exception
                throw(new Exception("Effect header incorrect"));
            }

            string sKey      = new string(reader.ReadChars(4));
            uint   nLength   = reader.ReadUInt32();
            long   nPosStart = reader.BaseStream.Position;

            switch (sKey)
            {
            case "lyid":
                this.LayerID = (int)reader.ReadUInt32();
                break;

            case "fxrp":
                this.ReferencePoint   = new EPointF();
                this.ReferencePoint.X = reader.ReadPSD8BitSingle();
                this.ReferencePoint.Y = reader.ReadPSD8BitSingle();
                break;

            case "clbl":
                //blend clipping
                this.BlendClipping          = reader.ReadBoolean();
                reader.BaseStream.Position += 3;                       //padding
                break;

            case "infx":
                //blend interior elements
                this.Blend = reader.ReadBoolean();
                reader.BaseStream.Position += 3;                       //padding
                break;

            case "knko":
                //Knockout setting
                this.Knockout = reader.ReadBoolean();
                reader.BaseStream.Position += 3;                       //padding
                break;

            case "lspf":
                //Protected settings
                //TODO:
                reader.ReadBytes(4);                         //nLength?
                //bits 0-2 = Transparency, composite and position
                break;

            case "lclr":
                //Sheet Color setting
                this.SheetColor = System.Drawing.Color.FromArgb(
                    reader.ReadByte(),
                    reader.ReadByte(),
                    reader.ReadByte(),
                    reader.ReadByte());
                reader.BaseStream.Position += 2;                       //padding
                break;

            case "lnsr":
                //Layer Name Source setting
                string sWhatIsThis = new string(reader.ReadChars((int)nLength));
                //this.NameSourceSetting = reader.ReadUInt32();
                break;

            case "luni":
                //Unicode Layer name
                uint nUnicodeLength = reader.ReadUInt32();
                this.UnicodeName = new string(reader.ReadChars((int)nUnicodeLength * 2));
                break;

            case "lrFX":
                //Effects Layer info
                reader.BaseStream.Position += 2;                       //unused
                ushort nNumEffects = reader.ReadUInt16();
                //      aEffectsInfo = []
                //      paInfo[#EffectsInfo] = aEffectsInfo
                for (int nEffectNum = 0; nEffectNum < nNumEffects; nEffectNum++)
                {
                    sHeader = new string(reader.ReadChars(4));
                    if (sHeader != "8BIM")
                    {
                        throw(new Exception("Effect header incorrect"));
                    }

                    EffectLayers.Effect effectForReading = new Endogine.Serialization.Photoshop.EffectLayers.Effect(reader);
                    //reader.JumpToEvenNthByte(2);
                    EffectLayers.Effect effect = null;
                    //long nEffectEndPos = reader.BaseStream.Position + effect.Size;
                    switch (effectForReading.Name)
                    {
                    case "cmnS":                                     //common state
                        BinaryReverseReader subreader = effectForReading.GetDataReader();
                        bool bVisible = subreader.ReadBoolean();
                        //reader.BaseStream.Position+=2; //unused
                        break;

                    case "dsdw":
                    case "isdw":
                        //drop/inner shadow
                        if (effectForReading.Version == 0)
                        {
                            effect = new Endogine.Serialization.Photoshop.EffectLayers.Shadow(effectForReading);
                        }
                        else
                        {
                            //TODO:
                        }
                        break;

                    case "oglw":
                    case "iglw":
                        //outer/inner glow
                        if (effectForReading.Version == 0)
                        {
                            effect = new Endogine.Serialization.Photoshop.EffectLayers.Glow(effectForReading);
                        }
                        else
                        {
                            //TODO:
                        }

                        break;

                    case "bevl":                                     //bevel
                        if (effectForReading.Version == 0)
                        {
                            effect = new Endogine.Serialization.Photoshop.EffectLayers.Bevel(effectForReading);
                        }
                        else
                        {
                            //TODO:
                        }
                        break;

                    case "sofi":                                     //unknown
                        break;
                    }
                    this.Effects.Add(effect);
                    //reader.BaseStream.Position = nEffectEndPos;
                }
                break;

            case "lsct":
                //TODO: what is this?
                reader.BaseStream.Position += 4;
                break;

            case "TySh":
            case "lfx2":
                //TODO: what are these?
                break;

            default:
                string sMsg = "Unknown layer setting: " + sKey + " Length:" + nLength.ToString() + " Pos: " + reader.BaseStream.Position.ToString();
                //EH.Put(sMsg);
                break;
            }
            //add to nLength so it's padded to 4
            int nLengthMod = (int)(nLength % (long)4);

            if (nLengthMod > 0)
            {
                nLength += 4 - (uint)nLengthMod;
            }

            reader.BaseStream.Position = nPosStart + nLength;
            reader.JumpToEvenNthByte(2);
        }