48 #include <grass/raster.h>
49 #include <grass/gis.h>
50 #include <grass/display.h>
52 static int clip(
void);
53 static int line_eq(
int,
int,
int,
int,
int,
int);
55 static int curx, cury;
56 static int left, right, top, bottom;
57 static int x1, y1, x2, y2;
59 static int window_set = 0;
61 #define swap(x,y) {int t; t=x; x=y; y=t;}
62 #define limit(a,x,b) x<a?a:(x>b?b:x)
88 Top =
limit(top, Top, bottom);
89 Bottom =
limit(top, Bottom, bottom);
90 Left =
limit(left, Left, right);
91 Right =
limit(left, Right, right);
246 #define Y(x) line_eq(x,x0,y0,dx,dy,xround)
248 #define X(y) line_eq(y,y0,x0,dy,dx,yround)
251 static int clip(
void)
262 if (x1 < left && x2 < left)
264 if (x1 > right && x2 > right)
267 if (y1 < top && y2 < top)
269 if (y1 > bottom && y2 > bottom)
281 if ((xround = dx / 2) < 0)
283 if ((yround = dy / 2) < 0)
306 if (x1 < left || x1 > right) {
310 x1 = x1 < left ? left : right;
313 if (y1 < top || y1 > bottom) {
317 y1 = y1 < top ? top : bottom;
320 if (x1 < left || x1 > right)
325 if (y1 < top || y1 > bottom) {
328 y1 = y1 < top ? top : bottom;
331 if (x1 < left || x1 > right) {
335 x1 = x1 < left ? left : right;
338 if (y1 < top || y1 > bottom)
344 if (x2 < left || x2 > right) {
348 x2 = x2 < left ? left : right;
351 if (y2 < top || y2 > bottom) {
355 y2 = y2 < top ? top : bottom;
358 if (x2 < left || x2 > right)
363 if (y2 < top || y2 > bottom) {
367 y2 = y2 < top ? top : bottom;
370 if (x2 < left || x2 > right) {
374 x2 = x2 < left ? left : right;
377 if (y2 < top || y2 > bottom)
386 static int line_eq(
int x,
int x0,
int y0,
int dx,
int dy,
int round)
390 if ((t = dy * (x - x0)) < 0)
395 return (y0 + t / dx);
int D_set_clip_window(int Top, int Bottom, int Left, int Right)
set clipping window
int D_cont_rel(int x, int y)
line to x,y
int D_move_abs(int x, int y)
move to pixel
double D_get_d_west(void)
void R_cont_abs(int x, int y)
draw line
double D_get_d_east(void)
double D_get_d_north(void)
void R_move_abs(int x, int y)
move current location
int D_move_rel(int x, int y)
move to pixel
int D_set_clip_window_to_screen_window(void)
set clipping window to screen window
int D_cont_abs(int x, int y)
line to x,y
double D_get_d_south(void)
int D_set_clip_window_to_map_window(void)
set clipping window to map window
int D_get_screen_window(int *t, int *b, int *l, int *r)
retrieve current frame coordinates