예제 #1
0
        protected override void WriteData(PsdBinaryWriter writer)
        {
            var startPosition = writer.BaseStream.Position;

            writer.WriteUnicodeString(Name);
            writer.WritePadding(startPosition, 4);
        }
예제 #2
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(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}");
        }