Beispiel #1
0
        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}");
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
        }