PicoVGA  1.0-cmake
VGA/TV display on Raspberry Pico
print.h
Go to the documentation of this file.
1 
8 #ifndef _PRINT_H
9 #define _PRINT_H
10 
18 // text colors (if using PC CGA colors)
19 #define PC_BLACK 0
20 #define PC_BLUE 1
21 #define PC_GREEN 2
22 #define PC_CYAN 3
23 #define PC_RED 4
24 #define PC_MAGENTA 5
25 #define PC_BROWN 6
26 #define PC_LTGRAY 7
27 #define PC_GRAY 8
28 #define PC_LTBLUE 9
29 #define PC_LTGREEN 10
30 #define PC_LTCYAN 11
31 #define PC_LTRED 12
32 #define PC_LTMAGENTA 13
33 #define PC_YELLOW 14
34 #define PC_WHITE 15
35 
36 // compose PC color
37 #define PC_COLOR(bg,fg) (((bg)<<4)|(fg))
38 #define PC_FGCOLOR(color) ((color) & 0b1111) // Added by WV
39 #define PC_BGCOLOR(color) ((color) >> 4) // Added by WV
40 
41 // ASCII characters
42 #define CHAR_CR '\r'
43 #define CHAR_LF '\n'
44 #define CHAR_TAB '\t'
45 #define CHAR_FRAME 16
46 #define FRAME_L B0
47 #define FRAME_U B1
48 #define FRAME_R B2
49 #define FRAME_D B3
50 
51 #define CHAR_FRAME_FIRST 17
52 #define CHAR_FRAME_LAST 31
53 #define CHAR_VLINE (CHAR_FRAME|FRAME_U|FRAME_D)
54 #define CHAR_HLINE (CHAR_FRAME|FRAME_L|FRAME_R)
55 
56 // Current print buffer
57 extern u8* PrintBuf;
58 
59 // Size of print buffer
60 extern int PrintBufW, PrintBufH, PrintBufWB;
61 
62 // Print position
63 extern int PrintX, PrintY;
64 
65 // Current print color
66 extern u8 PrintCol;
67 
79 void PrintSetup(u8* buf, int bufw, int bufh, int bufwb);
80 
84 void PrintClear();
85 
89 void PrintHome();
90 
96 void PrintSetPos(int x, int y);
97 
103 void PrintAddPos(int x, int y);
104 
109 void PrintSetCol(u8 col);
110 
115 void PrintChar0(char ch);
116 
121 void PrintChar(char ch);
122 
126 void PrintSpc();
127 
132 void PrintSpcTo(int pos);
133 
139 void PrintCharRep(char ch, int num);
140 
145 void PrintSpcRep(int num);
146 
151 void PrintText(const char* text);
152 
163 void PrintHLine(int x, int y, int w);
164 
175 void PrintVLine(int x, int y, int h);
176 
184 void PrintFrame(int x, int y, int w, int h);
185 
187 
188 #endif // _PRINT_H
PrintText
void PrintText(const char *text)
Print a string.
Definition: print.cpp:156
PrintSetup
void PrintSetup(u8 *buf, int bufw, int bufh, int bufwb)
Setup print service.
Definition: print.cpp:26
PrintVLine
void PrintVLine(int x, int y, int h)
Print vertical line into screen, using current color.
Definition: print.cpp:198
PrintChar
void PrintChar(char ch)
Print character, using control characters CR, LF, TAB.
Definition: print.cpp:105
PrintSpc
void PrintSpc()
Print space character.
Definition: print.cpp:132
PrintHLine
void PrintHLine(int x, int y, int w)
Print horizontal line into screen, using current color.
Definition: print.cpp:166
PrintSpcRep
void PrintSpcRep(int num)
Print repeated space.
Definition: print.cpp:150
PrintAddPos
void PrintAddPos(int x, int y)
Shift relative print position.
Definition: print.cpp:72
PrintCharRep
void PrintCharRep(char ch, int num)
Print repeated character.
Definition: print.cpp:144
PrintFrame
void PrintFrame(int x, int y, int w, int h)
Print frame, using current color.
Definition: print.cpp:233
PrintHome
void PrintHome()
Move the pointer to the beginning of the first line.
Definition: print.cpp:58
PrintSetCol
void PrintSetCol(u8 col)
Set print color (2x4 bits of colors)
Definition: print.cpp:79
PrintSpcTo
void PrintSpcTo(int pos)
Printing spaces up to the specified position.
Definition: print.cpp:138
PrintSetPos
void PrintSetPos(int x, int y)
Set print position.
Definition: print.cpp:65
PrintChar0
void PrintChar0(char ch)
Print character, not using control characters.
Definition: print.cpp:85
PrintClear
void PrintClear()
Clear the text buffer with the currently selected color.
Definition: print.cpp:39