00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019
00020
00021
00022 #ifndef _GOCR_MODULE_H
00023 #define _GOCR_MODULE_H
00024
00025
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 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 00116
00120 typedef int gocrblockType;
00121
00125 struct gocrblock {
00126 gocrblockType t;
00127
00128 int x0, y0, x1, y1;
00129 gocrImage image;
00130 List boxlist;
00131 };
00135 typedef struct gocrblock gocrBlock;
00136
00137 struct gocrline {
00138 int x0, x1;
00139 int m0, m1, m2, m3;
00140 };
00141 typedef struct gocrline gocrLine;
00142
00143 struct gocrtextblock {
00144 gocrBlock b;
00145 List linelist;
00146 };
00147 typedef struct gocrtextblock gocrTextBlock;
00148
00149 struct gocrpictureblock {
00150 gocrBlock b;
00151 char *name;
00152 };
00153 typedef struct gocrpictureblock gocrPictureBlock;
00154
00155 struct gocrmathblock {
00156 gocrBlock b;
00157
00158
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 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