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

CheckTile() public method

Checks whether the specified (x, y, z, plane) coordinates are within the bounds of the image.
The x parameter is checked against the value of the TiffTag.IMAGEWIDTH tag. The y parameter is checked against the value of the TiffTag.IMAGELENGTH tag. The z parameter is checked against the value of the TiffTag.IMAGEDEPTH tag (if defined). The plane parameter is checked against the value of the TiffTag.SAMPLESPERPIXEL tag if the data are organized in separate planes.
public CheckTile ( int x, int y, int z, short plane ) : bool
x int The x-coordinate.
y int The y-coordinate.
z int The z-coordinate.
plane short The sample plane.
return bool
        public bool CheckTile(int x, int y, int z, short plane)
        {
            if (x >= m_dir.td_imagewidth)
            {
                ErrorExt(this, m_clientdata, m_name, "{0}: Col out of range, max {1}", x, m_dir.td_imagewidth - 1);
                return false;
            }

            if (y >= m_dir.td_imagelength)
            {
                ErrorExt(this, m_clientdata, m_name, "{0}: Row out of range, max {1}", y, m_dir.td_imagelength - 1);
                return false;
            }

            if (z >= m_dir.td_imagedepth)
            {
                ErrorExt(this, m_clientdata, m_name, "{0}: Depth out of range, max {1}", z, m_dir.td_imagedepth - 1);
                return false;
            }

            if (m_dir.td_planarconfig == PlanarConfig.SEPARATE && plane >= m_dir.td_samplesperpixel)
            {
                ErrorExt(this, m_clientdata, m_name, "{0}: Sample out of range, max {1}", plane, m_dir.td_samplesperpixel - 1);
                return false;
            }

            return true;
        }
Tiff