예제 #1
0
 /// <summary>
 /// The raise on pixel.
 /// </summary>
 /// <param name="args">
 /// The args.
 /// </param>
 protected void RaiseOnPixel(OnPixelArgs args)
 {
     if (this.OnPixel != null)
     {
         this.OnPixel(this, args);
     }
 }
예제 #2
0
        /// <summary>
        /// Read and decode data block.
        /// </summary>
        /// <param name="stream">
        /// The source stream.
        /// </param>
        public void ReadData(Stream stream)
        {
            // Read palette first.
            int  dataLen = this.pitch * this.height;
            long pos     = stream.Position;

            stream.Position += dataLen;
            this.ReadPaletteARGB1555(stream, 256);
            long end = stream.Position;

            stream.Position = pos;

            // Decode pixels.
            var onPixelArgs = new OnPixelArgs();

            for (int y = 0; y < this.height; ++y)
            {
                for (int x = 0; x < this.width; ++x)
                {
                    var index = stream.ReadByte();

                    onPixelArgs.X     = x;
                    onPixelArgs.Y     = y;
                    onPixelArgs.Color = this.palette[index];
                    this.RaiseOnPixel(onPixelArgs);
                }
            }

            // Set position after palette.
            stream.Position = end;
        }
예제 #3
0
        /// <summary>
        /// Read and decode data block.
        /// </summary>
        /// <param name="stream">
        /// The source stream.
        /// </param>
        public void ReadData(Stream stream)
        {
            // Read palette first.
            int dataLen = this.pitch * this.height;
            long pos = stream.Position;
            stream.Position += dataLen;
            this.ReadPaletteARGB1555(stream, 256);
            long end = stream.Position;
            stream.Position = pos;

            // Decode pixels.
            var onPixelArgs = new OnPixelArgs();
            for (int y = 0; y < this.height; ++y)
            {
                for (int x = 0; x < this.width; ++x)
                {
                    var index = stream.ReadByte();

                    onPixelArgs.X = x;
                    onPixelArgs.Y = y;
                    onPixelArgs.Color = this.palette[index];
                    this.RaiseOnPixel(onPixelArgs);
                }
            }

            // Set position after palette.
            stream.Position = end;
        }
예제 #4
0
 /// <summary>
 /// The raise on pixel.
 /// </summary>
 /// <param name="args">
 /// The args.
 /// </param>
 protected void RaiseOnPixel(OnPixelArgs args)
 {
     if (this.OnPixel != null)
     {
         this.OnPixel(this, args);
     }
 }