BitMiracle.LibTiff.Classic.Tiff.DataWidth C# (CSharp) Method

DataWidth() public static method

Gets the number of bytes occupied by the item of given type.
public static DataWidth ( TiffType type ) : int
type TiffType The type.
return int
        public static int DataWidth(TiffType type)
        {
            switch (type)
            {
                case TiffType.NOTYPE:
                case TiffType.BYTE:
                case TiffType.ASCII:
                case TiffType.SBYTE:
                case TiffType.UNDEFINED:
                    return 1;

                case TiffType.SHORT:
                case TiffType.SSHORT:
                    return 2;

                case TiffType.LONG:
                case TiffType.SLONG:
                case TiffType.FLOAT:
                case TiffType.IFD:
                    return 4;

                case TiffType.RATIONAL:
                case TiffType.SRATIONAL:
                case TiffType.DOUBLE:
                    return 8;

                default:
                    // will return 0 for unknown types
                    return 0;
            }
        }
Tiff