Trim CVS logs and cleanup header info.
[bertos.git] / mware / gfx.h
1 /*!
2  * \file
3  * Copyright (C) 1999 Bernardo Innocenti <bernie@develer.com>
4  * Copyright (C) 2003 Develer S.r.l. (http://www.develer.com/)
5  * All Rights Reserved.
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.1  2004/05/23 15:43:16  bernie
18  * Import mware modules.
19  *
20  * Revision 1.4  2004/02/09 00:21:28  aleph
21  * Various gfx fixes
22  *
23  * Revision 1.3  2004/01/27 23:24:19  aleph
24  * Add new graphics primitives
25  *
26  * Revision 1.2  2004/01/07 23:33:01  aleph
27  * Change copyright email
28  *
29  * Revision 1.1  2004/01/07 19:05:31  aleph
30  * Add graphics routines
31  *
32  */
33
34 #ifndef GFX_H
35 #define GFX_H
36
37 #include "compiler.h"
38 #include <avr/pgmspace.h>
39
40
41 /*! Common type for coordinates expressed in pixel units */
42 typedef int coord_t;
43
44 #ifdef CONFIG_LCD_VCOORDS
45 /*! Common type for coordinates expressed in logical units */
46 typedef float vcoord_t;
47 #endif /* CONFIG_LCD_VCOORDS */
48
49
50 typedef struct Rect { coord_t xmin, ymin, xmax, ymax; } Rect;
51
52
53 /*! Control structure to draw in a bitmap */
54
55 typedef struct Bitmap
56 {
57         uint8_t *raster;        /*!< Pointer to byte array to hold the data */
58         coord_t width, height;  /*!< Width/Height in pixels */
59         coord_t penX, penY;     /*!< Current pen position MoveTo()/LineTo() */
60
61         Rect cr;                /*!< Clip drawing inside this rectangle */
62
63 #ifdef CONFIG_LCD_VCOORDS
64         /*! Logical coordinate system */
65         vcoord_t orgX, orgY;
66         vcoord_t scaleX, scaleY;
67 #endif /* CONFIG_LCD_VCOORDS */
68
69 } Bitmap;
70
71
72 /* Function prototypes */
73 extern void gfx_InitBitmap(Bitmap *bm, uint8_t *raster, coord_t w, coord_t h);
74 extern void gfx_ClearBitmap(Bitmap *bm);
75 extern void gfx_blitBitmap_P(Bitmap *bm, const prog_uchar *raster);
76 extern void gfx_DrawLine(Bitmap *bm, coord_t x1, coord_t y1, coord_t x2, coord_t y2);
77 extern void gfx_FillRect(Bitmap *bm, coord_t x1, coord_t y1, coord_t x2, coord_t y2);
78 extern void gfx_DrawRect(Bitmap *bm, coord_t x1, coord_t y1, coord_t x2, coord_t y2);
79 extern void gfx_ClearRect(Bitmap *bm, coord_t x1, coord_t y1, coord_t x2, coord_t y2);
80 extern void gfx_MoveTo(Bitmap *bm, coord_t x, coord_t y);
81 extern void gfx_LineTo(Bitmap *bm, coord_t x, coord_t y);
82 extern void gfx_SetClipRect(Bitmap *bm, coord_t xmin, coord_t ymin, coord_t xmax, coord_t ymax);
83
84 #ifdef CONFIG_LCD_VCOORDS
85 extern void gfx_SetViewRect(Bitmap *bm, vcoord_t x1, vcoord_t y1, vcoord_t x2, vcoord_t y2);
86 extern coord_t gfx_TransformX(Bitmap *bm, vcoord_t x);
87 extern coord_t gfx_TransformY(Bitmap *bm, vcoord_t y);
88 extern void gfx_VDrawLine(Bitmap *bm, vcoord_t x1, vcoord_t y1, vcoord_t x2, vcoord_t y2);
89 #endif /* CONFIG_LCD_VCOORDS */
90
91 #endif /* GFX_H */