Axiom.Media.PixelUtil.GetNumElemBits C# (CSharp) Метод

GetNumElemBits() публичный статический Метод

Returns the size in bits of an element of the given pixel format.
public static GetNumElemBits ( PixelFormat format ) : int
format PixelFormat Pixel format to test.
Результат int
		public static int GetNumElemBits( PixelFormat format )
		{
			return GetNumElemBytes( format ) * 8;
		}

Usage Example

Пример #1
0
        private PixelFormat _convertPixelFormat(int rgbBits, int rMask, int gMask, int bMask, int aMask)
        {
            // General search through pixel formats
            for (var i = (int)PixelFormat.Unknown + 1; i < (int)PixelFormat.Count; ++i)
            {
                var pf = (PixelFormat)i;
                if (PixelUtil.GetNumElemBits(pf) == rgbBits)
                {
                    var testMasks = PixelUtil.GetBitMasks(pf);
                    var testBits  = PixelUtil.GetBitDepths(pf);

                    if (testMasks[0] == rMask && testMasks[1] == gMask && testMasks[2] == bMask &&
                        // for alpha, deal with 'X8' formats by checking bit counts
                        (testMasks[3] == aMask || (aMask == 0 && testBits[3] == 0)))
                    {
                        return(pf);
                    }
                }
            }

            throw new AxiomException("Cannot determine pixel format");
        }