tesseract  4.1.1
blread.h File Reference
#include <cstdint>
#include "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 64 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);
68 }

◆ read_unlv_file()

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

Definition at line 32 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.string (), "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.string (), 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.string());
61  return true;
62 }
STRING::string
const char * string() const
Definition: strngs.cpp:194
tfscanf
int tfscanf(FILE *stream, const char *format,...)
Definition: scanutils.cpp:181
UNLV_EXT
#define UNLV_EXT
Definition: blread.cpp:24
tprintf
DLLSYM void tprintf(const char *format,...)
Definition: tprintf.cpp:35
BLOCK
Definition: ocrblock.h:31