22 static int cmp_double(
const void *aa,
const void *bb)
33 static void fill(
double x0,
double x1,
double y)
35 int yi = (int) floor(y);
36 int xi0 = (int) floor(x0 + 0.5);
37 int xi1 = (int) floor(x1 + 0.5);
58 for (x = xi0; x < xi1; x++)
62 static void line(
const struct vertex *p,
int n,
double y)
69 for (i = 1; i < n; i++) {
70 const struct vertex *p0 = &p[i - 1];
71 const struct vertex *p1 = &p[i];
79 tmp = p0, p0 = p1, p1 = tmp;
87 x = p1->
x * (y - p0->y) + p0->x * (p1->y - y);
92 xs =
G_realloc(xs, max_x *
sizeof(
double));
98 qsort(xs, num_x,
sizeof(
double), cmp_double);
100 for (i = 0; i + 1 < num_x; i += 2)
101 fill(xs[i], xs[i + 1], y);
104 static void poly(
const struct vertex *p,
int n)
114 for (i = 1; i < n; i++) {
131 for (y = floor(y0 + 0.5) + 0.5; y < y1; y++)
GRASS png display driver - header file.
void path_close(struct path *p)
void png_polygon(struct path *p)
Draw polygon.