예제 #1
0
        //////////////////////////////////////////////////////////////////
        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);
        }
예제 #2
0
파일: Layer.cs 프로젝트: hgrandry/Mgx
        ///////////////////////////////////////////////////////////////////////////
        public void Save(BinaryReverseWriter writer)
        {
            Debug.WriteLine("Layer Save started at " + writer.BaseStream.Position.ToString());

            writer.Write(Rect.Top);
            writer.Write(Rect.Left);
            writer.Write(Rect.Bottom);
            writer.Write(Rect.Right);

            //-----------------------------------------------------------------------

            writer.Write((short)_channels.Count);
            foreach (Channel ch in _channels)
                ch.Save(writer);

            //-----------------------------------------------------------------------

            const string signature = "8BIM";
            writer.Write(signature.ToCharArray());
            writer.Write(_blendModeKey.ToCharArray());
            writer.Write(Opacity);
            writer.Write((byte)(Clipping ? 1 : 0));

            writer.Write((byte)_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(Name);

                var paddingBytes = (int)((writer.BaseStream.Position - namePosition) % 4);
                Debug.Print("Layer {0} write padding bytes after name", paddingBytes);

                for (var i = 0; i < paddingBytes; i++)
                    writer.Write((byte)0);

                foreach (AdjusmentLayerInfo info in m_adjustmentInfo)
                {
                    info.Save(writer);
                }
            }
        }