Ejemplo n.º 1
0
        public void ReadData(PsdReader reader, int bps, CompressionType compressionType, int[] rlePackLengths)
        {
            int length = PsdUtility.DepthToPitch(bps, this.width);

            this.data = new byte[length * this.height];
            switch (compressionType)
            {
            case CompressionType.Raw:
                reader.Read(this.data, 0, this.data.Length);
                break;

            case CompressionType.RLE:
                for (int i = 0; i < this.height; i++)
                {
                    byte[] buffer = new byte[rlePackLengths[i]];
                    byte[] dst    = new byte[length];
                    reader.Read(buffer, 0, rlePackLengths[i]);
                    DecodeRLE(buffer, dst, rlePackLengths[i], length);
                    for (int j = 0; j < length; j++)
                    {
                        this.data[(i * length) + j] = (byte)(dst[j] * this.opacity);
                    }
                }
                break;
            }
        }
Ejemplo n.º 2
0
        private void ReadData(PsdReader reader, Int32 bps, CompressionType compressionType, Int32[] rlePackLengths)
        {
            Int32 length = PsdUtility.DepthToPitch(bps, this.width);

            this.data = new Byte[length * this.height];
            switch (compressionType)
            {
            case CompressionType.Raw:
                reader.Read(this.data, 0, this.data.Length);
                break;

            case CompressionType.RLE:
                for (Int32 i = 0; i < this.height; i++)
                {
                    Byte[] buffer = new Byte[rlePackLengths[i]];
                    Byte[] dst    = new Byte[length];
                    reader.Read(buffer, 0, rlePackLengths[i]);
                    DecodeRLE(buffer, dst, rlePackLengths[i], length);
                    for (Int32 j = 0; j < length; j++)
                    {
                        this.data[(i * length) + j] = (Byte)(dst[j] * this.opacity);
                    }
                }
                break;
            }
        }
Ejemplo n.º 3
0
 public BlendMode ReadBlendMode()
 {
     return(PsdUtility.ToBlendMode(this.ReadAscii(4)));
 }