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