Engines/FlatRedBallXNA/FlatRedBall/IO/PngLoader.cs
/// <summary>
/// Reverses the filtering done on a scanline of pixels that have been filtered using Method 2 (Average)
/// </summary>
/// <param name="image">A reference to the byte[] containing the image(decompressed)</param>
/// <param name="pointer">The index of the byte where this scanline begins(after the filter byte)</param>
/// <param name="bps">The number of bits per scanline.</param>
/// <param name="bpp">The number of bytes per pixel</param>
/// <param name="bitDepth">The number of bits per sample</param>
Reverses the filtering done on a scanline of pixels that have been filtered using Method 2 (Average)
Reverses the filtering done on a scanline of pixels that have been filtered using Method 2 ( Average )
private static void ReverseFilterAverage(ref byte[] image, uint pointer, uint bps, float bpp, byte bitDepth)
        {
            byte up;
            byte left = 0;
            bool isFirstScanline = false;
            if (pointer < bps + 1) isFirstScanline = true;
            if (isFirstScanline) up = 0;
            else up = image[pointer - (bps + 1)];
            if (bitDepth >= 8)
            {
                for (uint i = 0; i < bps; ++i)
                {
                    image[i + pointer] += (byte)((up + left) / 2);
                    if ((i + 1) >= bpp) left = image[(int)(i + pointer - bpp + 1)];
                    if (!isFirstScanline)
                        up = image[i + pointer - bps];
                }
            }
        }
private static void ReverseFilterAverage ( ref byte [ ] image , uint pointer , uint bps , float bpp , byte bitDepth ) { byte up ; byte left = 0 ; bool isFirstScanline = false ; if ( pointer < bps + 1 ) isFirstScanline = true ; if ( isFirstScanline ) up = 0 ; else up = image [ pointer - ( bps + 1 ) ] ; if ( bitDepth >= 8 ) { for ( uint i = 0 ; i < bps ; ++ i ) { image [ i + pointer ] += ( byte ) ( ( up + left ) / 2 ) ; if ( ( i + 1 ) >= bpp ) left = image [ ( int ) ( i + pointer - bpp + 1 ) ] ; if ( ! isFirstScanline ) up = image [ i + pointer - bps ] ; } } }
Reverses the filtering done on a scanline of pixels that have been filtered using Method 2 (Average)
Reverses the filtering done on a scanline of pixels that have been filtered using Method 2 ( Average )
byte[]
ref
pointer
uint
The index of the byte where this scanline begins(after the filter byte)
The index of the byte where this scanline begins ( after the filter byte )
bps
uint
The number of bits per scanline.
The number of bits per scanline .
bpp
float
The number of bytes per pixel
The number of bytes per pixel
bitDepth
byte
The number of bits per sample
The number of bits per sample
image
A reference to the byte[] containing the image(decompressed)
A reference to the byte [] containing the image ( decompressed )