2 *Copyright (C) 1994-2002 The XFree86 Project, Inc. All Rights Reserved.
4 *Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files (the
6 *"Software"), to deal in the Software without restriction, including
7 *without limitation the rights to use, copy, modify, merge, publish,
8 *distribute, sublicense, and/or sell copies of the Software, and to
9 *permit persons to whom the Software is furnished to do so, subject to
10 *the following conditions:
12 *The above copyright notice and this permission notice shall be
13 *included in all copies or substantial portions of the Software.
15 *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
19 *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
20 *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 *Except as contained in this notice, the name of the XFree86 Project
24 *shall not be used in advertising or otherwise to promote the sale, use
25 *or other dealings in this Software without prior written authorization
26 *from the XFree86 Project.
28 * Authors: Alan Hourihane <alanh@fairlite.demon.co.uk>
32 * Raster operations used by Windows translated to X's 16 rop codes...
34 #ifdef HAVE_XWIN_CONFIG_H
35 #include <xwin-config.h>
40 ROP16(HDC hdc
, int rop
);
42 int g_copyROP
[16] = { 0xFF0062, /* GXclear - 0 */
43 0x8800C6, /* GXand - S & D */
44 0x440328, /* GXandReverse - S & !D */
45 0xCC0020, /* GXcopy - S */
46 0x220326, /* GXandInverted - !S & D */
47 0xAA0029, /* GXnoop - D */
48 0x660046, /* GXxor - S ^ D */
49 0xEE0086, /* GXor - S | D */
50 0x1100A6, /* GXnor - !S & !D */
51 0x990126, /* GXequiv - !S ^ D */
52 0x550009, /* GXinvert - !D */
53 0xDD0228, /* GXorReverse - S | !D */
54 0x330008, /* GXcopyInverted - !S */
55 0xBB0226, /* GXorInverted - !S | D */
56 0x7700C6, /* GXnand - !S | !D */
57 0x000042 /* GXset - 1 */
60 int g_patternROP
[16] = { 0xFF0062, /* GXclear - 0 */
61 0xA000C9, /* GXand - P & D */
62 0xF50225, /* GXandReverse - P & !D */
63 0xF00021, /* GXcopy - P */
64 0x5F00E9, /* GXandInverted - !P & D */
65 0xAA0029, /* GXnoop - D */
66 0xA50065, /* GXxor - P ^ D */
67 0xA000C9, /* GXor - P | D */
68 0x5F00E9, /* GXnor - !P & !D */
69 0x5A0049, /* GXequiv - !P ^ D */
70 0x550009, /* GXinvert - !D */
71 0x500325, /* GXorReverse - P | !D */
72 0x0F0001, /* GXcopyInverted - !P */
73 0x0A0329, /* GXorInverted - !P | D */
74 0x0500A9, /* GXnand - !P | !D */
75 0x000042 /* GXset - 1 */
79 ROP16(HDC hdc
, int rop
)
83 SetROP2(hdc
, R2_BLACK
);
87 SetROP2(hdc
, R2_MASKPEN
);
91 SetROP2(hdc
, R2_MASKPENNOT
);
95 SetROP2(hdc
, R2_COPYPEN
);
103 SetROP2(hdc
, R2_XORPEN
);
107 SetROP2(hdc
, R2_MERGEPEN
);
111 SetROP2(hdc
, R2_NOTMERGEPEN
);
115 SetROP2(hdc
, R2_NOTXORPEN
);
119 SetROP2(hdc
, R2_NOT
);
123 SetROP2(hdc
, R2_MERGEPENNOT
);
127 SetROP2(hdc
, R2_NOTCOPYPEN
);
131 SetROP2(hdc
, R2_MERGENOTPEN
);
135 SetROP2(hdc
, R2_NOTMASKPEN
);
139 SetROP2(hdc
, R2_WHITE
);