tesseract  5.0.0-alpha-619-ge9db
blread.h File Reference
#include <cstdint>
#include <tesseract/strngs.h>

Go to the source code of this file.

Functions

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

Function Documentation

◆ FullPageBlock()

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

Definition at line 63 of file blread.cpp.

64  {
65  BLOCK_IT block_it(blocks);
66  auto* block = new BLOCK("", true, 0, 0, 0, 0, width, height);
67  block_it.add_to_end(block);

◆ read_unlv_file()

bool read_unlv_file ( STRING  name,
int32_t  xsize,
int32_t  ysize,
BLOCK_LIST *  blocks 
)

Definition at line 31 of file blread.cpp.

37  {
38  FILE *pdfp; //file pointer
39  BLOCK *block; //current block
40  int x; //current top-down coords
41  int y;
42  int width; //of current block
43  int height;
44  BLOCK_IT block_it = blocks; //block iterator
45 
46  name += UNLV_EXT; //add extension
47  if ((pdfp = fopen (name.c_str (), "rb")) == nullptr) {
48  return false; //didn't read one
49  } else {
50  while (tfscanf(pdfp, "%d %d %d %d %*s", &x, &y, &width, &height) >= 4) {
51  //make rect block
52  block = new BLOCK (name.c_str (), true, 0, 0,
53  static_cast<int16_t>(x), static_cast<int16_t>(ysize - y - height),
54  static_cast<int16_t>(x + width), static_cast<int16_t>(ysize - y));
55  //on end of list
56  block_it.add_to_end (block);
57  }
58  fclose(pdfp);
59  }
60  tprintf("UZN file %s loaded.\n", name.c_str());
61  return true;
tfscanf
int tfscanf(FILE *stream, const char *format,...)
Definition: scanutils.cpp:181
BLOCK
Definition: ocrblock.h:28
STRING::c_str
const char * c_str() const
Definition: strngs.cpp:192
UNLV_EXT
#define UNLV_EXT
Definition: blread.cpp:24
tprintf
DLLSYM void tprintf(const char *format,...)
Definition: tprintf.cpp:34