Пример #1
0
 /**
  * Gets a byte array that can be used as a /JBIG2Globals,
  * or null if not applicable to the given jbig2.
  * @param   ra  an random access file or array
  * @return  a byte array
  */
 public static byte[] GetGlobalSegment(RandomAccessFileOrArray ra)
 {
     try {
         JBIG2SegmentReader sr = new JBIG2SegmentReader(ra);
         sr.Read();
         return(sr.GetGlobal(true));
     } catch {
         return(null);
     }
 }
Пример #2
0
 /**
 * Gets a byte array that can be used as a /JBIG2Globals,
 * or null if not applicable to the given jbig2.
 * @param   ra  an random access file or array
 * @return  a byte array
 */
 public static byte[] GetGlobalSegment(RandomAccessFileOrArray ra )
 {
     try {
         JBIG2SegmentReader sr = new JBIG2SegmentReader(ra);
         sr.Read();
         return sr.GetGlobal(true);
     } catch {
         return null;
     }
 }
Пример #3
0
        /**
         * returns an Image representing the given page.
         * @param ra    the file or array containing the image
         * @param page  the page number of the image
         * @return  an Image object
         */
        public static Image GetJbig2Image(RandomAccessFileOrArray ra, int page)
        {
            if (page < 1)
            {
                throw new ArgumentException("The page number must be >= 1.");
            }

            JBIG2SegmentReader sr = new JBIG2SegmentReader(ra);

            sr.Read();
            JBIG2SegmentReader.JBIG2Page p = sr.GetPage(page);
            Image img = new ImgJBIG2(p.pageBitmapWidth, p.pageBitmapHeight, p.GetData(true), sr.GetGlobal(true));

            return(img);
        }
Пример #4
0
        /**
        * returns an Image representing the given page.
        * @param ra    the file or array containing the image
        * @param page  the page number of the image
        * @return  an Image object
        */
        public static Image GetJbig2Image(RandomAccessFileOrArray ra, int page)
        {
            if (page < 1)
                throw new ArgumentException("The page number must be >= 1.");

            JBIG2SegmentReader sr = new JBIG2SegmentReader(ra);
            sr.Read();
            JBIG2SegmentReader.JBIG2Page p = sr.GetPage(page);
            Image img = new ImgJBIG2(p.pageBitmapWidth, p.pageBitmapHeight, p.GetData(true), sr.GetGlobal(true));
            return img;
        }