3 * Copyright 2003, 2004, 2005 Develer S.r.l. (http://www.develer.com/)
4 * Copyright 1999 Bernardo Innocenti <bernie@develer.com>
5 * This file is part of DevLib - See README.devlib 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.4 2006/01/16 03:30:57 bernie
18 *#* Make header C++ friendly.
20 *#* Revision 1.3 2005/11/27 23:33:40 bernie
21 *#* Use appconfig.h instead of cfg/config.h.
23 *#* Revision 1.2 2005/11/04 18:17:45 bernie
24 *#* Fix header guards and includes for new location of gfx module.
26 *#* Revision 1.1 2005/11/04 18:11:35 bernie
27 *#* Move graphics stuff from mware/ to gfx/.
29 *#* Revision 1.12 2005/11/04 16:20:02 bernie
30 *#* Fix reference to README.devlib in header.
32 *#* Revision 1.11 2005/04/11 19:10:28 bernie
33 *#* Include top-level headers from cfg/ subdir.
35 *#* Revision 1.10 2005/03/01 23:26:45 bernie
36 *#* Use new CPU-neutral program-memory API.
38 *#* Revision 1.9 2005/01/20 18:46:31 aleph
39 *#* Fix progmem includes.
45 #include <appconfig.h>
46 #include <cfg/compiler.h>
51 /*! Common type for coordinates expressed in pixel units */
54 #if CONFIG_GFX_VCOORDS
55 /*! Common type for coordinates expressed in logical units */
56 typedef float vcoord_t;
57 #endif /* CONFIG_GFX_VCOORDS */
60 typedef struct Rect { coord_t xmin, ymin, xmax, ymax; } Rect;
64 * Control structure to draw in a bitmap
68 uint8_t *raster; /*!< Pointer to byte array to hold the data */
69 coord_t width, height; /*!< Width/Height in pixels */
70 coord_t penX, penY; /*!< Current pen position MoveTo()/LineTo() */
72 Rect cr; /*!< Clip drawing inside this rectangle */
74 #if CONFIG_GFX_VCOORDS
76 * \name Logical coordinate system
80 vcoord_t scaleX, scaleY;
82 #endif /* CONFIG_GFX_VCOORDS */
87 /* Function prototypes */
88 extern void gfx_bitmapInit (Bitmap *bm, uint8_t *raster, coord_t w, coord_t h);
89 extern void gfx_bitmapClear(Bitmap *bm);
90 extern void gfx_line (Bitmap *bm, coord_t x1, coord_t y1, coord_t x2, coord_t y2);
91 extern void gfx_rectDraw (Bitmap *bm, coord_t x1, coord_t y1, coord_t x2, coord_t y2);
92 extern void gfx_rectFillC (Bitmap *bm, coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t color);
93 extern void gfx_rectFill (Bitmap *bm, coord_t x1, coord_t y1, coord_t x2, coord_t y2);
94 extern void gfx_rectClear (Bitmap *bm, coord_t x1, coord_t y1, coord_t x2, coord_t y2);
95 extern void gfx_moveTo (Bitmap *bm, coord_t x, coord_t y);
96 extern void gfx_lineTo (Bitmap *bm, coord_t x, coord_t y);
97 extern void gfx_setClipRect(Bitmap *bm, coord_t xmin, coord_t ymin, coord_t xmax, coord_t ymax);
100 #include <mware/pgm.h>
101 extern void gfx_blit_P(Bitmap *bm, const pgm_uint8_t *raster);
105 #if CONFIG_GFX_VCOORDS
106 extern void gfx_setViewRect(Bitmap *bm, vcoord_t x1, vcoord_t y1, vcoord_t x2, vcoord_t y2);
107 extern coord_t gfx_transformX(Bitmap *bm, vcoord_t x);
108 extern coord_t gfx_transformY(Bitmap *bm, vcoord_t y);
109 extern void gfx_vline(Bitmap *bm, vcoord_t x1, vcoord_t y1, vcoord_t x2, vcoord_t y2);
110 #endif /* CONFIG_GFX_VCOORDS */
114 #endif /* GFX_GFX_H */