Merge da SC: macros.h, pool.h, BIT_CHANGE, nome dei processi, etc.
[bertos.git] / mware / charts.h
1 /*!
2  * \file
3  * <!--
4  * Copyright 2004 Develer S.r.l. (http://www.develer.com/)
5  * Copyright 1999, 2000, 2001, 2003 Bernardo Innocenti <bernie@develer.com>
6  * This file is part of DevLib - See devlib/README for information.
7  * -->
8  *
9  * \brief Simple charts on top of mware/gfx routines (interface).
10  *
11  * Configuration:
12  *  - \c CONFIG_CHART_TYPE_X: type for the input dataset of X-coordinates
13  *  - \c CONFIG_CHART_TYPE_Y: type for the input dataset of Y-coordinates
14  *
15  * \version $Id$
16  * \author Bernardo Innocenti <bernie@develer.com>
17  */
18
19 /*
20  * $Log$
21  * Revision 1.3  2004/08/11 19:39:12  bernie
22  * Use chart_x_t and chart_y_t for the input dataset.
23  *
24  * Revision 1.1  2004/08/04 03:16:30  bernie
25  * Import simple chart drawing code.
26  *
27  */
28 #ifndef MWARE_CHARTS_H
29 #define MWARE_CHARTS_H
30
31 #include <mware/gfx.h> /* vcoord_t */
32 #include <config.h> /* CONFIG_ stuff */
33
34 /*!
35  * \name Width/height of the small ticks drawn over the axes
36  * \{
37  */
38 #define TICKS_HEIGHT     2
39 #define TICKS_WIDTH      3
40 /*\}*/
41
42 /*!
43  * \name Chart frame dimensions
44  * \{
45  */
46 #define CHART_BORDERTOP       0
47 #define CHART_BORDERBOTTOM    TICKS_HEIGHT
48 #define CHART_BORDERLEFT      TICKS_WIDTH
49 #define CHART_BORDERRIGHT     0
50 /*\}*/
51
52 /*!
53  * \name Chart size in pixels
54  * \{
55  */
56 #define CHART_WIDTH     (bm->width - CHART_BORDERLEFT - CHART_BORDERRIGHT)
57 #define CHART_HEIGHT    (bm->height  - CHART_BORDERTOP - CHART_BORDERBOTTOM)
58 /*\}*/
59
60 #ifndef CONFIG_CHART_TYPE_X
61 #define CONFIG_CHART_TYPE_X vcoord_t
62 #endif
63 #ifndef CONFIG_CHART_TYPE_Y
64 #define CONFIG_CHART_TYPE_Y vcoord_t
65 #endif
66
67
68 typedef CONFIG_CHART_TYPE_X chart_x_t;
69 typedef CONFIG_CHART_TYPE_Y chart_y_t;
70
71
72 /* Public function protos */
73 extern void chart_init(Bitmap *bm, vcoord_t xmin, vcoord_t ymin, vcoord_t xmax, vcoord_t ymax);
74 extern void chart_drawAxis(Bitmap *bm);
75 extern void chart_drawCurve(Bitmap *bm, const chart_y_t *curve_y, int curve_cnt);
76 extern void chart_drawDots(Bitmap *bm, const chart_x_t *dots_x, const chart_y_t *dots_y, int cnt);
77
78 #endif /* MWARE_CHARTS_H */