public override void WriteData(PsdBinaryWriter writer) { writer.WriteAsciiChars(Key); writer.WriteUnicodeString(NameFromClassID); writer.Write(ClassID.Length == 4 ? 0 : ClassID.Length); writer.WriteAsciiChars(ClassID); }
public void Save(PsdBinaryWriter writer, bool globalLayerInfo, bool isLargeDocument) { Util.DebugMessage(writer.BaseStream, $"Save, Begin, LayerInfo, {Signature}, {Key}"); writer.WriteAsciiChars(Signature); writer.WriteAsciiChars(Key); var startPosition = writer.BaseStream.Position; using (var lengthWriter = new PsdBlockLengthWriter(writer, LayerInfoUtil.HasLongLength(Signature, Key, isLargeDocument))) { // Depending on the key, the length may be unpadded, 2-padded, or // 4-padded. Thus, it is up to each implementation of WriteData to // pad the length correctly. WriteData(writer); } // Data for global layer info is always padded to a multiple of 4, // even if this causes the stated length to be incorrect. if (globalLayerInfo) { writer.WritePadding(startPosition, 4); } Util.DebugMessage(writer.BaseStream, $"Save, End, LayerInfo, {Signature}, {Key}"); }
public override void WriteData(PsdBinaryWriter writer) { if (!string.IsNullOrEmpty(Key)) { writer.WriteAsciiChars(Key); } writer.WriteUnicodeString(ClassIDName); if (ClassID.Length != 4) { writer.Write(ClassID.Length); } else { writer.Write(0); } writer.WriteAsciiChars(ClassID); writer.Write(Descriptor.Count); foreach (var pair in Descriptor) { writer.Write(pair.Key.Length == 4 ? 0 : pair.Key.Length); writer.WriteAsciiChars(pair.Key); pair.Value.WriteData(writer); } }
public override void WriteData(PsdBinaryWriter writer) { writer.WriteAsciiChars(Key); writer.Write(Type.Length == 4 ? 0 : Type.Length); writer.WriteAsciiChars(Type); writer.Write(Enum.Length == 4 ? 0 : Enum.Length); writer.WriteAsciiChars(Enum); }
protected override void WriteData(PsdBinaryWriter writer) { writer.Write((Int32)SectionType); if (BlendModeKey != null) { writer.WriteAsciiChars("8BIM"); writer.WriteAsciiChars(BlendModeKey); if (subtype != null) { writer.Write((Int32)Subtype); } } }
public void Save(PsdBinaryWriter writer) { Debug.WriteLine("Layer Save started at " + writer.BaseStream.Position.ToString(CultureInfo.InvariantCulture)); writer.Write(Rect); //----------------------------------------------------------------------- writer.Write((short)Channels.Count); foreach (var ch in Channels) { ch.Save(writer); } //----------------------------------------------------------------------- writer.WriteAsciiChars("8BIM"); writer.WriteAsciiChars(BlendModeKey); writer.Write(Opacity); writer.Write(Clipping); writer.Write((byte)flags.Data); //----------------------------------------------------------------------- writer.Write((byte)0); //----------------------------------------------------------------------- using (new PsdBlockLengthWriter(writer)) { Masks.Save(writer); BlendingRangesData.Save(writer); var namePosition = writer.BaseStream.Position; // Legacy layer name is limited to 31 bytes. Unicode layer name // can be much longer. writer.WritePascalString(Name, 4, 31); foreach (LayerInfo info in AdditionalInfo) { info.Save(writer); } } }
public override void WriteData(PsdBinaryWriter writer) { writer.WriteAsciiChars(Key); writer.Write(References.Length); for (int i = 0; i < References.Length; ++i) { References [i].WriteData(writer); } }
public override void WriteData(PsdBinaryWriter writer) { writer.WriteAsciiChars(Key); writer.Write(List.Length); for (int i = 0; i < List.Length; ++i) { List [i].WriteData(writer); } }
public void Save(PsdBinaryWriter writer) { Debug.WriteLine("LayerInfo.Save started at " + writer.BaseStream.Position); writer.WriteAsciiChars("8BIM"); writer.WriteAsciiChars(Key); var startPosition = writer.BaseStream.Position; using (var lengthWriter = new PsdBlockLengthWriter(writer)) { // Depending on the key, the length may be unpadded, 2-padded, or // 4-padded. Thus, it is up to each implementation of WriteData to // pad the length correctly. WriteData(writer); } // Regardless of how the length is padded, the data is always padded to // a multiple of 4. writer.WritePadding(startPosition, 4); }
public void Save(PsdBinaryWriter writer) { Debug.WriteLine("LayerInfo.Save started at " + writer.BaseStream.Position); writer.WriteAsciiChars("8BIM"); writer.WriteAsciiChars(Key); var startPosition = writer.BaseStream.Position; using (var lengthWriter = new PsdBlockLengthWriter(writer)) { // Depending on the key, the length may be unpadded, 2-padded, or // 4-padded. Thus, it is up to each implementation of WriteData to // pad the length correctly. WriteData(writer); } // Regardless of how the length is padded, the data is always padded to // a multiple of 4. writer.WritePadding(startPosition, 4); }
/////////////////////////////////////////////////////////////////////////// private void SaveHeader(PsdBinaryWriter writer) { string signature = "8BPS"; writer.WriteAsciiChars(signature); writer.Write(Version); writer.Write(new byte[] { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, }); writer.Write(ChannelCount); writer.Write(RowCount); writer.Write(ColumnCount); writer.Write((Int16)BitDepth); writer.Write((Int16)ColorMode); }
/////////////////////////////////////////////////////////////////////////// private void SaveHeader(PsdBinaryWriter writer) { Debug.WriteLine("SaveHeader started at " + writer.BaseStream.Position.ToString(CultureInfo.InvariantCulture)); string signature = "8BPS"; writer.WriteAsciiChars(signature); writer.Write(Version); writer.Write(new byte[] { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, }); writer.Write(ChannelCount); writer.Write(RowCount); writer.Write(ColumnCount); writer.Write((Int16)BitDepth); writer.Write((Int16)ColorMode); }
/// <summary> /// Write out the image resource block: header and data. /// </summary> public void Save(PsdBinaryWriter writer) { writer.WriteAsciiChars(Signature); writer.Write((UInt16)ID); writer.WritePascalString(Name, 2); // Length is unpadded, but data is even-padded var startPosition = writer.BaseStream.Position; using (new PsdBlockLengthWriter(writer)) { WriteData(writer); } writer.WritePadding(startPosition, 2); }
public override void WriteData(PsdBinaryWriter writer) { writer.WriteAsciiChars(Key); writer.Write(Value); }
public override void WriteData(PsdBinaryWriter writer) { writer.WriteAsciiChars(Key); writer.Write(Data.Length); writer.Write(Data); }
public void Save(PsdBinaryWriter writer) { writer.Write(Rect); //----------------------------------------------------------------------- writer.Write((short)Channels.Count); foreach (var ch in Channels) ch.Save(writer); //----------------------------------------------------------------------- writer.WriteAsciiChars("8BIM"); writer.WriteAsciiChars(BlendModeKey); writer.Write(Opacity); writer.Write(Clipping); writer.Write((byte)flags.Data); //----------------------------------------------------------------------- writer.Write((byte)0); //----------------------------------------------------------------------- using (new PsdBlockLengthWriter(writer)) { Masks.Save(writer); BlendingRangesData.Save(writer); var namePosition = writer.BaseStream.Position; // Legacy layer name is limited to 31 bytes. Unicode layer name // can be much longer. writer.WritePascalString(Name, 4, 31); foreach (LayerInfo info in AdditionalInfo) { info.Save(writer); } } }
/////////////////////////////////////////////////////////////////////////// private void SaveHeader(PsdBinaryWriter writer) { string signature = "8BPS"; writer.WriteAsciiChars(signature); writer.Write(Version); writer.Write(new byte[] { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, }); writer.Write(ChannelCount); writer.Write(RowCount); writer.Write(ColumnCount); writer.Write((Int16)BitDepth); writer.Write((Int16)ColorMode); }
protected override void WriteData(PsdBinaryWriter writer) { writer.Write((Int32)SectionType); if (BlendModeKey != null) { writer.WriteAsciiChars("8BIM"); writer.WriteAsciiChars(BlendModeKey); if (subtype != null) writer.Write((Int32)Subtype); } }
/////////////////////////////////////////////////////////////////////////// private void SaveHeader(PsdBinaryWriter writer) { Debug.WriteLine("SaveHeader started at " + writer.BaseStream.Position.ToString(CultureInfo.InvariantCulture)); string signature = "8BPS"; writer.WriteAsciiChars(signature); writer.Write(Version); writer.Write(new byte[] { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, }); writer.Write(ChannelCount); writer.Write(RowCount); writer.Write(ColumnCount); writer.Write((Int16)BitDepth); writer.Write((Int16)ColorMode); }
public override void WriteData(PsdBinaryWriter writer) { writer.WriteAsciiChars(Key); writer.WriteUnicodeString(Text); }