BitMiracle.LibTiff.Classic.TiffRgbaImage.buildMap C# (CSharp) Method

buildMap() private method

Construct any mapping table used by the associated put method.
private buildMap ( ) : bool
return bool
        private bool buildMap()
        {
            switch (photometric)
            {
                case Photometric.RGB:
                case Photometric.YCBCR:
                case Photometric.SEPARATED:
                    if (bitspersample == 8)
                        break;
                    if (!setupMap())
                        return false;
                    break;

                case Photometric.MINISBLACK:
                case Photometric.MINISWHITE:
                    if (!setupMap())
                        return false;
                    break;

                case Photometric.PALETTE:
                    // Convert 16-bit colormap to 8-bit
                    // (unless it looks like an old-style 8-bit colormap).
                    if (checkcmap() == 16)
                        cvtcmap();
                    else
                        Tiff.WarningExt(tif, tif.m_clientdata, tif.FileName(), "Assuming 8-bit colormap");

                    // Use mapping table and colormap to construct unpacking
                    // tables for samples < 8 bits.
                    if (bitspersample <= 8 && !makecmap())
                        return false;
                    break;
            }

            return true;
        }