Exemplo n.º 1
0
        public void WritePixels(BinaryPSDWriter writer)
        {
            if (this._isMerged)
            {
                PixelData px = new PixelData(this.Width, this.Height, this.BitsPerPixel, this._channels.Count, this._isMerged);
                List<byte[]> chs = new List<byte[]>();
                foreach (Channel ch in this._channels.Values)
                {
                    if (ch.Usage != -2)
                        chs.Add(ch.Data);
                }
                px.Write(writer, chs, PixelData.Compression.Rle);
                //System.IO.MemoryStream stream = new System.IO.MemoryStream();
                //System.IO.BinaryWriter wr = new System.IO.BinaryWriter(stream);
            }
            else
            {
                foreach (Channel ch in this._channels.Values)
                {
                    if (ch.Usage != -2)
                        ch.WritePixels(writer);
                }
            }

            if (this._mask != null)
                this._mask.WritePixels(writer);
        }
Exemplo n.º 2
0
        protected void PreparePixelsForSave(BinaryPSDWriter writer)
        {
            PixelData px = new PixelData(this.Layer.Width, this.Layer.Height, this.Layer.BitsPerPixel, 1, this._layer.IsMerged);

            px.Write(writer, this._data, PixelData.Compression.Rle);
        }
Exemplo n.º 3
0
        public void ReadPixels(BinaryPSDReader reader)
        {
            int numChannelsToRead = this._channels.Count;
            if (this._channels.ContainsKey(-2))
                numChannelsToRead--;

            PixelData px = new PixelData(this.Width, this.Height, this.BitsPerPixel, numChannelsToRead, this._isMerged);
            px.Read(reader);

            int i = 0;
            foreach (Channel ch in this._channels.Values)
            {
                if (ch.Usage != -2)
                    ch.Data = px.GetChannelData(i++);
                    //ch.ReadPixels(reader);
            }

            if (this._mask != null)
            {
                px = new PixelData(this.Width, this.Height, this.BitsPerPixel, 1, false);
                px.Read(reader);
                this._mask.Data = px.GetChannelData(0);
                //this._mask.ReadPixels(reader);
            }
        }