3 * Copyright 2003, 2004 Develer S.r.l. (http://www.develer.com/)
4 * Copyright 1999 Bernardo Innocenti <bernie@develer.com>
5 * This file is part of DevLib - See devlib/README for information.
9 * \author Bernardo Innocenti <bernie@develer.com>
10 * \author Stefano Fedrigo <aleph@develer.com>
12 * \brief General pourpose graphics routines
17 *#* Revision 1.10 2005/03/01 23:26:45 bernie
18 *#* Use new CPU-neutral program-memory API.
20 *#* Revision 1.9 2005/01/20 18:46:31 aleph
21 *#* Fix progmem includes.
23 *#* Revision 1.8 2004/11/01 15:14:07 bernie
24 *#* Update to current coding conventions.
26 *#* Revision 1.7 2004/09/20 03:29:06 bernie
27 *#* Conditionalize AVR-specific code.
29 *#* Revision 1.6 2004/09/14 21:01:08 bernie
30 *#* Rename rectangle drawing functions; Unify filled/cleared implementations.
32 *#* Revision 1.4 2004/08/10 07:00:16 bernie
33 *#* Add missing header.
35 *#* Revision 1.3 2004/08/04 03:16:59 bernie
36 *#* Switch to new DevLib CONFIG_ convention.
38 *#* Revision 1.2 2004/06/03 11:27:09 bernie
39 *#* Add dual-license information.
41 *#* Revision 1.1 2004/05/23 15:43:16 bernie
42 *#* Import mware modules.
53 /*! Common type for coordinates expressed in pixel units */
56 #if CONFIG_GFX_VCOORDS
57 /*! Common type for coordinates expressed in logical units */
58 typedef float vcoord_t;
59 #endif /* CONFIG_GFX_VCOORDS */
62 typedef struct Rect { coord_t xmin, ymin, xmax, ymax; } Rect;
66 * Control structure to draw in a bitmap
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() */
74 Rect cr; /*!< Clip drawing inside this rectangle */
76 #if CONFIG_GFX_VCOORDS
78 * \name Logical coordinate system
82 vcoord_t scaleX, scaleY;
84 #endif /* CONFIG_GFX_VCOORDS */
89 /* Function prototypes */
90 extern void gfx_bitmapInit (Bitmap *bm, uint8_t *raster, coord_t w, coord_t h);
91 extern void gfx_bitmapClear(Bitmap *bm);
92 extern void gfx_line (Bitmap *bm, coord_t x1, coord_t y1, coord_t x2, coord_t y2);
93 extern void gfx_rectDraw (Bitmap *bm, coord_t x1, coord_t y1, coord_t x2, coord_t y2);
94 extern void gfx_rectFillC (Bitmap *bm, coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t color);
95 extern void gfx_rectFill (Bitmap *bm, coord_t x1, coord_t y1, coord_t x2, coord_t y2);
96 extern void gfx_rectClear (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);
102 #include <mware/pgm.h>
103 extern void gfx_blit_P(Bitmap *bm, const pgm_uint8_t *raster);
107 #if CONFIG_GFX_VCOORDS
108 extern void gfx_setViewRect(Bitmap *bm, vcoord_t x1, vcoord_t y1, vcoord_t x2, vcoord_t y2);
109 extern coord_t gfx_transformX(Bitmap *bm, vcoord_t x);
110 extern coord_t gfx_transformY(Bitmap *bm, vcoord_t y);
111 extern void gfx_vline(Bitmap *bm, vcoord_t x1, vcoord_t y1, vcoord_t x2, vcoord_t y2);
112 #endif /* CONFIG_GFX_VCOORDS */
114 #endif /* MWARE_GFX_H */