1 |
dashley |
71 |
/* $Header$ */ |
2 |
|
|
|
3 |
|
|
/* |
4 |
|
|
* xdraw.c -- |
5 |
|
|
* |
6 |
|
|
* This file contains generic procedures related to X drawing |
7 |
|
|
* primitives. |
8 |
|
|
* |
9 |
|
|
* Copyright (c) 1995 Sun Microsystems, Inc. |
10 |
|
|
* |
11 |
|
|
* See the file "license.terms" for information on usage and redistribution |
12 |
|
|
* of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
13 |
|
|
* |
14 |
|
|
* RCS: @(#) $Id: xdraw.c,v 1.1.1.1 2001/06/13 05:15:39 dtashley Exp $ |
15 |
|
|
*/ |
16 |
|
|
|
17 |
|
|
#include "tk.h" |
18 |
|
|
|
19 |
|
|
/* |
20 |
|
|
*---------------------------------------------------------------------- |
21 |
|
|
* |
22 |
|
|
* XDrawLine -- |
23 |
|
|
* |
24 |
|
|
* Draw a single line between two points in a given drawable. |
25 |
|
|
* |
26 |
|
|
* Results: |
27 |
|
|
* None. |
28 |
|
|
* |
29 |
|
|
* Side effects: |
30 |
|
|
* Draws a single line segment. |
31 |
|
|
* |
32 |
|
|
*---------------------------------------------------------------------- |
33 |
|
|
*/ |
34 |
|
|
|
35 |
|
|
void |
36 |
|
|
XDrawLine(display, d, gc, x1, y1, x2, y2) |
37 |
|
|
Display* display; |
38 |
|
|
Drawable d; |
39 |
|
|
GC gc; |
40 |
|
|
int x1, y1, x2, y2; /* Coordinates of line segment. */ |
41 |
|
|
{ |
42 |
|
|
XPoint points[2]; |
43 |
|
|
|
44 |
|
|
points[0].x = x1; |
45 |
|
|
points[0].y = y1; |
46 |
|
|
points[1].x = x2; |
47 |
|
|
points[1].y = y2; |
48 |
|
|
XDrawLines(display, d, gc, points, 2, CoordModeOrigin); |
49 |
|
|
} |
50 |
|
|
|
51 |
|
|
/* |
52 |
|
|
*---------------------------------------------------------------------- |
53 |
|
|
* |
54 |
|
|
* XFillRectangle -- |
55 |
|
|
* |
56 |
|
|
* Fills a rectangular area in the given drawable. This procedure |
57 |
|
|
* is implemented as a call to XFillRectangles. |
58 |
|
|
* |
59 |
|
|
* Results: |
60 |
|
|
* None |
61 |
|
|
* |
62 |
|
|
* Side effects: |
63 |
|
|
* Fills the specified rectangle. |
64 |
|
|
* |
65 |
|
|
*---------------------------------------------------------------------- |
66 |
|
|
*/ |
67 |
|
|
|
68 |
|
|
void |
69 |
|
|
XFillRectangle(display, d, gc, x, y, width, height) |
70 |
|
|
Display* display; |
71 |
|
|
Drawable d; |
72 |
|
|
GC gc; |
73 |
|
|
int x; |
74 |
|
|
int y; |
75 |
|
|
unsigned int width; |
76 |
|
|
unsigned int height; |
77 |
|
|
{ |
78 |
|
|
XRectangle rectangle; |
79 |
|
|
rectangle.x = x; |
80 |
|
|
rectangle.y = y; |
81 |
|
|
rectangle.width = width; |
82 |
|
|
rectangle.height = height; |
83 |
|
|
XFillRectangles(display, d, gc, &rectangle, 1); |
84 |
|
|
} |
85 |
|
|
|
86 |
|
|
/* End of xdraw.c */ |