gfx.h File Reference
Copyright 2003, 2004, 2005, 2006 Develer S.r.l. More...
#include <cfg/compiler.h>
#include <cpu/attr.h>
#include <appconfig.h>
Go to the source code of this file.
Data Structures | |
| struct | Rect |
| Describe a rectangular area with coordinates expressed in pixels. More... | |
| struct | Bitmap |
| Control structure to draw in a bitmap. More... | |
| struct | Image |
| Hold image pixels. More... | |
Defines | |
| #define | RECT_WIDTH(r) ((r)->xmax - (r)->xmin) |
| Return the width of a rectangle in pixels. | |
| #define | RECT_HEIGHT(r) ((r)->ymax - (r)->ymin) |
| Return the height of a rectangle in pixels. | |
Known pixel formats for bitmap representation. | |
| #define | BITMAP_FMT_PLANAR_H_MSB 1 |
| Planar pixels, horizontal bytes, MSB left. | |
| #define | BITMAP_FMT_PLANAR_V_LSB 2 |
| Planar pixels, vertical bytes, LSB top. | |
Functions | |
| void | gfx_bitmapInit (Bitmap *bm, uint8_t *raster, coord_t w, coord_t h) |
| Initialize a Bitmap structure with the provided parameters. | |
| void | gfx_bitmapClear (Bitmap *bm) |
| Clear the whole bitmap surface to the background color. | |
| void | gfx_blit (Bitmap *dst, const Rect *rect, const Bitmap *src, coord_t srcx, coord_t srcy) |
| Copy a rectangular area of a bitmap on another bitmap. | |
| void | gfx_blitRaster (Bitmap *dst, coord_t dx, coord_t dy, const uint8_t *raster, coord_t w, coord_t h, coord_t stride) |
| Blit a raster to a Bitmap. | |
| void | gfx_blitImage (Bitmap *dst, coord_t dx, coord_t dy, const Image *image) |
| Blit an Image to a Bitmap. | |
| void | gfx_line (Bitmap *bm, coord_t x1, coord_t y1, coord_t x2, coord_t y2) |
| Draw a sloped line segment. | |
| void | gfx_rectDraw (Bitmap *bm, coord_t x1, coord_t y1, coord_t x2, coord_t y2) |
| Draw the perimeter of an hollow rectangle. | |
| void | gfx_rectFillC (Bitmap *bm, coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t color) |
| Fill a rectangular area with color. | |
| void | gfx_rectFill (Bitmap *bm, coord_t x1, coord_t y1, coord_t x2, coord_t y2) |
| Draw a filled rectangle. | |
| void | gfx_rectClear (Bitmap *bm, coord_t x1, coord_t y1, coord_t x2, coord_t y2) |
| Clear a rectangular area. | |
| void | gfx_moveTo (Bitmap *bm, coord_t x, coord_t y) |
| Move the current pen position to the specified coordinates. | |
| void | gfx_lineTo (Bitmap *bm, coord_t x, coord_t y) |
| Draw a line from the current pen position to the new coordinates. | |
Variables | |
| EXTERN_C_BEGIN typedef int | coord_t |
| Common type for coordinates expressed in pixel units. | |
Detailed Description
Copyright 2003, 2004, 2005, 2006 Develer S.r.l.(http://www.develer.com/) Copyright 1999 Bernardo Innocenti <bernie@develer.com>
- Version:
- Id
- gfx.h 930 2007-10-23 14:48:48Z batt
General pourpose graphics routines
Definition in file gfx.h.
Define Documentation
| #define BITMAP_FMT_PLANAR_H_MSB 1 |
| #define BITMAP_FMT_PLANAR_V_LSB 2 |
| #define RECT_HEIGHT | ( | r | ) | ((r)->ymax - (r)->ymin) |
| #define RECT_WIDTH | ( | r | ) | ((r)->xmax - (r)->xmin) |
Function Documentation
| void gfx_bitmapClear | ( | Bitmap * | bm | ) |
Copy a rectangular area of a bitmap on another bitmap.
Blitting is a common copy operation involving two bitmaps. A rectangular area of the source bitmap is copied bit-wise to a different position in the destination bitmap.
- Note:
- Using the same bitmap for src and dst is unsupported.
- Parameters:
-
dst Bitmap where the operation writes. rect The (xmin;ymin) coordinates provide the top/left offset for drawing in the destination bitmap. If the source bitmap is larger than the rectangle, drawing is clipped. src Bitmap containing the source pixels. srcx Starting X offset in the source bitmap. srcy Starting Y offset in the source bitmap.
Draw a sloped line segment.
Draw a sloped line segment identified by the provided start and end coordinates on the bitmap bm.
The line endpoints are clipped inside the current bitmap clipping rectangle using the Cohen-Sutherland algorithm, which is very fast.
- Note:
- The point at coordinates x2 y2 is not drawn.
This function does not update the current pen position.
Draw a line from the current pen position to the new coordinates.
- Note:
- This function moves the current pen position to the new coordinates.
- See also:
- gfx_line()
Move the current pen position to the specified coordinates.
The pen position is used for drawing operations such as gfx_lineTo(), which can be used to draw polygons.
