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