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.6 2004/09/14 21:01:08 bernie
18 *#* Rename rectangle drawing functions; Unify filled/cleared implementations.
20 *#* Revision 1.4 2004/08/10 07:00:16 bernie
21 *#* Add missing header.
23 *#* Revision 1.3 2004/08/04 03:16:59 bernie
24 *#* Switch to new DevLib CONFIG_ convention.
26 *#* Revision 1.2 2004/06/03 11:27:09 bernie
27 *#* Add dual-license information.
29 *#* Revision 1.1 2004/05/23 15:43:16 bernie
30 *#* Import mware modules.
40 /*! Common type for coordinates expressed in pixel units */
43 #if CONFIG_GFX_VCOORDS
44 /*! Common type for coordinates expressed in logical units */
45 typedef float vcoord_t;
46 #endif /* CONFIG_GFX_VCOORDS */
49 typedef struct Rect { coord_t xmin, ymin, xmax, ymax; } Rect;
53 * Control structure to draw in a bitmap
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() */
61 Rect cr; /*!< Clip drawing inside this rectangle */
63 #if CONFIG_GFX_VCOORDS
65 * \name Logical coordinate system
69 vcoord_t scaleX, scaleY;
71 #endif /* CONFIG_GFX_VCOORDS */
76 /* Function prototypes */
77 extern void gfx_InitBitmap(Bitmap *bm, uint8_t *raster, coord_t w, coord_t h);
78 extern void gfx_ClearBitmap(Bitmap *bm);
79 extern void gfx_blitBitmap_P(Bitmap *bm, const prog_uchar *raster);
80 extern void gfx_DrawLine(Bitmap *bm, coord_t x1, coord_t y1, coord_t x2, coord_t y2);
81 extern void gfx_RectDraw(Bitmap *bm, coord_t x1, coord_t y1, coord_t x2, coord_t y2);
82 extern void gfx_RectFillC(Bitmap *bm, coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t color);
83 extern void gfx_RectFill(Bitmap *bm, coord_t x1, coord_t y1, coord_t x2, coord_t y2);
84 extern void gfx_RectClear(Bitmap *bm, coord_t x1, coord_t y1, coord_t x2, coord_t y2);
85 extern void gfx_MoveTo(Bitmap *bm, coord_t x, coord_t y);
86 extern void gfx_LineTo(Bitmap *bm, coord_t x, coord_t y);
87 extern void gfx_SetClipRect(Bitmap *bm, coord_t xmin, coord_t ymin, coord_t xmax, coord_t ymax);
89 /* DEPRECATED names */
90 #define gfx_DrawRect gfx_RectDraw
91 #define gfx_FillRect gfx_RectFill
92 #define gfx_ClearRect gfx_RectClear
94 #if CONFIG_GFX_VCOORDS
95 extern void gfx_SetViewRect(Bitmap *bm, vcoord_t x1, vcoord_t y1, vcoord_t x2, vcoord_t y2);
96 extern coord_t gfx_TransformX(Bitmap *bm, vcoord_t x);
97 extern coord_t gfx_TransformY(Bitmap *bm, vcoord_t y);
98 extern void gfx_VDrawLine(Bitmap *bm, vcoord_t x1, vcoord_t y1, vcoord_t x2, vcoord_t y2);
99 #endif /* CONFIG_GFX_VCOORDS */
101 #endif /* MWARE_GFX_H */