NScumm.Core.Graphics.Surface.GetBytesPerPixel C# (CSharp) Method

GetBytesPerPixel() public static method

public static GetBytesPerPixel ( PixelFormat pixelFormat ) : int
pixelFormat PixelFormat
return int
        public static int GetBytesPerPixel(PixelFormat pixelFormat)
        {
            int bytesPerPixel;
            switch (pixelFormat)
            {
                case PixelFormat.Indexed8:
                    bytesPerPixel = 1;
                    break;
                case PixelFormat.Rgb16:
                    bytesPerPixel = 2;
                    break;
                case PixelFormat.Rgb24:
                    bytesPerPixel = 3;
                    break;
                default:
                    throw new ArgumentException(string.Format("Pixel format {0} is not supported", pixelFormat));
            }
            return bytesPerPixel;
        }