Add dual-license information.
[bertos.git] / mware / text.h
1 /*!
2  * \file
3  * Copyright 1999 Bernardo Innocenti <bernie@develer.com>
4  * Copyright 2003,2004 Develer S.r.l. (http://www.develer.com/)
5  * This file is part of DevLib - See devlib/README for information.
6  *
7  * \version $Id$
8  *
9  * \author Bernardo Innocenti <bernie@develer.com>
10  * \author Stefano Fedrigo <aleph@develer.com>
11  *
12  * \brief Text graphic routines
13  */
14
15 /*
16  * $Log$
17  * Revision 1.2  2004/06/03 11:27:09  bernie
18  * Add dual-license information.
19  *
20  */
21
22 #ifndef TEXT_H
23 #define TEXT_H
24
25 #include "compiler.h"
26 #include <stdarg.h>
27
28 /* Style flags */
29 #define STYLEF_BOLD        BV(0)
30 #define STYLEF_ITALIC      BV(1)
31 #define STYLEF_UNDERLINE   BV(2)
32 #define STYLEF_INVERT      BV(3)
33 #define STYLEF_EXPANDED    BV(4)
34 #define STYLEF_CONDENSED   BV(5)
35 #define STYLEF_STRIKEOUT   BV(6)  /* Not implemented */
36
37 #define STYLEF_MASK \
38         (STYLEF_BOLD | STYLEF_ITALIC | STYLEF_UNDERLINE | \
39         STYLEF_EXPANDED | STYLEF_CONDENSED | STYLEF_INVERT)
40
41 /* Flags for text_xprintf() */
42 #define TEXT_NORMAL   0       /*!< Normal mode */
43 #define TEXT_FILL     BV(0)   /*!< Fill rest of line with spaces */
44 #define TEXT_CENTER   BV(1)   /*!< Center string in line */
45 #define TEXT_INVERT   BV(2)   /*!< Inverted mode */
46 #define TEXT_RIGHT    BV(3)   /*!< Right aligned */
47
48 /* Escape sequences codes */
49 #define ANSI_ESC_CLEARSCREEN 'c'
50
51
52
53 /* Fwd decl */
54 struct Bitmap;
55
56 void text_moveto(struct Bitmap *bm, int row, int col);
57 void text_setcoord(struct Bitmap *bm, int x, int y);
58 int text_putchar(char c, struct Bitmap *bm);
59 int text_puts(const char *str, struct Bitmap *bm);
60 int text_vprintf(struct Bitmap *bm, const char *fmt, va_list ap);
61 int text_printf(struct Bitmap *bm, const char *fmt, ...) FORMAT(__printf__, 2, 3);
62 int text_xprintf(struct Bitmap *bm, uint8_t row, uint8_t col, uint8_t mode, const char *fmt, ...) FORMAT(__printf__, 5, 6);
63 uint8_t text_style(uint8_t flags, uint8_t mask);
64 void text_clear(struct Bitmap *bm);
65
66 int text_puts_P(const char * PROGMEM str, struct Bitmap *bm);
67 int text_vprintf_P(struct Bitmap *bm, const char * PROGMEM fmt, va_list ap);
68 int text_printf_P(struct Bitmap *bm, const char * PROGMEM fmt, ...) FORMAT(__printf__, 2, 3);
69 int text_xprintf_P(struct Bitmap *bm, uint8_t row, uint8_t col, uint8_t mode, const char * PROGMEM fmt, ...) FORMAT(__printf__, 5, 6);
70
71 #endif /* TEXT_H */