Fix Doxygen markup and indentation.
[bertos.git] / mware / gfx.h
1 /*!
2  * \file
3  * Copyright (C) 2003,2004 Develer S.r.l. (http://www.develer.com/)
4  * Copyright (C) 1999 Bernardo Innocenti <bernie@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 General pourpose graphics routines
13  */
14
15 /*#*
16  *#* $Log$
17  *#* Revision 1.5  2004/08/25 14:12:09  rasky
18  *#* Aggiornato il comment block dei log RCS
19  *#*
20  *#* Revision 1.4  2004/08/10 07:00:16  bernie
21  *#* Add missing header.
22  *#*
23  *#* Revision 1.3  2004/08/04 03:16:59  bernie
24  *#* Switch to new DevLib CONFIG_ convention.
25  *#*
26  *#* Revision 1.2  2004/06/03 11:27:09  bernie
27  *#* Add dual-license information.
28  *#*
29  *#* Revision 1.1  2004/05/23 15:43:16  bernie
30  *#* Import mware modules.
31  *#*
32  *#* Revision 1.4  2004/02/09 00:21:28  aleph
33  *#* Various gfx fixes
34  *#*
35  *#* Revision 1.3  2004/01/27 23:24:19  aleph
36  *#* Add new graphics primitives
37  *#*
38  *#* Revision 1.2  2004/01/07 23:33:01  aleph
39  *#* Change copyright email
40  *#*
41  *#* Revision 1.1  2004/01/07 19:05:31  aleph
42  *#* Add graphics routines
43  *#*
44  *#*/
45
46 #ifndef MWARE_GFX_H
47 #define MWARE_GFX_H
48
49 #include <compiler.h>
50 #include <config.h>
51
52
53 /*! Common type for coordinates expressed in pixel units */
54 typedef int coord_t;
55
56 #if CONFIG_GFX_VCOORDS
57 /*! Common type for coordinates expressed in logical units */
58 typedef float vcoord_t;
59 #endif /* CONFIG_GFX_VCOORDS */
60
61
62 typedef struct Rect { coord_t xmin, ymin, xmax, ymax; } Rect;
63
64
65 /*!
66  * Control structure to draw in a bitmap
67  */
68 typedef struct Bitmap
69 {
70         uint8_t *raster;        /*!< Pointer to byte array to hold the data */
71         coord_t width, height;  /*!< Width/Height in pixels */
72         coord_t penX, penY;     /*!< Current pen position MoveTo()/LineTo() */
73
74         Rect cr;                /*!< Clip drawing inside this rectangle */
75
76 #if CONFIG_GFX_VCOORDS
77         /*!
78          * \name Logical coordinate system
79          * \{
80          */
81         vcoord_t orgX, orgY;
82         vcoord_t scaleX, scaleY;
83         /*\}*/
84 #endif /* CONFIG_GFX_VCOORDS */
85
86 } Bitmap;
87
88
89 /* Function prototypes */
90 extern void gfx_InitBitmap(Bitmap *bm, uint8_t *raster, coord_t w, coord_t h);
91 extern void gfx_ClearBitmap(Bitmap *bm);
92 extern void gfx_blitBitmap_P(Bitmap *bm, const prog_uchar *raster);
93 extern void gfx_DrawLine(Bitmap *bm, coord_t x1, coord_t y1, coord_t x2, coord_t y2);
94 extern void gfx_FillRect(Bitmap *bm, coord_t x1, coord_t y1, coord_t x2, coord_t y2);
95 extern void gfx_DrawRect(Bitmap *bm, coord_t x1, coord_t y1, coord_t x2, coord_t y2);
96 extern void gfx_ClearRect(Bitmap *bm, coord_t x1, coord_t y1, coord_t x2, coord_t y2);
97 extern void gfx_MoveTo(Bitmap *bm, coord_t x, coord_t y);
98 extern void gfx_LineTo(Bitmap *bm, coord_t x, coord_t y);
99 extern void gfx_SetClipRect(Bitmap *bm, coord_t xmin, coord_t ymin, coord_t xmax, coord_t ymax);
100
101 #if CONFIG_GFX_VCOORDS
102 extern void gfx_SetViewRect(Bitmap *bm, vcoord_t x1, vcoord_t y1, vcoord_t x2, vcoord_t y2);
103 extern coord_t gfx_TransformX(Bitmap *bm, vcoord_t x);
104 extern coord_t gfx_TransformY(Bitmap *bm, vcoord_t y);
105 extern void gfx_VDrawLine(Bitmap *bm, vcoord_t x1, vcoord_t y1, vcoord_t x2, vcoord_t y2);
106 #endif /* CONFIG_GFX_VCOORDS */
107
108 #endif /* MWARE_GFX_H */