BeRTOS
|
00001 00046 #ifndef GFX_TEXT_H 00047 #define GFX_TEXT_H 00048 00049 #include <cfg/compiler.h> 00050 #include <cfg/macros.h> /* BV() */ 00051 #include <cpu/attr.h> /* CPU_HARVARD */ 00052 #include <gfx/gfx.h> /* coord_t */ 00053 00054 #include <stdarg.h> 00055 00061 #define STYLEF_BOLD BV(0) 00062 #define STYLEF_ITALIC BV(1) 00063 #define STYLEF_UNDERLINE BV(2) 00064 #define STYLEF_INVERT BV(3) 00065 #define STYLEF_EXPANDED BV(4) 00066 #define STYLEF_CONDENSED BV(5) 00067 #define STYLEF_STRIKEOUT BV(6) /*<! Not implemented */ 00068 #define STYLEF_TALL BV(7) /*<! Not implemented */ 00069 00070 #define STYLEF_MASK \ 00071 (STYLEF_BOLD | STYLEF_ITALIC | STYLEF_UNDERLINE \ 00072 | STYLEF_INVERT | STYLEF_EXPANDED | STYLEF_CONDENSED \ 00073 | STYLEF_STRIKEOUT | STYLEF_TALL) 00074 /*\}*/ 00075 00081 #define TEXT_NORMAL 0 00082 #define TEXT_FILL BV(13) 00083 #define TEXT_CENTER BV(14) 00084 #define TEXT_RIGHT BV(15) 00085 /*\}*/ 00086 00088 #define ANSI_ESC_CLEARSCREEN 'c' 00089 00090 00091 /* Fwd decl */ 00092 struct Bitmap; 00093 00094 /* Low-level text functions (mware/text.c) */ 00095 void text_moveTo(struct Bitmap *bm, int row, int col); 00096 void text_setCoord(struct Bitmap *bm, int x, int y); 00097 int text_putchar(char c, struct Bitmap *bm); 00098 uint8_t text_style(struct Bitmap *bm, uint8_t flags, uint8_t mask); 00099 void text_clear(struct Bitmap *bm); 00100 void text_clearLine(struct Bitmap *bm, int line); 00101 00102 /* Text formatting functions (mware/text_format.c) */ 00103 int text_puts(const char *str, struct Bitmap *bm); 00104 int text_vprintf(struct Bitmap *bm, const char *fmt, va_list ap); 00105 int text_printf(struct Bitmap *bm, const char *fmt, ...) FORMAT(__printf__, 2, 3); 00106 int text_xyvprintf(struct Bitmap *bm, coord_t x, coord_t y, uint16_t mode, const char *fmt, va_list ap); 00107 int text_xyprintf(struct Bitmap *bm, coord_t x, coord_t col, uint16_t mode, const char *fmt, ...) FORMAT(__printf__, 5, 6); 00108 int text_xprintf(struct Bitmap *bm, uint8_t row, uint8_t col, uint16_t mode, const char *fmt, ...) FORMAT(__printf__, 5, 6); 00109 int text_vwidthf(struct Bitmap *bm, const char * fmt, va_list ap); 00110 int text_widthf(struct Bitmap *bm, const char * fmt, ...) FORMAT(__printf__, 2, 3); 00111 00112 /* Text formatting functions for program-memory strings (mware/text_format.c) */ 00113 #if CPU_HARVARD 00114 #include <cpu/pgm.h> 00115 int text_puts_P(const char * PROGMEM str, struct Bitmap *bm); 00116 int text_vprintf_P(struct Bitmap *bm, const char * PROGMEM fmt, va_list ap); 00117 int text_printf_P(struct Bitmap *bm, const char * PROGMEM fmt, ...) FORMAT(__printf__, 2, 3); 00118 int text_xyvprintf_P(struct Bitmap *bm, coord_t x, coord_t y, uint16_t mode, const char *fmt, va_list ap); 00119 int text_xyprintf_P(struct Bitmap *bm, coord_t x, coord_t col, uint16_t mode, const char *fmt, ...) FORMAT(__printf__, 5, 6); 00120 int text_xprintf_P(struct Bitmap *bm, uint8_t row, uint8_t col, uint16_t mode, const char * PROGMEM fmt, ...) FORMAT(__printf__, 5, 6); 00121 int text_vwidthf_P(struct Bitmap *bm, const char * PROGMEM fmt, va_list ap); 00122 int text_widthf_P(struct Bitmap *bm, const char * PROGMEM fmt, ...); 00123 #endif /* CPU_HARVARD */ 00124 //defgroup text 00126 #endif /* GFX_TEXT_H */