BeRTOS
|
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 | CONFIG_CHART_TYPE_X uint8_t |
Type for the chart dataset. | |
#define | CONFIG_CHART_TYPE_Y uint8_t |
Type for the chart dataset. | |
#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. |
Definition in file gfx.h.
#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) |
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.
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.
Draw a line from the current pen position to the new coordinates.
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.