Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
blread.cpp File Reference
#include "mfcpch.h"
#include <stdlib.h>
#include "scanutils.h"
#include "fileerr.h"
#include "blread.h"

Go to the source code of this file.

Macros

#define UNLV_EXT   ".uzn"
 

Functions

bool read_unlv_file (STRING name, inT32 xsize, inT32 ysize, BLOCK_LIST *blocks)
 
void FullPageBlock (int width, int height, BLOCK_LIST *blocks)
 

Macro Definition Documentation

#define UNLV_EXT   ".uzn"

Definition at line 29 of file blread.cpp.

Function Documentation

void FullPageBlock ( int  width,
int  height,
BLOCK_LIST *  blocks 
)

Definition at line 69 of file blread.cpp.

69  {
70  BLOCK_IT block_it(blocks);
71  BLOCK* block = new BLOCK("", TRUE, 0, 0, 0, 0, width, height);
72  block_it.add_to_end(block);
73 }
Definition: ocrblock.h:31
#define TRUE
Definition: capi.h:27
bool read_unlv_file ( STRING  name,
inT32  xsize,
inT32  ysize,
BLOCK_LIST *  blocks 
)

Definition at line 37 of file blread.cpp.

42  {
43  FILE *pdfp; //file pointer
44  BLOCK *block; //current block
45  int x; //current top-down coords
46  int y;
47  int width; //of current block
48  int height;
49  BLOCK_IT block_it = blocks; //block iterator
50 
51  name += UNLV_EXT; //add extension
52  if ((pdfp = fopen (name.string (), "rb")) == NULL) {
53  return false; //didn't read one
54  }
55  else {
56  while (fscanf (pdfp, "%d %d %d %d %*s", &x, &y, &width, &height) >= 4) {
57  //make rect block
58  block = new BLOCK (name.string (), TRUE, 0, 0,
59  (inT16) x, (inT16) (ysize - y - height),
60  (inT16) (x + width), (inT16) (ysize - y));
61  //on end of list
62  block_it.add_to_end (block);
63  }
64  fclose(pdfp);
65  }
66  return true;
67 }
#define NULL
Definition: host.h:144
#define UNLV_EXT
Definition: blread.cpp:29
const char * string() const
Definition: strngs.cpp:156
Definition: ocrblock.h:31
short inT16
Definition: host.h:100
#define TRUE
Definition: capi.h:27