|
|
1.1 root 1: #ifndef lint
2: static char *rcsid_fill_c = "$Header: fill.c,v 10.2 86/11/25 16:22:07 jg Exp $";
3: #endif lint
4: /* fill.c - Perform a simple raster operation on a section of the screen
5: *
6: * PixFill Do a function on the screen
7: *
8: * Author:
9: * Scott Bates
10: * Brown University
11: * IRIS, Box 1946
12: * Providence, RI 02912
13: *
14: *
15: * Copyright (c) 1986 Brown University
16: *
17: * Permission to use, copy, modify and distribute this software and its
18: * documentation for any purpose and without fee is hereby granted, provided
19: * that the above copyright notice appear in all copies, and that both
20: * that copyright notice and this permission notice appear in supporting
21: * documentation, and that the name of Brown University not be used in
22: * advertising or publicity pertaining to distribution of the software
23: * without specific, written prior permission. Brown University makes no
24: * representations about the suitability of this software for any purpose.
25: * It is provided "as-is" without express or implied warranty.
26: */
27:
28: #include "private.h"
29: #include "bitblt.h"
30:
31: /*
32: * Simple area fill using a mask
33: */
34:
35: /*ARGSUSED*/
36: PixFill (srcpix, xymask, dstx, dsty, width, height, clips, clipcount,
37: func, zmask)
38: register srcpix, dstx, dsty, width, height;
39: int clipcount, zmask, func;
40: BITMAP *xymask;
41: CLIP *clips;
42: {
43: u_short *tile = ConstantTiles[srcpix & 1];
44: u_short *clipmask = NILMASK;
45: register Blt_Rectangle *dest = &DstRect;
46:
47: #ifdef TRACE_X
48: fprintf(stderr, "In PixFill\n");
49: fflush(stderr);
50: #endif TRACE_X
51:
52: /*
53: * Limit fill to one plane
54: */
55:
56: if ((zmask & 1) == 0)
57: return;
58:
59: /*
60: * Clip xymask and destnation rectangle to minimum size
61: */
62:
63: if(xymask) {
64: width = MIN (xymask->width, width);
65: height = MIN (xymask->height, height);
66: clipmask = (u_short *) xymask->data;
67: }
68:
69: /*
70: * Fill in destination rectangle
71: */
72:
73: FillInRect(dstx, dsty, width, height, dest);
74:
75: /*
76: * Fill destination with contstant tile using a mask
77: */
78:
79: CopyBits ((u_short *)tile, NIL, NIL, NILRECT,
80: (u_short *) pbm.data, pbm.width, pbm.height, dest,
81: clipmask, width, height, MAKE_TILE_RULE(func),
82: clipcount, clips);
83: }
84: extern int errno;
85: #include <errno.h>
86:
87: int StippleFill (srcpix, xoff, yoff, stipmask, dstx, dsty, width, height,
88: clips, clipcount, func, zmask)
89: int srcpix; /* source pixel */
90: int xoff, yoff; /* stipple origin */
91: BITMAP *stipmask; /* stipple mask */
92: int dstx, dsty; /* destination */
93: int width, height;
94: CLIP *clips; /* clipping rectangles */
95: int clipcount;
96: int func; /* GX display function */
97: int zmask; /* plane mask */
98: {
99: static char funcmap[16][2] = {
100: {GXandInverted, GXandInverted}, /* GXclear */
101: {GXandInverted, GXnoop}, /* GXand */
102: {GXandInverted, GXxor}, /* GXandReverse */
103: {GXandInverted, GXor}, /* GXcopy */
104: {GXnoop, GXandInverted}, /* GXandInverted */
105: {GXnoop, GXnoop}, /* GXnoop */
106: {GXnoop, GXxor}, /* GXxor */
107: {GXnoop, GXor}, /* GXor */
108: {GXxor, GXandInverted}, /* GXnor */
109: {GXxor, GXnoop}, /* GXequiv */
110: {GXxor, GXxor}, /* GXinvert */
111: {GXxor, GXor}, /* GXorReverse */
112: {GXor, GXandInverted}, /* GXcopyInverted */
113: {GXor, GXnoop}, /* GXorInverted */
114: {GXor, GXxor}, /* GXnand */
115: {GXor, GXor} /* GXset */
116: };
117: int newfunc = funcmap [func][srcpix & 1];
118: PIXMAP *tile, *MakePixmap();
119:
120: if ((stipmask->width != 16) || (stipmask->height != 16)) {
121: errno = EINVAL;
122: return (0);
123: }
124: tile = MakePixmap (stipmask, 1, 0);
125: TileFill (tile, xoff, yoff, 0, dstx, dsty, width, height,
126: clips, clipcount, newfunc, zmask);
127: FreePixmap (tile);
128: return (1);
129: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.