BeRTOS
Functions
line.c File Reference

Line drawing graphics routines. More...

#include "gfx.h"
#include "gfx_p.h"
#include "cfg/cfg_gfx.h"
#include <cfg/debug.h>
#include <cfg/macros.h>

Go to the source code of this file.

Functions

static void gfx_lineUnclipped (Bitmap *bm, coord_t x1, coord_t y1, coord_t x2, coord_t y2)
 Draw a sloped line without performing clipping.
void gfx_line (Bitmap *bm, coord_t x1, coord_t y1, coord_t x2, coord_t y2)
 Draw a sloped line segment.
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.
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.

Detailed Description

Line drawing graphics routines.

Author:
Bernie Innocenti <bernie@codewiz.org>
Stefano Fedrigo <aleph@develer.com>
See also:
gfx.h

Definition in file line.c.


Function Documentation

void gfx_line ( Bitmap bm,
coord_t  x1,
coord_t  y1,
coord_t  x2,
coord_t  y2 
)

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.

Definition at line 183 of file line.c.

void gfx_lineTo ( Bitmap bm,
coord_t  x,
coord_t  y 
)

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()

Definition at line 263 of file line.c.

static void gfx_lineUnclipped ( Bitmap bm,
coord_t  x1,
coord_t  y1,
coord_t  x2,
coord_t  y2 
) [static]

Draw a sloped line without performing clipping.

Parameters are the same of gfx_line(). This routine is based on the Bresenham Line-Drawing Algorithm.

Note:
Passing coordinates outside the bitmap boundaries will result in memory trashing.
See also:
gfx_line()

Definition at line 70 of file line.c.

void gfx_moveTo ( Bitmap bm,
coord_t  x,
coord_t  y 
)

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.

Definition at line 249 of file line.c.

void gfx_rectClear ( Bitmap bm,
coord_t  x1,
coord_t  y1,
coord_t  x2,
coord_t  y2 
)

Clear a rectangular area.

Note:
The bottom-right border of the rectangle is not cleared.
This function does not update the current pen position.

Definition at line 353 of file line.c.

void gfx_rectDraw ( Bitmap bm,
coord_t  x1,
coord_t  y1,
coord_t  x2,
coord_t  y2 
)

Draw the perimeter of an hollow rectangle.

Note:
The bottom-right corner of the rectangle is drawn at (x2-1;y2-1).
This function does not update the current pen position.

Definition at line 276 of file line.c.

void gfx_rectFill ( Bitmap bm,
coord_t  x1,
coord_t  y1,
coord_t  x2,
coord_t  y2 
)

Draw a filled rectangle.

Note:
The bottom-right border of the rectangle is not drawn.
This function does not update the current pen position.

Definition at line 340 of file line.c.

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.

Note:
The bottom-right border of the rectangle is not drawn.
This function does not update the current pen position.

Definition at line 297 of file line.c.