Exemple #1
0
 protected override void WriteData(PsdBinaryWriter writer)
 {
     foreach (var channelName in ChannelNames)
     {
         writer.WritePascalString(channelName, 1);
     }
 }
Exemple #2
0
        public void Save(PsdBinaryWriter writer)
        {
            Util.DebugMessage(writer.BaseStream, "Save, Begin, Layer");

            writer.Write(Rect);

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

            writer.Write((Int16)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,
                              globalLayerInfo: false,
                              isLargeDocument: PsdFile.IsLargeDocument);
                }
            }

            Util.DebugMessage(writer.BaseStream, "Save, End, Layer, {0}", Name);
        }
Exemple #3
0
        /// <summary>
        /// Write out the image resource block: header and data.
        /// </summary>
        public void Save(PsdBinaryWriter writer)
        {
            Util.DebugMessage(writer.BaseStream, "Save, Begin, ImageResource");

            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);

            Util.DebugMessage(writer.BaseStream, "Save, End, ImageResource, {0}", ID);
        }