vg4->misc->line_positions()
Get positions when moving on a line.
SYNTAX
int
vg4->misc->line_positions(const struct VG_Rect *rect_start,
const struct VG_Rect *rect_end,
int stepsize,
struct VG_Rect **rectp)
FUNCTION PARAMETERS
rect_start | Starting position |
rect_end | Ending position |
stepsize | Desired distance in pixels between the positions |
rectp | For returning allocated array with positions, must be freed with free() |
RETURN VALUE
Returns the number of elements in rectp
DESCRIPTION
Get positions when moving on a line.
The positions are set from rect_start (not included) to rect_end (included).
stepsize defines the distance in pixels between the returned positions.
EXAMPLE
/* moving from 10,10 to 20,15 with a distance of 2 */ struct VG_Rect rect_start, rect_end, *rectp; int npos, ipos; rect_start.x = 10; rect_start.y = 10; rect_end.x = 20; rect_end.y = 15; npos = vg4->misc->line_positions(&rect_start, &rect_end, 2, &rectp); for (ipos = 0; ipos < npos; ipos++) { printf("%d,%d\n", rectp[ipos].x, rectp[ipos].y); } if (rectp != NULL) { free(rectp); } /* output: 12,11 14,12 16,13 18,14 20,15 */
SEE ALSO