Engines/FlatRedBallXNA/FlatRedBall/IO/PngLoader.cs
/// <summary>
/// Uses the ColorType and Bitdepth of this image to calculate the number of bytes per pixel.
/// </summary>
/// <param name="header">The HeaderInfo containing IHDR data for this image</param>
/// <returns>The number of BytesPerPixel in this image.</returns>
Uses the ColorType and Bitdepth of this image to calculate the number of bytes per pixel.
Uses the ColorType and Bitdepth of this image to calculate the number of bytes per pixel .
private static float GetBytesPerPixel(HeaderInfo header)
        {
            switch ((int)(header.ColorType))
            {
                case 0: return ((float)(header.BitDepth)/ 8); 
                case 2: return (3 * (float)(header.BitDepth )/ 8); 
                case 3: return (float)(header.BitDepth) / 8; 
                case 4: return (2 * (float)(header.BitDepth) / 8); 
                case 6: return (4 * ((float)(header.BitDepth) / 8)); 
                default: return -1;
            }
        }
private static float GetBytesPerPixel ( HeaderInfo header ) { switch ( ( int ) ( header . ColorType ) ) { case 0 : return ( ( float ) ( header . BitDepth ) / 8 ) ; case 2 : return ( 3 * ( float ) ( header . BitDepth ) / 8 ) ; case 3 : return ( float ) ( header . BitDepth ) / 8 ; case 4 : return ( 2 * ( float ) ( header . BitDepth ) / 8 ) ; case 6 : return ( 4 * ( ( float ) ( header . BitDepth ) / 8 ) ) ; default : return - 1 ; } }
Uses the ColorType and Bitdepth of this image to calculate the number of bytes per pixel.
Uses the ColorType and Bitdepth of this image to calculate the number of bytes per pixel .
//break; //break; //break; //break; //break;
The number of BytesPerPixel in this image.
The number of BytesPerPixel in this image .
header
HeaderInfo
The HeaderInfo containing IHDR data for this image
The HeaderInfo containing IHDR data for this image