|
|
1.1 root 1: /* $Header: fill.c,v 10.5 86/04/04 14:36:44 newman Rel $ */
2: /* fill.c Perform a simple raster operation a section of the screen
3: *
4: * PixFill Do a function on the screen
5: *
6: */
7:
8: /****************************************************************************
9: * *
10: * Copyright (c) 1983, 1984 by *
11: * DIGITAL EQUIPMENT CORPORATION, Maynard, Massachusetts. *
12: * All rights reserved. *
13: * *
14: * This software is furnished on an as-is basis and may be used and copied *
15: * only with inclusion of the above copyright notice. This software or any *
16: * other copies thereof may be provided or otherwise made available to *
17: * others only for non-commercial purposes. No title to or ownership of *
18: * the software is hereby transferred. *
19: * *
20: * The information in this software is subject to change without notice *
21: * and should not be construed as a commitment by DIGITAL EQUIPMENT *
22: * CORPORATION. *
23: * *
24: * DIGITAL assumes no responsibility for the use or reliability of its *
25: * software on equipment which is not supplied by DIGITAL. *
26: * *
27: * *
28: ****************************************************************************/
29:
30: #include "vs100.h"
31:
32: extern BitMap screen;
33: extern int VSReloc;
34: extern char SSMap[];
35:
36: char *AllocateSpace();
37:
38: PixFill (srcpix, xymask, dstx, dsty, width, height, clips, clipcount,
39: func, zmask)
40: int srcpix, dstx, dsty, width, height, clipcount, zmask;
41: register BITMAP *xymask;
42: register int func;
43: CLIP *clips;
44: {
45: register CopyAreaPacket *cap;
46: #define h ((PacketHeader *) cap->cap_head)
47: #define mask ((SubBitmap *) cap->cap_sourceMask)
48: #define size ((Extent *) cap->cap_maskSize)
49: #define destOff ((Point *) cap->cap_destOffset)
50: #define clip ((RectangleList *) cap->cap_clipping.rectList)
51:
52: if (!(zmask & 1)) {
53: DeallocateSpace ();
54: return;
55: }
56: cap = (CopyAreaPacket *) AllocateSpace (sizeof (CopyAreaPacket));
57: if (cap == NULL) return;
58:
59: func = SSMap[func];
60: h->ph_copyMod.m_source = 0;
61: h->ph_copyMod.m_mask = xymask ? 1 : 0;
62: h->ph_copyMod.m_map = MAPTYPE(func);
63: h->ph_opcode = COPY_AREA;
64: *(long *) h->ph_next = NULL;
65:
66: cap->cap_source.const = srcpix & 1;
67:
68: if (xymask) {
69: *(caddr_t *) mask->sb_address = BDATA(xymask)->vsPtr;
70: mask->sb_height = xymask->height;
71: mask->sb_width = xymask->width;
72: mask->sb_bitsPerPixel = 1;
73: mask->sb_x = mask->sb_y = 0;
74: }
75: size->e_height = height;
76: size->e_width = width;
77:
78: *(BitMap *) cap->cap_destImage = screen;
79: destOff->p_x = dstx;
80: destOff->p_y = dsty;
81:
82: *(short *) cap->cap_map.literal = MAPLIT(func);
83:
84: if (clipcount == 1) {
85: h->ph_copyMod.m_clipping = 1;
86: *(CLIP *) cap->cap_clipping.litRect = *clips;
87: } else {
88: h->ph_copyMod.m_clipping = 2;
89: *(caddr_t *) clip->r_first = (caddr_t) clips + VSReloc;
90: clip->r_count = clipcount;
91: }
92:
93: WritePacket ((caddr_t) cap);
94: #undef h
95: #undef mask
96: #undef size
97: #undef destOff
98: #undef clip
99: }
100: extern int errno;
101: #include <errno.h>
102:
103: int StippleFill (srcpix, xoff, yoff, stipmask, dstx, dsty, width, height,
104: clips, clipcount, func, zmask)
105: int srcpix; /* source pixel */
106: int xoff, yoff; /* stipple origin */
107: BITMAP *stipmask; /* stipple mask */
108: int dstx, dsty; /* destination */
109: int width, height;
110: CLIP *clips; /* clipping rectangles */
111: int clipcount;
112: int func; /* GX display function */
113: int zmask; /* plane mask */
114: {
115: static char funcmap[16][2] = {
116: {GXandInverted, GXandInverted}, /* GXclear */
117: {GXandInverted, GXnoop}, /* GXand */
118: {GXandInverted, GXxor}, /* GXandReverse */
119: {GXandInverted, GXor}, /* GXcopy */
120: {GXnoop, GXandInverted}, /* GXandInverted */
121: {GXnoop, GXnoop}, /* GXnoop */
122: {GXnoop, GXxor}, /* GXxor */
123: {GXnoop, GXor}, /* GXor */
124: {GXxor, GXandInverted}, /* GXnor */
125: {GXxor, GXnoop}, /* GXequiv */
126: {GXxor, GXxor}, /* GXinvert */
127: {GXxor, GXor}, /* GXorReverse */
128: {GXor, GXandInverted}, /* GXcopyInverted */
129: {GXor, GXnoop}, /* GXorInverted */
130: {GXor, GXxor}, /* GXnand */
131: {GXor, GXor} /* GXset */
132: };
133: int newfunc = funcmap [func][srcpix & 1];
134: PIXMAP *tile, *MakePixmap();
135:
136: if ((stipmask->width != 16) || (stipmask->height != 16)) {
137: errno = EINVAL;
138: return (0);
139: }
140: tile = MakePixmap (stipmask, 1, 0);
141: TileFill (tile, xoff, yoff, 0, dstx, dsty, width, height,
142: clips, clipcount, newfunc, zmask);
143: FreePixmap (tile);
144: return (1);
145: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.