Exemplo n.º 1
0
        public void Save(BinaryReverseWriter reverseWriter)
        {
            Debug.WriteLine("Layer Save started at " + reverseWriter.BaseStream.Position.ToString(CultureInfo.InvariantCulture));

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

            reverseWriter.Write((Int16)Channels.Count);
            foreach (Channel ch in Channels)
            {
                ch.Save(reverseWriter);
            }

            const String signature = "8BIM";

            reverseWriter.Write(signature.ToCharArray());
            reverseWriter.Write(_blendModeKeyStr.ToCharArray());
            reverseWriter.Write(Opacity);
            reverseWriter.Write((Byte)(Clipping ? 1 : 0));
            reverseWriter.Write((Byte)_flags.Data);
            reverseWriter.Write((Byte)0);

            using (new LengthWriter(reverseWriter))
            {
                MaskData.Save(reverseWriter);
                BlendingRangesData.Save(reverseWriter);

                Int64 namePosition = reverseWriter.BaseStream.Position;

                reverseWriter.WritePascalString(Name);

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

                for (Int32 i = 0; i < paddingBytes; i++)
                {
                    reverseWriter.Write((Byte)0);
                }

                foreach (AdjusmentLayerInfo info in AdjustmentInfo)
                {
                    info.Save(reverseWriter);
                }
            }
        }
Exemplo n.º 2
0
 public void Save(BinaryReverseWriter reverseWriter)
 {
     StoreData();
     if (OSType == string.Empty)
     {
         OSType = "8BIM";
     }
     reverseWriter.Write(OSType.ToCharArray());
     reverseWriter.Write(ID);
     reverseWriter.WritePascalString(Name);
     reverseWriter.Write(Data.Length);
     reverseWriter.Write(Data);
     if (reverseWriter.BaseStream.Position % 2L == 1L)
     {
         reverseWriter.Write(0);
     }
 }
Exemplo n.º 3
0
		public void Save(BinaryReverseWriter reverseWriter)
		{
			StoreData();

			if (OSType == String.Empty) OSType = "8BIM";

			reverseWriter.Write(OSType.ToCharArray());
			reverseWriter.Write(ID);

			reverseWriter.WritePascalString(Name);

			reverseWriter.Write(Data.Length);
			reverseWriter.Write(Data);

			if (reverseWriter.BaseStream.Position % 2 == 1) reverseWriter.Write((Byte)0);
		}
Exemplo n.º 4
0
		public void Save(BinaryReverseWriter reverseWriter)
		{
			Debug.WriteLine("Layer Save started at " + reverseWriter.BaseStream.Position.ToString(CultureInfo.InvariantCulture));

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

			reverseWriter.Write((Int16)Channels.Count);
			foreach (Channel ch in Channels) ch.Save(reverseWriter);

			const String signature = "8BIM";
			reverseWriter.Write(signature.ToCharArray());
			reverseWriter.Write(_blendModeKeyStr.ToCharArray());
			reverseWriter.Write(Opacity);
			reverseWriter.Write((Byte)(Clipping ? 1 : 0));
			reverseWriter.Write((Byte)_flags.Data);
			reverseWriter.Write((Byte)0);

			using (new LengthWriter(reverseWriter))
			{
				MaskData.Save(reverseWriter);
				BlendingRangesData.Save(reverseWriter);

				Int64 namePosition = reverseWriter.BaseStream.Position;

				reverseWriter.WritePascalString(Name);

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

				for (Int32 i = 0; i < paddingBytes; i++) reverseWriter.Write((Byte)0);

				foreach (AdjusmentLayerInfo info in AdjustmentInfo) info.Save(reverseWriter);
			}
		}