Esempio n. 1
0
        /// <summary>
        /// Gets the bounding rectangle of the current element at the given level.
        /// </summary>
        /// <param name="level"></param>
        /// <param name="bounds"></param>
        /// <returns></returns>
        public bool TryGetBoundingBox(PageIteratorLevel level, out Rect bounds)
        {
            int x1, y1, x2, y2;

            if (TessApi.Native.PageIteratorBoundingBox(this.handle, level, out x1, out y1, out x2, out y2) != 0)
            {
                bounds = Rect.FromCoords(x1, y1, x2, y2);
                return(true);
            }
            bounds = Rect.Empty;
            return(false);
        }
Esempio n. 2
0
        /// <summary>
        ///     Gets the baseline of the current element at the given level.
        /// </summary>
        /// <remarks>
        ///     The baseline is the line that passes through (x1, y1) and (x2, y2).
        ///     WARNING: with vertical text, baselines may be vertical! Returns false if there is no baseline at the current
        ///     position.
        /// </remarks>
        /// <param name="level"></param>
        /// <param name="bounds"></param>
        /// <returns></returns>
        public bool TryGetBaseline(PageIteratorLevel level, out Rect bounds)
        {
            VerifyNotDisposed();
            int x1, y1, x2, y2;

            if (handle.Handle != IntPtr.Zero &&
                TessApi.Native.PageIteratorBaseline(handle, level, out x1, out y1, out x2, out y2) != 0)
            {
                bounds = Rect.FromCoords(x1, y1, x2, y2);
                return(true);
            }

            bounds = Rect.Empty;
            return(false);
        }
Esempio n. 3
0
        /// <summary>
        /// Gets the bounding rectangle of the current element at the given level.
        /// </summary>
        /// <param name="level"></param>
        /// <param name="bounds"></param>
        /// <returns></returns>
        public bool TryGetBoundingBox(PageIteratorLevel level, out Rect bounds)
        {
            int x1, y1, x2, y2;

            if (TesseractPrimitives.Api.PageIteratorBoundingBox(handle, level, out x1, out y1, out x2, out y2) != 0)
            {
                bounds = Rect.FromCoords(x1, y1, x2, y2);
                return(true);
            }
            else
            {
                bounds = Rect.Empty;
                return(false);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Gets the baseline of the current element at the given level.
        /// </summary>
        /// <remarks>
        /// The baseline is the line that passes through (x1, y1) and (x2, y2).
        /// WARNING: with vertical text, baselines may be vertical! Returns false if there is no baseline at the current position.</remarks>
        /// <param name="level"></param>
        /// <param name="bounds"></param>
        /// <returns></returns>
        public bool TryGetBaseline(PageIteratorLevel level, out Rect bounds)
        {
            int x1, y1, x2, y2;

            if (Interop.TessApi.Native.PageIteratorBaseline(handle, level, out x1, out y1, out x2, out y2) != 0)
            {
                bounds = Rect.FromCoords(x1, y1, x2, y2);
                return(true);
            }
            else
            {
                bounds = Rect.Empty;
                return(false);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Gets the bounding rectangle of the current element at the given level.
        /// </summary>
        /// <param name="level"></param>
        /// <param name="bounds"></param>
        /// <returns></returns>
        public bool TryGetBoundingBox(PageIteratorLevel level, out Rect bounds)
        {
            VerifyNotDisposed();
            int x1, y1, x2, y2;

            if (handle.Handle != IntPtr.Zero && TessApiSignatures.PageIteratorBoundingBox(handle, level, out x1, out y1, out x2, out y2))
            {
                bounds = Rect.FromCoords(x1, y1, x2, y2);
                return(true);
            }
            else
            {
                bounds = Rect.Empty;
                return(false);
            }
        }