/////////////////////////////////////////////////////////////////////////// public void Save(BinaryReverseWriter writer) { Debug.WriteLine("Layer Save started at " + writer.BaseStream.Position.ToString()); writer.Write(m_rect.Top); writer.Write(m_rect.Left); writer.Write(m_rect.Bottom); writer.Write(m_rect.Right); //----------------------------------------------------------------------- writer.Write((short)m_channels.Count); foreach (Channel ch in m_channels) { ch.Save(writer); } //----------------------------------------------------------------------- string signature = "8BIM"; writer.Write(signature.ToCharArray()); writer.Write(m_blendModeKey.ToCharArray()); writer.Write(m_opacity); writer.Write((byte)(m_clipping ? 1 : 0)); writer.Write((byte)m_flags.Data); //----------------------------------------------------------------------- writer.Write((byte)0); //----------------------------------------------------------------------- using (new LengthWriter(writer)) { m_maskData.Save(writer); m_blendingRangesData.Save(writer); long namePosition = writer.BaseStream.Position; writer.WritePascalString(m_name); int paddingBytes = (int)((writer.BaseStream.Position - namePosition) % 4); Debug.Print("Layer {0} write padding bytes after name", paddingBytes); for (int i = 0; i < paddingBytes; i++) { writer.Write((byte)0); } foreach (AdjusmentLayerInfo info in m_adjustmentInfo) { info.Save(writer); } } }
////////////////////////////////////////////////////////////////// public void Save(BinaryReverseWriter writer) { StoreData(); if (m_osType == String.Empty) { m_osType = "8BIM"; } writer.Write(m_osType.ToCharArray()); writer.Write(m_id); writer.WritePascalString(m_name); writer.Write((int)m_data.Length); writer.Write(m_data); if (writer.BaseStream.Position % 2 == 1) { writer.Write((byte)0); } }