00001
00043 #ifndef GFX_TEXT_H
00044 #define GFX_TEXT_H
00045
00046 #include <cfg/compiler.h>
00047 #include <cfg/macros.h>
00048 #include <cpu/attr.h>
00049 #include <gfx/gfx.h>
00050
00051 #include <stdarg.h>
00052
00058 #define STYLEF_BOLD BV(0)
00059 #define STYLEF_ITALIC BV(1)
00060 #define STYLEF_UNDERLINE BV(2)
00061 #define STYLEF_INVERT BV(3)
00062 #define STYLEF_EXPANDED BV(4)
00063 #define STYLEF_CONDENSED BV(5)
00064 #define STYLEF_STRIKEOUT BV(6)
00065 #define STYLEF_TALL BV(7)
00066
00067 #define STYLEF_MASK \
00068 (STYLEF_BOLD | STYLEF_ITALIC | STYLEF_UNDERLINE \
00069 | STYLEF_INVERT | STYLEF_EXPANDED | STYLEF_CONDENSED \
00070 | STYLEF_STRIKEOUT | STYLEF_TALL)
00071
00072
00078 #define TEXT_NORMAL 0
00079 #define TEXT_FILL BV(13)
00080 #define TEXT_CENTER BV(14)
00081 #define TEXT_RIGHT BV(15)
00082
00083
00085 #define ANSI_ESC_CLEARSCREEN 'c'
00086
00087
00088
00089 struct Bitmap;
00090
00091
00092 void text_moveTo(struct Bitmap *bm, int row, int col);
00093 void text_setCoord(struct Bitmap *bm, int x, int y);
00094 int text_putchar(char c, struct Bitmap *bm);
00095 uint8_t text_style(struct Bitmap *bm, uint8_t flags, uint8_t mask);
00096 void text_clear(struct Bitmap *bm);
00097 void text_clearLine(struct Bitmap *bm, int line);
00098
00099
00100 int text_puts(const char *str, struct Bitmap *bm);
00101 int text_vprintf(struct Bitmap *bm, const char *fmt, va_list ap);
00102 int text_printf(struct Bitmap *bm, const char *fmt, ...) FORMAT(__printf__, 2, 3);
00103 int text_xyvprintf(struct Bitmap *bm, coord_t x, coord_t y, uint16_t mode, const char *fmt, va_list ap);
00104 int text_xyprintf(struct Bitmap *bm, coord_t x, coord_t col, uint16_t mode, const char *fmt, ...) FORMAT(__printf__, 5, 6);
00105 int text_xprintf(struct Bitmap *bm, uint8_t row, uint8_t col, uint16_t mode, const char *fmt, ...) FORMAT(__printf__, 5, 6);
00106 int text_vwidthf(struct Bitmap *bm, const char * fmt, va_list ap);
00107 int text_widthf(struct Bitmap *bm, const char * fmt, ...) FORMAT(__printf__, 2, 3);
00108
00109
00110 #if CPU_HARVARD
00111 #include <cpu/pgm.h>
00112 int text_puts_P(const char * PROGMEM str, struct Bitmap *bm);
00113 int text_vprintf_P(struct Bitmap *bm, const char * PROGMEM fmt, va_list ap);
00114 int text_printf_P(struct Bitmap *bm, const char * PROGMEM fmt, ...) FORMAT(__printf__, 2, 3);
00115 int text_xyvprintf_P(struct Bitmap *bm, coord_t x, coord_t y, uint16_t mode, const char *fmt, va_list ap);
00116 int text_xyprintf_P(struct Bitmap *bm, coord_t x, coord_t col, uint16_t mode, const char *fmt, ...) FORMAT(__printf__, 5, 6);
00117 int text_xprintf_P(struct Bitmap *bm, uint8_t row, uint8_t col, uint16_t mode, const char * PROGMEM fmt, ...) FORMAT(__printf__, 5, 6);
00118 int text_vwidthf_P(struct Bitmap *bm, const char * PROGMEM fmt, va_list ap);
00119 int text_widthf_P(struct Bitmap *bm, const char * PROGMEM fmt, ...);
00120 #endif
00121
00122 #endif