tesseract v5.3.3.20231005
tesseract::DebugPixa Class Reference

#include <debugpixa.h>

Public Member Functions

 DebugPixa ()
 
 ~DebugPixa ()
 
void AddPix (const Image pix, const char *caption)
 
void WritePDF (const char *filename)
 

Detailed Description

Definition at line 12 of file debugpixa.h.

Constructor & Destructor Documentation

◆ DebugPixa()

tesseract::DebugPixa::DebugPixa ( )
inline

Definition at line 15 of file debugpixa.h.

15 {
16 pixa_ = pixaCreate(0);
17#ifdef TESSERACT_DISABLE_DEBUG_FONTS
18 fonts_ = NULL;
19#else
20 fonts_ = bmfCreate(nullptr, 14);
21#endif
22 }

◆ ~DebugPixa()

tesseract::DebugPixa::~DebugPixa ( )
inline

Definition at line 25 of file debugpixa.h.

25 {
26 pixaDestroy(&pixa_);
27 bmfDestroy(&fonts_);
28 }

Member Function Documentation

◆ AddPix()

void tesseract::DebugPixa::AddPix ( const Image  pix,
const char *  caption 
)
inline

Definition at line 32 of file debugpixa.h.

32 {
33 int depth = pixGetDepth(pix);
34 int color = depth < 8 ? 1 : (depth > 8 ? 0x00ff0000 : 0x80);
35 Image pix_debug =
36 pixAddSingleTextblock(pix, fonts_, caption, color, L_ADD_BELOW, nullptr);
37 pixaAddPix(pixa_, pix_debug, L_INSERT);
38 }

◆ WritePDF()

void tesseract::DebugPixa::WritePDF ( const char *  filename)
inline

Definition at line 42 of file debugpixa.h.

42 {
43 if (pixaGetCount(pixa_) > 0) {
44 pixaConvertToPdf(pixa_, 300, 1.0f, 0, 0, "AllDebugImages", filename);
45 pixaClear(pixa_);
46 }
47 }

The documentation for this class was generated from the following file: