#ifndef GOOGLEOCR_H_
#define GOOGLEOCR_H_
#include <time.h>

extern "C" {

typedef struct                   /*single character */
{
  unsigned short char_code;              /*character itself */
  short left;                    /*of char (-1) */
  short right;                   /*of char (-1) */
  short top;                     /*of char (-1) */
  short bottom;                  /*of char (-1) */
  short font_index;              /*what font (0) */
  unsigned char confidence;              /*0=perfect, 100=reject (0/100) */
  unsigned char point_size;              /*of char, 72=i inch, (10) */
  char blanks;                   /*no of spaces before this char (1) */
  unsigned char formatting;              /*char formatting (0) */
} EANYCODE_CHAR;                 /*single character */

typedef bool (*CANCEL_FUNC)(void* cancel_this, int words);

typedef struct ETEXT_STRUCT      /*output header */
{
  short count;                   /*chars in this buffer(0) */
  short progress;                /*percent complete increasing (0-100) */
  char more_to_come;             /*true if not last */
  char ocr_alive;                /*ocr sets to 1, HP 0 */
  char err_code;                 /*for errcode use */
  CANCEL_FUNC cancel;            /*returns true to cancel */
  void* cancel_this;             /*this or other data for cancel*/
  clock_t end_time;              /*time to stop if not 0*/
  EANYCODE_CHAR text[1];         /*character data */
} ETEXT_DESC;                    /*output header */

void  * TessDllInit(const char *sDataDir, const char* lang);

int TessDllBeginPageUprightBPP(unsigned int xsize, unsigned int ysize,
                               const unsigned char *buf, 
                               unsigned char bpp);

ETEXT_DESC * TessDllRecognize_all_Words(void);

void TessDllEndPage(void);

void TessDllRelease();

}

#endif /*GOOGLEOCR_H_*/

