public Shadow(PhotoshopFile.Layer.AdjustmentLayerInfo info) { this.m_data = info.Data; this.m_key = info.Key; this.m_layer = info.Layer; BinaryReverseReader r = this.DataReader; //string blendModeSignature = null; int version = r.ReadInt32(); switch (version) { case 0: this.Blur = r.ReadUInt32(); this.Intensity = r.ReadUInt32(); this.Angle = r.ReadUInt32(); this.Distance = r.ReadUInt32(); this.Color = r.ReadPSDColor(16, true); this.BlendModeKey = this.ReadBlendKey(r); //this.BlendModeSignature = r.ReadUInt32(); //this.BlendModeKey = r.ReadUInt32(); this.Enabled = r.ReadBoolean(); this.UseGlobalAngle = r.ReadBoolean(); this.Opacity = r.ReadByte(); break; case 2: this.Blur = (uint)r.ReadUInt16(); this.Intensity = r.ReadUInt32(); this.Angle = r.ReadUInt32(); this.Distance = r.ReadUInt32(); ushort something = r.ReadUInt16(); //TODO:? this.Color = r.ReadPSDColor(16, true); this.BlendModeKey = this.ReadBlendKey(r); this.Enabled = r.ReadBoolean(); this.UseGlobalAngle = r.ReadBoolean(); this.Opacity = r.ReadByte(); //TODO: 10 unknown bytes! break; } this.Data = null; }
public Bevel(PhotoshopFile.Layer.AdjustmentLayerInfo info) { this.m_data = info.Data; this.m_key = info.Key; this.m_layer = info.Layer; BinaryReverseReader r = this.DataReader; //string blendModeSignature = null; uint version = r.ReadUInt32(); switch (version) { case 0: this.Blur = r.ReadUInt32(); this.Data = null; break; case 2: this.Angle = (uint)r.ReadUInt16(); this.Strength = (uint)r.ReadUInt16(); this.Blur = (uint)r.ReadUInt16(); this.Unknown1 = r.ReadByte(); this.Unknown2 = r.ReadByte(); this.Unknown3 = r.ReadUInt16(); this.Unknown4 = r.ReadUInt16(); this.BlendModeKey = this.ReadBlendKey(r); this.ShadowBlendModeKey = this.ReadBlendKey(r); this.Color = r.ReadPSDColor(16, true); this.ShadowColor = r.ReadPSDColor(16, true); this.BevelStyle = r.ReadByte(); this.Opacity = r.ReadByte(); this.ShadowOpacity = r.ReadByte(); this.Enabled = r.ReadBoolean(); this.UseGlobalAngle = r.ReadBoolean(); this.Inverted = r.ReadBoolean(); System.Drawing.Color someColor = r.ReadPSDColor(16, true); System.Drawing.Color someColor2 = r.ReadPSDColor(16, true); break; } this.Data = null; }
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(); }
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(); }
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(); }
public Glow(PhotoshopFile.Layer.AdjustmentLayerInfo info) { this.m_data = info.Data; this.m_key = info.Key; this.m_layer = info.Layer; BinaryReverseReader r = this.DataReader; //string blendModeSignature = null; uint version = r.ReadUInt32(); //two version specifications?!? switch (version) { case 0: this.Blur = r.ReadUInt32(); this.Data = null; break; case 2: this.Blur = (uint)r.ReadUInt16(); this.Intensity = r.ReadUInt32(); ushort something = r.ReadUInt16(); this.Color = r.ReadPSDColor(16, false); //Inner color (no alpha) this.BlendModeKey = this.ReadBlendKey(r); this.Enabled = r.ReadBoolean(); this.Opacity = r.ReadByte(); //TODO! if (this.Inner) { this.Unknown = r.ReadByte(); } this.UnknownColor = r.ReadPSDColor(16, false); //unknown color(no alpha) this.Data = r.ReadBytes((int)r.BytesToEnd); break; } }
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); }
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); }
public PsdBoolean(BinaryReverseReader stream) { value = stream.ReadBoolean(); }