2 * Copyright 2008 Maarten Maathuis
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
18 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
19 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 /* Ternary Raster Operations as defined by GDI
34 * The notation is reverse polish.
36 * ROP_PDSonon: !(P | !(D | S))
40 #define ROP_DPSoon 0x01
41 #define ROP_DPSona 0x02
43 #define ROP_SDPona 0x04
45 #define ROP_PDSxnon 0x06
46 #define ROP_PDSaon 0x07
47 #define ROP_SDPnaa 0x08
48 #define ROP_PDSxon 0x09
50 #define ROP_PSDnaon 0x0B
52 #define ROP_PDSnaon 0x0D
53 #define ROP_PDSonon 0x0E
55 #define ROP_PDSona 0x10
57 #define ROP_SDPxnon 0x12
58 #define ROP_SDPaon 0x13
59 #define ROP_DPSxnon 0x14
60 #define ROP_DPSaon 0x15
61 #define ROP_PSDPSanaxx 0x16
62 #define ROP_SSPxDSxaxn 0x17
63 #define ROP_SPxPDxa 0x18
64 #define ROP_SDPSanaxn 0x19
65 #define ROP_PDSPaox 0x1A
66 #define ROP_SDPSxaxn 0x1B
67 #define ROP_PSDPaox 0x1C
68 #define ROP_DSPDxaxn 0x1D
69 #define ROP_PDSox 0x1E
70 #define ROP_PDSoan 0x1F
71 #define ROP_DPSnaa 0x20
72 #define ROP_SDPxon 0x21
74 #define ROP_SPDnaon 0x23
75 #define ROP_SPxDSxa 0x24
76 #define ROP_PDSPanaxn 0x25
77 #define ROP_SDPSaox 0x26
78 #define ROP_SDPSxnox 0x27
79 #define ROP_DPSxa 0x28
80 #define ROP_PSDPSaoxxn 0x29
81 #define ROP_DPSana 0x2A
82 #define ROP_SSPxPDxaxn 0x2B
83 #define ROP_SPDSoax 0x2C
84 #define ROP_PSDnox 0x2D
85 #define ROP_PSDPxox 0x2E
86 #define ROP_PSDnoan 0x2F
88 #define ROP_SDPnaon 0x31
89 #define ROP_SDPSoox 0x32
91 #define ROP_SPDSaox 0x34
92 #define ROP_SPDSxnox 0x35
93 #define ROP_SDPox 0x36
94 #define ROP_SDPoan 0x37
95 #define ROP_PSDPoax 0x38
96 #define ROP_SPDnox 0x39
97 #define ROP_SPDSxox 0x3A
98 #define ROP_SPDnoan 0x3B
100 #define ROP_SPDSonox 0x3D
101 #define ROP_SPDSnaox 0x3E
102 #define ROP_PSan 0x3F
103 #define ROP_PSDnaa 0x40
104 #define ROP_DPSxon 0x41
105 #define ROP_SDxPDxa 0x42
106 #define ROP_SPDSanaxn 0x43
107 #define ROP_SDna 0x44
108 #define ROP_DPSnaon 0x45
109 #define ROP_DSPDaox 0x46
110 #define ROP_PSDPxaxn 0x47
111 #define ROP_SDPxa 0x48
112 #define ROP_PDSPDaoxxn 0x49
113 #define ROP_DPSDoax 0x4A
114 #define ROP_PDSnox 0x4B
115 #define ROP_SDPana 0x4C
116 #define ROP_SSPxDSxoxn 0x4D
117 #define ROP_PDSPxox 0x4E
118 #define ROP_PDSnoan 0x4F
119 #define ROP_PDna 0x50
120 #define ROP_DSPnaon 0x51
121 #define ROP_DPSDaox 0x52
122 #define ROP_SPDSxaxn 0x53
123 #define ROP_DPSonon 0x54
125 #define ROP_DPSox 0x56
126 #define ROP_DPSoan 0x57
127 #define ROP_PDSPoax 0x58
128 #define ROP_DPSnox 0x59
130 #define ROP_DPSDonox 0x5B
131 #define ROP_DPSDxox 0x5C
132 #define ROP_DPSnoan 0x5D
133 #define ROP_DPSDnaox 0x5E
134 #define ROP_DPan 0x5F
135 #define ROP_PDSxa 0x60
136 #define ROP_DSPDSaoxxn 0x61
137 #define ROP_DSPDoax 0x62
138 #define ROP_SDPnox 0x63
139 #define ROP_SDPSoax 0x64
140 #define ROP_DSPnox 0x65
142 #define ROP_SDPSonox 0x67
143 #define ROP_DSPDSonoxxn 0x68
144 #define ROP_PDSxxn 0x69
145 #define ROP_DPSax 0x6A
146 #define ROP_PSDPSoaxxn 0x6B
147 #define ROP_SDPax 0x6C
148 #define ROP_PDSPDoaxxn 0x6D
149 #define ROP_SDPSnoax 0x6E
150 #define ROP_PDSxnan 0x6F
151 #define ROP_PDSana 0x70
152 #define ROP_SSDxPDxaxn 0x71
153 #define ROP_SDPSxox 0x72
154 #define ROP_SDPnoan 0x73
155 #define ROP_DSPDxox 0x74
156 #define ROP_DSPnoan 0x75
157 #define ROP_SDPSnaox 0x76
158 #define ROP_DSan 0x77
159 #define ROP_PDSax 0x78
160 #define ROP_DSPDSoaxxn 0x79
161 #define ROP_DPSDnoax 0x7A
162 #define ROP_SDPxnan 0x7B
163 #define ROP_SPDSnoax 0x7C
164 #define ROP_DPSxnan 0x7D
165 #define ROP_SPxDSxo 0x7E
166 #define ROP_DPSaan 0x7F
167 #define ROP_DPSaa 0x80
168 #define ROP_SPxDSxon 0x81
169 #define ROP_DPSxna 0x82
170 #define ROP_SPDSnoaxn 0x83
171 #define ROP_SDPxna 0x84
172 #define ROP_PDSPnoaxn 0x85
173 #define ROP_DSPDSoaxx 0x86
174 #define ROP_PDSaxn 0x87
176 #define ROP_SDPSnaoxn 0x89
177 #define ROP_DSPnoa 0x8A
178 #define ROP_DSPDxoxn 0x8B
179 #define ROP_SDPnoa 0x8C
180 #define ROP_SDPSxoxn 0x8D
181 #define ROP_SSDxPDxax 0x8E
182 #define ROP_PDSanan 0x8F
183 #define ROP_PDSxna 0x90
184 #define ROP_SDPSnoaxn 0x91
185 #define ROP_DPSDPoaxx 0x92
186 #define ROP_SPDaxn 0x93
187 #define ROP_PSDPSoaxx 0x94
188 #define ROP_DPSaxn 0x95
189 #define ROP_DPSxx 0x96
190 #define ROP_PSDPSonoxx 0x97
191 #define ROP_SDPSonoxn 0x98
192 #define ROP_DSxn 0x99
193 #define ROP_DPSnax 0x9A
194 #define ROP_SDPSoaxn 0x9B
195 #define ROP_SPDnax 0x9C
196 #define ROP_DSPDoaxn 0x9D
197 #define ROP_DSPDSaoxx 0x9E
198 #define ROP_PDSxan 0x9F
200 #define ROP_PDSPnaoxn 0xA1
201 #define ROP_DPSnoa 0xA2
202 #define ROP_DPSDxoxn 0xA3
203 #define ROP_PDSPonoxn 0xA4
204 #define ROP_PDxn 0xA5
205 #define ROP_DSPnax 0xA6
206 #define ROP_PDSPoaxn 0xA7
207 #define ROP_DPSoa 0xA8
208 #define ROP_DPSoxn 0xA9
210 #define ROP_DPSono 0xAB
211 #define ROP_SPDSxax 0xAC
212 #define ROP_DPSDaoxn 0xAD
213 #define ROP_DSPnao 0xAE
214 #define ROP_DPno 0xAF
215 #define ROP_PDSnoa 0xB0
216 #define ROP_PDSPxoxn 0xB1
217 #define ROP_SSPxDSxox 0xB2
218 #define ROP_SDPanan 0xB3
219 #define ROP_PSDnax 0xB4
220 #define ROP_DPSDoaxn 0xB5
221 #define ROP_DPSDPaoxx 0xB6
222 #define ROP_SDPxan 0xB7
223 #define ROP_PSDPxax 0xB8
224 #define ROP_DSPDaoxn 0xB9
225 #define ROP_DPSnao 0xBA
226 #define ROP_DSno 0xBB
227 #define ROP_SPDSanax 0xBC
228 #define ROP_SDxPDxan 0xBD
229 #define ROP_DPSxo 0xBE
230 #define ROP_DPSano 0xBF
232 #define ROP_SPDSnaoxn 0xC1
233 #define ROP_SPDSonoxn 0xC2
234 #define ROP_PSxn 0xC3
235 #define ROP_SPDnoa 0xC4
236 #define ROP_SPDSxoxn 0xC5
237 #define ROP_SDPnax 0xC6
238 #define ROP_PSDPoaxn 0xC7
239 #define ROP_SDPoa 0xC8
240 #define ROP_SPDoxn 0xC9
241 #define ROP_DPSDxax 0xCA
242 #define ROP_SPDSaoxn 0xCB
244 #define ROP_SDPono 0xCD
245 #define ROP_SDPnao 0xCE
246 #define ROP_SPno 0xCF
247 #define ROP_PSDnoa 0xD0
248 #define ROP_PSDPxoxn 0xD1
249 #define ROP_PDSnax 0xD2
250 #define ROP_SPDSoaxn 0xD3
251 #define ROP_SSPxPDxax 0xD4
252 #define ROP_DPSanan 0xD5
253 #define ROP_PSDPSaoxx 0xD6
254 #define ROP_DPSxan 0xD7
255 #define ROP_PDSPxax 0xD8
256 #define ROP_SDPSaoxn 0xD9
257 #define ROP_DPSDanax 0xDA
258 #define ROP_SPxDSxan 0xDB
259 #define ROP_SPDnao 0xDC
260 #define ROP_SDno 0xDD
261 #define ROP_SDPxo 0xDE
262 #define ROP_SDPano 0xDF
263 #define ROP_PDSoa 0xE0
264 #define ROP_PDSoxn 0xE1
265 #define ROP_DSPDxax 0xE2
266 #define ROP_PSDPaoxn 0xE3
267 #define ROP_SDPSxax 0xE4
268 #define ROP_PDSPaoxn 0xE5
269 #define ROP_SDPSanax 0xE6
270 #define ROP_SPxPDxan 0xE7
271 #define ROP_SSPxDSxax 0xE8
272 #define ROP_DSPDSanaxxn 0xE9
273 #define ROP_DPSao 0xEA
274 #define ROP_DPSxno 0xEB
275 #define ROP_SDPao 0xEC
276 #define ROP_SDPxno 0xED
278 #define ROP_SDPnoo 0xEF
280 #define ROP_PDSono 0xF1
281 #define ROP_PDSnao 0xF2
282 #define ROP_PSno 0xF3
283 #define ROP_PSDnao 0xF4
284 #define ROP_PDno 0xF5
285 #define ROP_PDSxo 0xF6
286 #define ROP_PDSano 0xF7
287 #define ROP_PDSao 0xF8
288 #define ROP_PDSxno 0xF9
290 #define ROP_DPSnoo 0xFB
292 #define ROP_PSDnoo 0xFD
293 #define ROP_DPSoo 0xFE
296 /* derived from XAA */
301 int pattern_planemask
;
303 { ROP_0
, ROP_0
, ROP_0
, ROP_DPna
}, /* GXclear */
304 { ROP_DSa
, ROP_DSPnoa
, ROP_DPa
, ROP_DPSnoa
}, /* GXand */
305 { ROP_SDna
, ROP_DPSnaon
, ROP_PDna
, ROP_DSPnaon
}, /* GXandReverse */
306 { ROP_S
, ROP_DPSDxax
, ROP_P
, ROP_DSPDxax
}, /* GXcopy */
307 { ROP_DSna
, ROP_DPSana
, ROP_DPna
, ROP_DPSana
}, /* GXandInverted */
308 { ROP_D
, ROP_D
, ROP_D
, ROP_D
}, /* GXnoop */
309 { ROP_DSx
, ROP_DPSax
, ROP_DPx
, ROP_DPSax
}, /* GXxor */
310 { ROP_DSo
, ROP_DPSao
, ROP_DPo
, ROP_DPSao
}, /* GXor */
311 { ROP_DSon
, ROP_DPSaon
, ROP_DPon
, ROP_DPSaon
}, /* GXnor */
312 { ROP_DSxn
, ROP_DPSaxn
, ROP_PDxn
, ROP_DPSaxn
}, /* GXequiv */
313 { ROP_Dn
, ROP_Dn
, ROP_Dn
, ROP_DPx
}, /* GXinvert */
314 { ROP_SDno
, ROP_DPSanan
, ROP_PDno
, ROP_DPSanan
}, /* GXorReverse */
315 { ROP_Sn
, ROP_PSDPxox
, ROP_Pn
, ROP_SPDSxox
}, /* GXcopyInverted */
316 { ROP_DSno
, ROP_DPSnao
, ROP_DPno
, ROP_DSPnao
}, /* GXorInverted */
317 { ROP_DSan
, ROP_DSPnoan
, ROP_DPan
, ROP_DPSnoan
}, /* GXnand */
318 { ROP_1
, ROP_1
, ROP_1
, ROP_DPo
} /* GXset */