Beispiel #1
0
        // writefile.c (666, 1)
        // getFormatExtension(format) as String
        // getFormatExtension(l_int32) as const char *
        ///  <summary>
        /// (1) This string is NOT owned by the caller it is just a pointer
        /// to a global string.  Do not free it.
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/getFormatExtension/*"/>
        ///  <param name="format">[in] - integer</param>
        ///   <returns>extension string, or NULL if format is out of range</returns>
        public static String getFormatExtension(
            Enumerations.IFF format)
        {
            String _Result = Natives.getFormatExtension((int)format);

            return(_Result);
        }
Beispiel #2
0
        // readbarcode.c (134, 1)
        // pixProcessBarcodes(pixs, format, method, psaw, debugflag) as Sarray
        // pixProcessBarcodes(PIX *, l_int32, l_int32, SARRAY **, l_int32) as SARRAY *
        ///  <summary>
        /// pixProcessBarcodes()
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/pixProcessBarcodes/*"/>
        ///  <param name="pixs">[in] - any depth</param>
        ///  <param name="format">[in] - L_BF_ANY, L_BF_CODEI2OF5, L_BF_CODE93, ...</param>
        ///  <param name="method">[in] - L_USE_WIDTHS, L_USE_WINDOWS</param>
        ///  <param name="psaw">[out][optional] - sarray of bar widths</param>
        ///  <param name="debugflag">[in] - use 1 to generate debug output</param>
        ///   <returns>sarray text of barcodes, or NULL if none found or on error</returns>
        public static Sarray pixProcessBarcodes(
            Pix pixs,
            Enumerations.IFF format,
            int method,
            out Sarray psaw,
            int debugflag)
        {
            if (pixs == null)
            {
                throw new ArgumentNullException("pixs cannot be Nothing");
            }

            IntPtr psawPtr = IntPtr.Zero;
            IntPtr _Result = Natives.pixProcessBarcodes(pixs.Pointer, (int)format, method, out psawPtr, debugflag);

            if (psawPtr == IntPtr.Zero)
            {
                psaw = null;
            }
            else
            {
                psaw = new Sarray(psawPtr);
            };

            if (_Result == IntPtr.Zero)
            {
                return(null);
            }

            return(new Sarray(_Result));
        }
Beispiel #3
0
        // bardecode.c (173, 1)
        // barcodeFormatIsSupported(format) as int
        // barcodeFormatIsSupported(l_int32) as l_int32
        ///  <summary>
        /// barcodeFormatIsSupported()
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/barcodeFormatIsSupported/*"/>
        ///  <param name="format">[in] - </param>
        ///   <returns>1 if format is one of those supported 0 otherwise</returns>
        public static int barcodeFormatIsSupported(
            Enumerations.IFF format)
        {
            int _Result = Natives.barcodeFormatIsSupported((int)format);

            return(_Result);
        }
Beispiel #4
0
        // regutils.c (821, 1)
        // regTestGenLocalFilename(rp, index, format) as String
        // regTestGenLocalFilename(L_REGPARAMS *, l_int32, l_int32) as char *
        ///  <summary>
        /// (1) This is used to get the name of a file in the regout
        /// subdirectory, that has been made and is used to test against
        /// the golden file.  You can either specify a particular index
        /// value, or with %index == -1, this returns the most recently
        /// written file.  The latter case lets you read a pix from a
        /// file that has just been written with regTestWritePixAndCheck(),
        /// which is useful for testing formatted read/write functions.
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/regTestGenLocalFilename/*"/>
        ///  <param name="rp">[in] - regtest parameters</param>
        ///  <param name="index">[in] - use -1 for current index</param>
        ///  <param name="format">[in] - of image e.g., IFF_PNG</param>
        ///   <returns>filename if OK, or NULL on error</returns>
        public static String regTestGenLocalFilename(
            L_RegParams rp,
            int index,
            Enumerations.IFF format)
        {
            if (rp == null)
            {
                throw new ArgumentNullException("rp cannot be Nothing");
            }

            String _Result = Natives.regTestGenLocalFilename(rp.Pointer, index, (int)format);

            return(_Result);
        }
Beispiel #5
0
        // bardecode.c (96, 1)
        // barcodeDispatchDecoder(barstr, format, debugflag) as String
        // barcodeDispatchDecoder(char *, l_int32, l_int32) as char *
        ///  <summary>
        /// barcodeDispatchDecoder()
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/barcodeDispatchDecoder/*"/>
        ///  <param name="barstr">[in] - string of integers in set {1,2,3,4} of bar widths</param>
        ///  <param name="format">[in] - L_BF_ANY, L_BF_CODEI2OF5, L_BF_CODE93, ...</param>
        ///  <param name="debugflag">[in] - use 1 to generate debug output</param>
        ///   <returns>data string of decoded barcode data, or NULL on error</returns>
        public static String barcodeDispatchDecoder(
            String barstr,
            Enumerations.IFF format,
            int debugflag)
        {
            if (barstr == null)
            {
                throw new ArgumentNullException("barstr cannot be Nothing");
            }

            String _Result = Natives.barcodeDispatchDecoder(barstr, (int)format, debugflag);

            return(_Result);
        }
Beispiel #6
0
        // writefile.c (242, 1)
        // pixaWriteFiles(rootname, pixa, format) as int
        // pixaWriteFiles(const char *, PIXA *, l_int32) as l_ok
        ///  <summary>
        /// (1) Use %format = IFF_DEFAULT to decide the output format
        /// individually for each pix.
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/pixaWriteFiles/*"/>
        ///  <param name="rootname">[in] - </param>
        ///  <param name="pixa">[in] - </param>
        ///  <param name="format">[in] - defined in imageio.h see notes for default</param>
        ///   <returns>0 if OK 1 on error</returns>
        public static int pixaWriteFiles(
            String rootname,
            Pixa pixa,
            Enumerations.IFF format)
        {
            if (rootname == null)
            {
                throw new ArgumentNullException("rootname cannot be Nothing");
            }

            if (pixa == null)
            {
                throw new ArgumentNullException("pixa cannot be Nothing");
            }

            int _Result = Natives.pixaWriteFiles(rootname, pixa.Pointer, (int)format);

            return(_Result);
        }
Beispiel #7
0
        // writefile.c (392, 1)
        // pixWriteStream(fp, pix, format) as int
        // pixWriteStream(FILE *, PIX *, l_int32) as l_ok
        ///  <summary>
        /// pixWriteStream()
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/pixWriteStream/*"/>
        ///  <param name="fp">[in] - file stream</param>
        ///  <param name="pix">[in] - </param>
        ///  <param name="format">[in] - </param>
        ///   <returns>0 if OK 1 on error.</returns>
        public static int pixWriteStream(
            FILE fp,
            Pix pix,
            Enumerations.IFF format)
        {
            if (fp == null)
            {
                throw new ArgumentNullException("fp cannot be Nothing");
            }

            if (pix == null)
            {
                throw new ArgumentNullException("pix cannot be Nothing");
            }

            int _Result = Natives.pixWriteStream(fp.Pointer, pix.Pointer, (int)format);

            return(_Result);
        }
Beispiel #8
0
        // writefile.c (332, 1)
        // pixWrite(fname, pix, format) as int
        // pixWrite(const char *, PIX *, l_int32) as l_ok
        ///  <summary>
        /// (1) Open for write using binary mode (with the "b" flag)
        /// to avoid having Windows automatically translate the NL
        /// into CRLF, which corrupts image files.  On non-windows
        /// systems this flag should be ignored, per ISO C90.
        /// Thanks to Dave Bryan for pointing this out.<para/>
        ///
        /// (2) If the default image format IFF_DEFAULT is requested:
        /// use the input format if known otherwise, use a lossless format.<para/>
        ///
        /// (3) The default jpeg quality is 75.  For some other value,
        /// Use l_jpegSetQuality().
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/pixWrite/*"/>
        ///  <param name="fname">[in] - </param>
        ///  <param name="pix">[in] - </param>
        ///  <param name="format">[in] - defined in imageio.h</param>
        ///   <returns>0 if OK 1 on error</returns>
        public static int pixWrite(
            String fname,
            Pix pix,
            Enumerations.IFF format)
        {
            if (fname == null)
            {
                throw new ArgumentNullException("fname cannot be Nothing");
            }

            if (pix == null)
            {
                throw new ArgumentNullException("pix cannot be Nothing");
            }

            int _Result = Natives.pixWrite(fname, pix.Pointer, (int)format);

            return(_Result);
        }
Beispiel #9
0
        // regutils.c (704, 1)
        // regTestWritePixAndCheck(rp, pix, format) as int
        // regTestWritePixAndCheck(L_REGPARAMS *, PIX *, l_int32) as l_ok
        ///  <summary>
        /// (1) This function makes it easy to write the pix in a numbered
        /// sequence of files, and either to:
        /// (a) write the golden file ("generate" arg to regression test)
        /// (b) make a local file and "compare" with the golden file
        /// (c) make a local file and "display" the results<para/>
        ///
        /// (2) The canonical format of the local filename is:
        /// /tmp/lept/regout/[root of main name].[count].[format extension]
        /// e.g., for scale_reg,
        /// /tmp/lept/regout/scale.0.png
        /// The golden file name mirrors this in the usual way.<para/>
        ///
        /// (3) The check is done between the written files, which requires
        /// the files to be identical. The exception is for GIF, which
        /// only requires that all pixels in the decoded pix are identical.
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/regTestWritePixAndCheck/*"/>
        ///  <param name="rp">[in] - regtest parameters</param>
        ///  <param name="pix">[in] - to be written</param>
        ///  <param name="format">[in] - of output pix</param>
        ///   <returns>0 if OK, 1 on error a failure in comparison is not an error</returns>
        public static int regTestWritePixAndCheck(
            L_RegParams rp,
            Pix pix,
            Enumerations.IFF format)
        {
            if (rp == null)
            {
                throw new ArgumentNullException("rp cannot be Nothing");
            }

            if (pix == null)
            {
                throw new ArgumentNullException("pix cannot be Nothing");
            }

            int _Result = Natives.regTestWritePixAndCheck(rp.Pointer, pix.Pointer, (int)format);

            return(_Result);
        }
Beispiel #10
0
        // writefile.c (701, 1)
        // pixWriteMem(pdata, psize, pix, format) as int
        // pixWriteMem(l_uint8 **, size_t *, PIX *, l_int32) as l_ok
        ///  <summary>
        /// (1) On windows, this will only write tiff and PostScript to memory.
        /// For other formats, it requires open_memstream(3).<para/>
        ///
        /// (2) PostScript output is uncompressed, in hex ascii.
        /// Most printers support level 2 compression (tiff_g4 for 1 bpp,
        /// jpeg for 8 and 32 bpp).<para/>
        ///
        /// (3) The default jpeg quality is 75.  For some other value,
        /// Use l_jpegSetQuality().
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/pixWriteMem/*"/>
        ///  <param name="pdata">[out] - data of tiff compressed image</param>
        ///  <param name="psize">[out] - size of returned data</param>
        ///  <param name="pix">[in] - </param>
        ///  <param name="format">[in] - defined in imageio.h</param>
        ///   <returns>0 if OK, 1 on error</returns>
        public static int pixWriteMem(
            out Byte[] pdata,
            out uint psize,
            Pix pix,
            Enumerations.IFF format)
        {
            if (pix == null)
            {
                throw new ArgumentNullException("pix cannot be Nothing");
            }

            IntPtr pdataPtr = IntPtr.Zero;
            int    _Result  = Natives.pixWriteMem(out pdataPtr, out psize, pix.Pointer, (int)format);

            Byte[] pdataGen = new Byte[psize];

            if (pdataPtr != IntPtr.Zero)
            {
                Marshal.Copy(pdataPtr, pdataGen, 0, pdataGen.Length);
            }

            pdata = pdataGen;
            return(_Result);
        }