Main Page   Compound List   File List   Compound Members   File Members  

gocr_module.h

Go to the documentation of this file.
00001 /*
00002 GOCR Copyright (C) 2000  Joerg Schulenburg Joerg.Schulenburg@physik.uni-magdeburg.de 
00003 GOCR API Copyright (C) 2001 Bruno Barberi Gnecco <brunobg@sourceforge.net>
00004 
00005 This program is free software; you can redistribute it and/or
00006 modify it under the terms of the GNU General Public License
00007 as published by the Free Software Foundation; either version 2
00008 of the License, or (at your option) any later version.
00009 
00010 This program is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 GNU General Public License for more details.
00014 
00015 You should have received a copy of the GNU General Public License
00016 along with this program; if not, write to the Free Software
00017 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018 
00019 */
00020  
00021 
00022 #ifndef _GOCR_MODULE_H 
00023 #define _GOCR_MODULE_H 
00024 
00025 /* header for modules. */
00026 
00027 #include <stdio.h>
00028 #include "hash.h"
00029 #include "list.h"
00030 #include "unicode.h"
00031 #include "gocr_char.h"
00032 
00037 /*
00038  * Image
00039  */
00047 #define GOCR_BLACK                      0
00048 
00052 #define GOCR_WHITE                      1
00053 
00057 enum gocrimagetype {
00058         BLACK_AND_WHITE, GRAY
00059 };
00063 typedef enum gocrimagetype gocrImageType;
00064 
00071 struct gocrpixel {
00072         unsigned char   value : 1;      
00073         unsigned char   mark1 : 1;      
00074         unsigned char   mark2 : 1;      
00075         unsigned char   mark3 : 1;      
00076         unsigned char   isblock : 1;    
00077         unsigned char   ischar : 1;     
00078         unsigned char   padding : 2;    
00079 };
00083 typedef struct gocrpixel gocrPixel;
00084 
00091 struct gocrimage {
00092         char            *filename;      
00093         int             x, y;           
00094         gocrImageType   type;           
00095         gocrPixel       **data;         
00096         List            blocklist;      
00097 };
00101 typedef struct gocrimage gocrImage;
00102 
00109 extern gocrImage        *currentimage;
00110 
00111 extern void gocr_imageFree ( gocrImage *image );
00114 /*
00115  * block definition
00116  */
00120 typedef int gocrblockType;
00121 
00125 struct gocrblock {
00126         gocrblockType   t;
00127 
00128         int             x0, y0, x1, y1;         /* boundaries in main image */
00129         gocrImage       image;
00130         List            boxlist;
00131 };
00135 typedef struct gocrblock gocrBlock;
00136 
00137 struct gocrline {
00138         int             x0, x1;         /* x-boundaries */
00139         int             m0, m1, m2, m3; /* y-boundaries */
00140 };
00141 typedef struct gocrline gocrLine;
00142 
00143 struct gocrtextblock {
00144         gocrBlock       b;                      /* parent; must be first field */
00145         List            linelist;
00146 };
00147 typedef struct gocrtextblock gocrTextBlock;
00148 
00149 struct gocrpictureblock {
00150         gocrBlock       b;                      /* parent; must be first field */
00151         char            *name;
00152 };
00153 typedef struct gocrpictureblock gocrPictureBlock;
00154 
00155 struct gocrmathblock {
00156         gocrBlock       b;                      /* parent; must be first field */
00157 
00158         /* to be done */
00159 };
00160 typedef struct gocrmathblock gocrMathBlock;
00161 
00162 extern gocrblockType gocr_blockTypeRegister ( char *name );
00163 extern gocrblockType gocr_blockTypeGetByName ( char *name );
00164 extern char *gocr_blockTypeGetNameByType ( gocrblockType t );
00165 
00166 extern int gocr_blockAdd ( gocrBlock *b );
00169 /*
00170  * Debugging utilities
00171  */
00175 extern int gocr_printArea ( gocrImage *image, int x0, int y0, int x1, int y1 );
00176 extern int gocr_printBlock ( gocrBlock *b  );
00177 extern int gocr_printBox ( gocrBox *b );
00178 extern int gocr_printBox2 ( gocrBox *b1, gocrBox *b2 );
00181 #endif /* _GOCR_MODULE_H */

Generated at Thu Mar 1 10:05:32 2001 for GOCR API by doxygen1.2.2 written by Dimitri van Heesch, © 1997-2000