|
|
1.1 root 1: /* $Header: bitblt.h,v 10.1 86/11/19 10:45:27 jg Exp $ */
2: /* bitblt.h - typedefs, macros, and constants required to
3: * interface to bitblt()
4: *
5: * Author:
6: * Scott Bates
7: * Brown University
8: * IRIS, Box 1946
9: * Providence, RI 02912
10: *
11: *
12: * Copyright (c) 1986 Brown University
13: *
14: * Permission to use, copy, modify and distribute this software and its
15: * documentation for any purpose and without fee is hereby granted, provided
16: * that the above copyright notice appear in all copies, and that both
17: * that copyright notice and this permission notice appear in supporting
18: * documentation, and that the name of Brown University not be used in
19: * advertising or publicity pertaining to distribution of the software
20: * without specific, written prior permission. Brown University makes no
21: * representations about the suitability of this software for any purpose.
22: * It is provided "as-is" without express or implied warranty.
23: */
24:
25: #include "../bitblt/bitblt_ext.h"
26:
27: /*
28: * Line structure
29: */
30:
31: typedef struct {
32: short StartX;
33: short StartY;
34: short StopX;
35: short StopY;
36: short BrushX;
37: short BrushY;
38: u_short Pattern;
39: short PatternLength;
40: short PatternMultiplier;
41: short DrawMode;
42: Blt_Tile *AlternateTile;
43: Blt blt;
44: }Blt_Line;
45:
46: /*
47: * Macros to determine if the given rule refers to a tile
48: * or a source bitmap.
49: */
50:
51: #define IS_RULE_SRC(rule) ((rule) <= GXset)
52: #define IS_RULE_TILE(rule) (!IS_RULE_SRC(rule))
53:
54: /*
55: * macros to convert combination rules
56: *
57: * NOTE: These Macros depend on the order of the rules above.
58: */
59:
60: #define MAKE_TILE_RULE(src_rule) ((src_rule) + GXset + 1)
61: #define MAKE_SRC_RULE(tile_rule) ((tile_rule) - GXset - 1)
62:
63: /*
64: * Macros for fast min/max.
65: */
66:
67: #define MIN(a,b) (((a) < (b)) ? (a) : (b))
68: #define MAX(a,b) (((a) > (b)) ? (a) : (b))
69:
70: /*
71: * misc constants
72: */
73:
74: #define TRUE 1
75: #define FALSE 0
76:
77: /*
78: * macros used to fill in blt structure for bitblt()
79: */
80:
81: #define BitimageToBitmap(bitimage, x, y, width, height, bitmap) \
82: { \
83: (bitmap)->base = bitimage; \
84: (bitmap)->rect.origin_y = y; \
85: (bitmap)->rect.origin_x = x; \
86: (bitmap)->rect.corner_y = y + height; \
87: (bitmap)->rect.corner_x = x + width; \
88: (bitmap)->nshorts = ((width) + 15) / 16; \
89: }
90:
91: #define ClipToRect(clip, rect) \
92: { \
93: (rect)->origin_y = (clip)->top; \
94: (rect)->origin_x = (clip)->left; \
95: (rect)->corner_y = (clip)->top + (clip)->height; \
96: (rect)->corner_x = (clip)->left + (clip)->width; \
97: }
98:
99: #define FillInRect(x, y, width, height, rect) \
100: { \
101: (rect)->origin_y = y; \
102: (rect)->origin_x = x; \
103: (rect)->corner_y = (y) + (height); \
104: (rect)->corner_x = (x) + (width); \
105: }
106:
107: /*
108: * test if rectangle one lies within the bounds of rectangle two
109: */
110:
111: #define InsideBounds(rect1, rect2) \
112: (((rect1)->origin_x >= (rect2)->origin_x && \
113: (rect1)->origin_x <= (rect2)->corner_x && \
114: (rect1)->origin_y >= (rect2)->origin_y && \
115: (rect1)->origin_y <= (rect2)->corner_y) && \
116: ((rect1)->corner_x >= (rect2)->origin_x && \
117: (rect1)->corner_x <= (rect2)->corner_x && \
118: (rect1)->corner_y >= (rect2)->origin_y && \
119: (rect1)->corner_y <= (rect2)->corner_y))
120:
121: /*
122: * NILS
123: */
124:
125: #define NILRECT ((Blt_Rectangle *) 0)
126: #define NILCLIP ((CLIP *) 0)
127: #define NILBITMAP ((BITMAP *) 0)
128: #define NILMASK ((u_short *) 0)
129: #define NILBITS ((u_short *) 0)
130: #define NIL 0
131:
132: /*
133: * Externs and statics used to interface to bitblt()
134: */
135:
136: static Blt_Rectangle SrcRect;
137: static Blt_Rectangle DstRect;
138: static Blt bltdata;
139: extern Blt_Rectangle changed_rect;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.