tesseract  4.0.0-1-g2a2b
callcpp.h File Reference
#include "host.h"
#include "params.h"
#include "unichar.h"

Go to the source code of this file.

Enumerations

enum  C_COL {
  Black, White, Red, Yellow,
  Green, Cyan, Blue, Magenta,
  Aquamarine, Dark_SLATE_BLUE, Light_BLUE, Medium_BLUE,
  Midnight_BLUE, Navy_BLUE, Sky_BLUE, Slate_BLUE,
  Steel_BLUE, Coral, Brown, Sandy_BROWN,
  Gold, GoldENROD, Dark_GREEN, Dark_OLIVE_GREEN,
  Forest_GREEN, Lime_GREEN, Pale_GREEN, Yellow_GREEN,
  Light_GREY, Dark_SLATE_GREY, Dim_GREY, Grey,
  Khaki, Maroon, Orange, Orchid,
  Pink, Plum, Indian_RED, Orange_RED,
  Violet_RED, Salmon, Tan, Turqoise,
  Dark_TURQUOISE, Violet, Wheat, Green_YELLOW
}
 

Functions

void cprintf (const char *format,...)
 
ScrollViewc_create_window (const char *name, int16_t xpos, int16_t ypos, int16_t xsize, int16_t ysize, double xmin, double xmax, double ymin, double ymax)
 
void c_line_color_index (void *win, C_COL index)
 
void c_move (void *win, double x, double y)
 
void c_draw (void *win, double x, double y)
 
void c_make_current (void *win)
 
void c_clear_window (void *win)
 
char window_wait (ScrollView *win)
 
void reverse32 (void *ptr)
 
void reverse16 (void *ptr)
 

Enumeration Type Documentation

◆ C_COL

enum C_COL
Enumerator
Black 
White 
Red 
Yellow 
Green 
Cyan 
Blue 
Magenta 
Aquamarine 
Dark_SLATE_BLUE 
Light_BLUE 
Medium_BLUE 
Midnight_BLUE 
Navy_BLUE 
Sky_BLUE 
Slate_BLUE 
Steel_BLUE 
Coral 
Brown 
Sandy_BROWN 
Gold 
GoldENROD 
Dark_GREEN 
Dark_OLIVE_GREEN 
Forest_GREEN 
Lime_GREEN 
Pale_GREEN 
Yellow_GREEN 
Light_GREY 
Dark_SLATE_GREY 
Dim_GREY 
Grey 
Khaki 
Maroon 
Orange 
Orchid 
Pink 
Plum 
Indian_RED 
Orange_RED 
Violet_RED 
Salmon 
Tan 
Turqoise 
Dark_TURQUOISE 
Violet 
Wheat 
Green_YELLOW 

Definition at line 29 of file callcpp.h.

29  {
30  Black,
31  White,
32  Red,
33  Yellow,
34  Green,
35  Cyan,
36  Blue,
37  Magenta,
38  Aquamarine,
40  Light_BLUE,
43  Navy_BLUE,
44  Sky_BLUE,
45  Slate_BLUE,
46  Steel_BLUE,
47  Coral,
48  Brown,
50  Gold,
51  GoldENROD,
52  Dark_GREEN,
55  Lime_GREEN,
56  Pale_GREEN,
58  Light_GREY,
60  Dim_GREY,
61  Grey,
62  Khaki,
63  Maroon,
64  Orange,
65  Orchid,
66  Pink,
67  Plum,
68  Indian_RED,
69  Orange_RED,
70  Violet_RED,
71  Salmon,
72  Tan,
73  Turqoise,
75  Violet,
76  Wheat,
78 } C_COL; /*starbase colours */
Definition: callcpp.h:47
Definition: callcpp.h:35
Definition: callcpp.h:67
Definition: callcpp.h:30
Definition: callcpp.h:50
Definition: callcpp.h:76
Definition: callcpp.h:31
Definition: callcpp.h:62
Definition: callcpp.h:36
C_COL
Definition: callcpp.h:29
Definition: callcpp.h:63
Definition: callcpp.h:65
Definition: callcpp.h:32
Definition: callcpp.h:34
Definition: callcpp.h:48
Definition: callcpp.h:33
Definition: callcpp.h:75
Definition: callcpp.h:72
Definition: callcpp.h:71
Definition: callcpp.h:66
Definition: callcpp.h:61
Definition: callcpp.h:64

