CSharpImageLibrary.ImageFormats.GetUncompressedSize C# (CSharp) Method

GetUncompressedSize() public static method

Gets uncompressed size of image with mipmaps given dimensions and number of channels. Assume 8 bits per channel.
public static GetUncompressedSize ( int topWidth, int topHeight, int numChannels, bool inclMips ) : int
topWidth int Width of top mipmap.
topHeight int Height of top mipmap.
numChannels int Number of channels in image.
inclMips bool Include size of mipmaps.
return int
        public static int GetUncompressedSize(int topWidth, int topHeight, int numChannels, bool inclMips)
        {
            return (int)(numChannels * (topWidth * topHeight) * (inclMips ? 4d/3d : 1d));
        }

Usage Example

Beispiel #1
0
        /// <summary>
        /// Creates a Mipmap object from a WPF image.
        /// </summary>
        public MipMap(byte[] pixels, int width, int height, ImageFormats.ImageEngineFormatDetails details)
        {
            Pixels = pixels;
            Width  = width;
            Height = height;
            LoadedFormatDetails = details;

            UncompressedSize = ImageFormats.GetUncompressedSize(width, height, details.MaxNumberOfChannels, false);
        }