Function Documentation

◆ c_clear_window()

void c_clear_window ( void *  win)

Definition at line 97 of file callcpp.cpp.

98  {
99  ScrollView* window = (ScrollView*) win;
100  window->Clear();
101 }
void Clear()
Definition: scrollview.cpp:591

◆ c_create_window()

ScrollView* c_create_window ( const char *  name,
int16_t  xpos,
int16_t  ypos,
int16_t  xsize,
int16_t  ysize,
double  xmin,
double  xmax,
double  ymin,
double  ymax 
)

Definition at line 48 of file callcpp.cpp.

58  {
59  return new ScrollView(name, xpos, ypos, xsize, ysize, xmax - xmin, ymax - ymin, true);
60 }

◆ c_draw()

void c_draw ( void *  win,
double  x,
double  y 
)

Definition at line 81 of file callcpp.cpp.

84  {
85  ScrollView* window = (ScrollView*) win;
86  window->DrawTo((int) x, (int) y);
87 }
void DrawTo(int x, int y)
Definition: scrollview.cpp:527

◆ c_line_color_index()

void c_line_color_index ( void *  win,
C_COL  index 
)

Definition at line 63 of file callcpp.cpp.

65  {
66  // The colors are the same as the SV ones except that SV has COLOR:NONE --> offset of 1
67  ScrollView* window = (ScrollView*) win;
68  window->Pen((ScrollView::Color) (index + 1));
69 }
void Pen(Color color)
Definition: scrollview.cpp:722

◆ c_make_current()

void c_make_current ( void *  win)

Definition at line 90 of file callcpp.cpp.

91  {
92  ScrollView* window = (ScrollView*) win;
93  window->Update();
94 }
static void Update()
Definition: scrollview.cpp:711

◆ c_move()

void c_move ( void *  win,
double  x,
double  y 
)

Definition at line 72 of file callcpp.cpp.

75  {
76  ScrollView* window = (ScrollView*) win;
77  window->SetCursor((int) x, (int) y);
78 }
void SetCursor(int x, int y)
Definition: scrollview.cpp:521

◆ cprintf()

void cprintf ( const char *  format,
  ... 
)

Definition at line 33 of file callcpp.cpp.

35  {
36  va_list args; //variable args
37  char msg[1000];
38 
39  va_start(args, format); //variable list
40  vsprintf(msg, format, args); //Format into msg
41  va_end(args);
42 
43  tprintf ("%s", msg);
44 }
DLLSYM void tprintf(const char *format,...)
Definition: tprintf.cpp:37

◆ reverse16()

void reverse16 ( void *  ptr)

Definition at line 131 of file callcpp.cpp.

131  {
132  char tmp;
133  char *cptr = (char *) ptr;
134 
135  tmp = *cptr;
136  *cptr = *(cptr + 1);
137  *(cptr + 1) = tmp;
138 }

◆ reverse32()

void reverse32 ( void *  ptr)

Definition at line 118 of file callcpp.cpp.

118  {
119  char tmp;
120  char *cptr = (char *) ptr;
121 
122  tmp = *cptr;
123  *cptr = *(cptr + 3);
124  *(cptr + 3) = tmp;
125  tmp = *(cptr + 1);
126  *(cptr + 1) = *(cptr + 2);
127  *(cptr + 2) = tmp;
128 }

◆ window_wait()

char window_wait ( ScrollView win)

Definition at line 104 of file callcpp.cpp.

104  {
105  // Wait till an input or click event (all others are thrown away)
106  char ret = '\0';
107  SVEventType ev_type = SVET_ANY;
108  do {
109  std::unique_ptr<SVEvent> ev(win->AwaitEvent(SVET_ANY));
110  ev_type = ev->type;
111  if (ev_type == SVET_INPUT)
112  ret = ev->parameter[0];
113  } while (ev_type != SVET_INPUT && ev_type != SVET_CLICK);
114  return ret;
115 }
SVEventType
Definition: scrollview.h:45
SVEvent * AwaitEvent(SVEventType type)
Definition: scrollview.cpp:445