Ternary Raster Operations

This section lists the ternary raster-operation codes used by the BitBlt, PatBlt, and StretchBlt functions. Ternary raster-operation codes define how GDI combines the bits in a source bitmap with the bits in the destination bitmap.

Each raster-operation code represents a Boolean operation in which the values of the pixels in the source, the selected brush, and the destination are combined. Following are the three operands used in these operations:

Operand
Meaning
D
Destination bitmap
P
Selected brush (also called pattern)
S
Source bitmap

Boolean operators used in these operations follow:

Operator
Meaning
a
Bitwise AND
n
Bitwise NOT (inverse)
o
Bitwise OR
x
Bitwise exclusive OR (XOR)

All Boolean operations are presented in reverse Polish notation. For example, the following operation replaces the values of the pixels in the destination bitmap with a combination of the pixel values of the source and brush:

PSo

The following operation combines the values of the pixels in the source and brush with the pixel values of the destination bitmap (there are alternative spellings of the same function, so although a particular spelling may not be in the list, an equivalent form would be):

DPSoo

Each raster-operation code is a 32-bit integer whose high-order word is a Boolean operation index and whose low-order word is the operation code. The 16-bit operation index is a zero-extended, 8-bit value that represents the result of the Boolean operation on predefined brush, source, and destination values. For example, the operation indexes for the PSo and DPSoo operations are shown in the following list:

P
S
D
PSo
DPSoo
0
0
0
0
0
0
0

0

0

0


0





0
0



0





0







Operation index:


00FCh
00FEh

In this case, PSo has the operation index 00FC (read from the bottom up); DPSoo has the operation index 00FE. These values define the location of the corresponding raster-operation codes, as shown in Table A.1, "Raster-Operation Codes." The PSo operation is in line 252 (00FCh) of the table; DPSoo is in line 254 (00FEh).

The most commonly used raster operations have been given special names in the Windows include file, WINDOWS.H. You should use these names whenever possible in your applications.

When the source and destination bitmaps are monochrome, a bit value of zero represents a black pixel and a bit value of 1 represents a white pixel. When the source and the destination bitmaps are color, those colors are represented with RGB values. For more information about RGB values, see RGB

Raster-Operation Codes

Boolean function (hexadecimal)
Raster operation (hexadecimal)
Boolean function in reverse Polish
Common name
00
00000042
0
BLACKNESS

00010289
DPSoon
pics/WIN3200090000.gif

00020C89
DPSona
pics/WIN3200090000.gif

000300AA
PSon
pics/WIN3200090000.gif

00040C88
SDPona
pics/WIN3200090000.gif

000500A9
DPon
pics/WIN3200090000.gif

00060865
PDSxnon
pics/WIN3200090000.gif

000702C5
PDSaon
pics/WIN3200090000.gif
08
00080F08
SDPnaa
pics/WIN3200090000.gif
09
00090245
PDSxon
pics/WIN3200090000.gif
0A
000A0329
DPna
pics/WIN3200090000.gif
0B
000B0B2A
PSDnaon
pics/WIN3200090000.gif
0C
000C0324
SPna
pics/WIN3200090000.gif
0D
000D0B25
PDSnaon
pics/WIN3200090000.gif
0E
000E08A5
PDSonon
pics/WIN3200090000.gif
0F
000F0001
Pn
pics/WIN3200090000.gif
10
00100C85
PDSona
pics/WIN3200090000.gif
11
001100A6
DSon
NOTSRCERASE
12
00120868
SDPxnon
pics/WIN3200090000.gif
13
001302C8
SDPaon
pics/WIN3200090000.gif
14
00140869
DPSxnon
pics/WIN3200090000.gif
15
001502C9
DPSaon
pics/WIN3200090000.gif
16
00165CCA
PSDPSanaxx
pics/WIN3200090000.gif
17
00171D54
SSPxDSxaxn
pics/WIN3200090000.gif
18
  1. D59
SPxPDxa
pics/WIN3200090000.gif
19
  1. CC8
SDPSanaxn
pics/WIN3200090000.gif
  1. A
  1. A06C5
PDSPaox
pics/WIN3200090000.gif
  1. B
  1. B0768
SDPSxaxn
pics/WIN3200090000.gif
  1. C
  1. C06CA
PSDPaox
pics/WIN3200090000.gif
  1. D
  1. D0766
DSPDxaxn
pics/WIN3200090000.gif
  1. E
  1. E01A5
PDSox
pics/WIN3200090000.gif
  1. F
  1. F0385
PDSoan
pics/WIN3200090000.gif
20
00200F09
DPSnaa
pics/WIN3200090000.gif
21
00210248
SDPxon
pics/WIN3200090000.gif
22
00220326
DSna
pics/WIN3200090000.gif
23
00230B24
SPDnaon
pics/WIN3200090000.gif
24
00240D55
SPxDSxa
pics/WIN3200090000.gif
25
00251CC5
PDSPanaxn
pics/WIN3200090000.gif
26
002606C8
SDPSaox
pics/WIN3200090000.gif
27
00271868
SDPSxnox
pics/WIN3200090000.gif
28

DPSxa
pics/WIN3200090000.gif
29
002916CA
PSDPSaoxxn
pics/WIN3200090000.gif
2A
002A0CC9
DPSana
pics/WIN3200090000.gif
2B
002B1D58
SSPxPDxaxn
pics/WIN3200090000.gif
2C
002C0784
SPDSoax
pics/WIN3200090000.gif
2D
002D060A
PSDnox
pics/WIN3200090000.gif
2E
002E064A
PSDPxox
pics/WIN3200090000.gif
2F
002F0E2A
PSDnoan
pics/WIN3200090000.gif
30
0030032A
PSna
pics/WIN3200090000.gif
31
00310B28
SDPnaon
pics/WIN3200090000.gif
32
00320688
SDPSoox
pics/WIN3200090000.gif
33
00330008
Sn
NOTSRCCOPY
34
003406C4
SPDSaox
pics/WIN3200090000.gif
35
00351864
SPDSxnox
pics/WIN3200090000.gif
36
003601A8
SDPox
pics/WIN3200090000.gif
37
00370388
SDPoan
pics/WIN3200090000.gif
38
  1. A
PSDPoax
pics/WIN3200090000.gif
39
00390604
SPDnox
pics/WIN3200090000.gif
3A
003A0644
SPDSxox
pics/WIN3200090000.gif
3B
003B0E24
SPDnoan
pics/WIN3200090000.gif
3C
003C004A
PSx
pics/WIN3200090000.gif
3D
003D18A4
SPDSonox
pics/WIN3200090000.gif
3E
003E1B24
SPDSnaox
pics/WIN3200090000.gif
3F
003F00EA
PSan
pics/WIN3200090000.gif
40
00400F0A
PSDnaa
pics/WIN3200090000.gif
41
00410249
DPSxon
pics/WIN3200090000.gif
42
00420D5D
SDxPDxa
pics/WIN3200090000.gif
43
00431CC4
SPDSanaxn
pics/WIN3200090000.gif
44
00440328
SDna
SRCERASE
45
00450B29
DPSnaon
pics/WIN3200090000.gif
46
004606C6
DSPDaox
pics/WIN3200090000.gif
47
0047076A
PSDPxaxn
pics/WIN3200090000.gif
48

SDPxa
pics/WIN3200090000.gif
49
004916C5
PDSPDaoxxn
pics/WIN3200090000.gif
4A
004A0789
DPSDoax
pics/WIN3200090000.gif
4B
004B0605
PDSnox
pics/WIN3200090000.gif
4C
004C0CC8
SDPana
pics/WIN3200090000.gif
4D
004D1954
SSPxDSxoxn
pics/WIN3200090000.gif
4E
004E0645
PDSPxox
pics/WIN3200090000.gif
4F
004F0E25
PDSnoan
pics/WIN3200090000.gif
50
00500325
PDna
pics/WIN3200090000.gif
51
00510B26
DSPnaon
pics/WIN3200090000.gif
52
005206C9
DPSDaox
pics/WIN3200090000.gif
53
00530764
SPDSxaxn
pics/WIN3200090000.gif
54
005408A9
DPSonon
pics/WIN3200090000.gif
55
00550009
Dn
DSTINVERT
56
005601A9
DPSox
pics/WIN3200090000.gif
57
00570389
DPSoan
pics/WIN3200090000.gif
58

PDSPoax
pics/WIN3200090000.gif
59
00590609
DPSnox
pics/WIN3200090000.gif
5A
005A0049
DPx
PATINVERT
5B
005B18A9
DPSDonox
pics/WIN3200090000.gif
5C
005C0649
DPSDxox
pics/WIN3200090000.gif
5D
005D0E29
DPSnoan
pics/WIN3200090000.gif
5E
005E1B29
DPSDnaox
pics/WIN3200090000.gif
5F
005F00E9
DPan
pics/WIN3200090000.gif
60
00600365
PDSxa
pics/WIN3200090000.gif
61
006116C6
DSPDSaoxxn
pics/WIN3200090000.gif
62
00620786
DSPDoax
pics/WIN3200090000.gif
63
00630608
SDPnox
pics/WIN3200090000.gif
64
00640788
SDPSoax
pics/WIN3200090000.gif
65
00650606
DSPnox
pics/WIN3200090000.gif
66
00660046
DSx
SRCINVERT
67
006718A8
SDPSonox
pics/WIN3200090000.gif
68
  1. A6
DSPDSonoxxn
pics/WIN3200090000.gif
69
00690145
PDSxxn
pics/WIN3200090000.gif
6A
006A01E9
DPSax
pics/WIN3200090000.gif
6B
006B178A
PSDPSoaxxn
pics/WIN3200090000.gif
6C
006C01E8
SDPax
pics/WIN3200090000.gif
6D
006D1785
PDSPDoaxxn
pics/WIN3200090000.gif
6E
006E1E28
SDPSnoax
pics/WIN3200090000.gif
6F
006F0C65
PDSxnan
pics/WIN3200090000.gif
70
00700CC5
PDSana
pics/WIN3200090000.gif
71
00711D5C
SSDxPDxaxn
pics/WIN3200090000.gif
72
00720648
SDPSxox
pics/WIN3200090000.gif
73
00730E28
SDPnoan
pics/WIN3200090000.gif
74
00740646
DSPDxox
pics/WIN3200090000.gif
75
00750E26
DSPnoan
pics/WIN3200090000.gif
76
00761B28
SDPSnaox
pics/WIN3200090000.gif
77
007700E6
DSan
pics/WIN3200090000.gif
78
  1. E5
PDSax
pics/WIN3200090000.gif
79
00791786
DSPDSoaxxn
pics/WIN3200090000.gif
7A
007A1E29
DPSDnoax
pics/WIN3200090000.gif
7B
007B0C68
SDPxnan
pics/WIN3200090000.gif
7C
007C1E24
SPDSnoax
pics/WIN3200090000.gif
7D
007D0C69
DPSxnan
pics/WIN3200090000.gif
7E
007E0955
SPxDSxo
pics/WIN3200090000.gif
7F
007F03C9
DPSaan
pics/WIN3200090000.gif
80
008003E9
DPSaa
pics/WIN3200090000.gif
81
00810975
SPxDSxon
pics/WIN3200090000.gif
82
00820C49
DPSxna
pics/WIN3200090000.gif
83
00831E04
SPDSnoaxn
pics/WIN3200090000.gif
84
00840C48
SDPxna
pics/WIN3200090000.gif
85
00851E05
PDSPnoaxn
pics/WIN3200090000.gif
86
008617A6
DSPDSoaxx
pics/WIN3200090000.gif
87
008701C5
PDSaxn
pics/WIN3200090000.gif
88
008800C6
DSa
SRCAND
89
00891B08
SDPSnaoxn
pics/WIN3200090000.gif
  1. A
008A0E06
DSPnoa
pics/WIN3200090000.gif
8B
008B0666
DSPDxoxn
pics/WIN3200090000.gif
8C
008C0E08
SDPnoa
pics/WIN3200090000.gif
8D
008D0668
SDPSxoxn
pics/WIN3200090000.gif
8E
008E1D7C
SSDxPDxax
pics/WIN3200090000.gif
8F
008F0CE5
PDSanan
pics/WIN3200090000.gif
90
00900C45
PDSxna
pics/WIN3200090000.gif
91
00911E08
SDPSnoaxn
pics/WIN3200090000.gif
92
009217A9
DPSDPoaxx
pics/WIN3200090000.gif
93
009301C4
SPDaxn
pics/WIN3200090000.gif
94
009417AA
PSDPSoaxx
pics/WIN3200090000.gif
95
009501C9
DPSaxn
pics/WIN3200090000.gif
96
00960169
DPSxx
pics/WIN3200090000.gif
97
0097588A
PSDPSonoxx
pics/WIN3200090000.gif
98
00981888
SDPSonoxn
pics/WIN3200090000.gif
99
00990066
DSxn
pics/WIN3200090000.gif
  1. A
009A0709
DPSnax
pics/WIN3200090000.gif
9B
009B07A8
SDPSoaxn
pics/WIN3200090000.gif
9C
009C0704
SPDnax
pics/WIN3200090000.gif
9D
009D07A6
DSPDoaxn
pics/WIN3200090000.gif
9E
009E16E6
DSPDSaoxx
pics/WIN3200090000.gif
9F
009F0345
PDSxan
pics/WIN3200090000.gif
A0
00A000C9
DPa
pics/WIN3200090000.gif
A1
00A11B05
PDSPnaoxn
pics/WIN3200090000.gif
A2
00A20E09
DPSnoa
pics/WIN3200090000.gif
A3
00A30669
DPSDxoxn
pics/WIN3200090000.gif
A4
00A41885
PDSPonoxn
pics/WIN3200090000.gif
A5
00A50065
PDxn
pics/WIN3200090000.gif
A6
00A60706
DSPnax
pics/WIN3200090000.gif
A7
00A707A5
PDSPoaxn
pics/WIN3200090000.gif
A8
00A803A9
DPSoa
pics/WIN3200090000.gif
A9
00A90189
DPSoxn
pics/WIN3200090000.gif
AA
00AA0029
D
pics/WIN3200090000.gif
AB
00AB0889
DPSono
pics/WIN3200090000.gif
AC
00AC0744
SPDSxax
pics/WIN3200090000.gif
AD
00AD06E9
DPSDaoxn
pics/WIN3200090000.gif
AE
00AE0B06
DSPnao
pics/WIN3200090000.gif
AF
00AF0229
DPno
pics/WIN3200090000.gif
B0
00B00E05
PDSnoa
pics/WIN3200090000.gif
B1
00B10665
PDSPxoxn
pics/WIN3200090000.gif
B2
00B21974
SSPxDSxox
pics/WIN3200090000.gif
B3
00B30CE8
SDPanan
pics/WIN3200090000.gif
B4
00B4070A
PSDnax
pics/WIN3200090000.gif
B5
00B507A9
DPSDoaxn
pics/WIN3200090000.gif
B6
00B616E9
DPSDPaoxx
pics/WIN3200090000.gif
B7
00B70348
SDPxan
pics/WIN3200090000.gif
B8
00B8074A
PSDPxax
pics/WIN3200090000.gif
B9
00B906E6
DSPDaoxn
pics/WIN3200090000.gif
BA
00BA0B09
DPSnao
pics/WIN3200090000.gif
BB
00BB0226
DSno
MERGEPAINT
BC
00BC1CE4
SPDSanax
pics/WIN3200090000.gif
BD
00BD0D7D
SDxPDxan
pics/WIN3200090000.gif
BE
00BE0269
DPSxo
pics/WIN3200090000.gif
BF
00BF08C9
DPSano
pics/WIN3200090000.gif
C0
00C000CA
PSa
MERGECOPY
C1
00C11B04
SPDSnaoxn
pics/WIN3200090000.gif
C2
00C21884
SPDSonoxn
pics/WIN3200090000.gif
C3
00C3006A
PSxn
pics/WIN3200090000.gif
C4
00C40E04
SPDnoa
pics/WIN3200090000.gif
C5
00C50664
SPDSxoxn
pics/WIN3200090000.gif
C6
00C60708
SDPnax
pics/WIN3200090000.gif
C7
00C707AA
PSDPoaxn
pics/WIN3200090000.gif
C8
00C803A8
SDPoa
pics/WIN3200090000.gif
C9
00C90184
SPDoxn
pics/WIN3200090000.gif
CA
00CA0749
DPSDxax
pics/WIN3200090000.gif
CB
00CB06E4
SPDSaoxn
pics/WIN3200090000.gif
CC
00CC0020
S
SRCCOPY
CD
00CD0888
SDPono
pics/WIN3200090000.gif
CE
00CE0B08
SDPnao
pics/WIN3200090000.gif
CF
00CF0224
SPno
pics/WIN3200090000.gif
D0
00D00E0A
PSDnoa
pics/WIN3200090000.gif
D1
00D1066A
PSDPxoxn
pics/WIN3200090000.gif
D2
00D20705
PDSnax
pics/WIN3200090000.gif
D3
00D307A4
SPDSoaxn
pics/WIN3200090000.gif
D4
00D41D78
SSPxPDxax
pics/WIN3200090000.gif
D5
00D50CE9
DPSanan
pics/WIN3200090000.gif
D6
00D616EA
PSDPSaoxx
pics/WIN3200090000.gif
D7
00D70349
DPSxan
pics/WIN3200090000.gif
D8
00D80745
PDSPxax
pics/WIN3200090000.gif
D9
00D906E8
SDPSaoxn
pics/WIN3200090000.gif
DA
00DA1CE9
DPSDanax
pics/WIN3200090000.gif
DB
00DB0D75
SPxDSxan
pics/WIN3200090000.gif
DC
00DC0B04
SPDnao
pics/WIN3200090000.gif
DD
00DD0228
SDno
pics/WIN3200090000.gif
DE
00DE0268
SDPxo
pics/WIN3200090000.gif
DF
00DF08C8
SDPano
pics/WIN3200090000.gif
E0
00E003A5
PDSoa
pics/WIN3200090000.gif
E1
00E10185
PDSoxn
pics/WIN3200090000.gif
E2
00E20746
DSPDxax
pics/WIN3200090000.gif
E3
00E306EA
PSDPaoxn
pics/WIN3200090000.gif
E4
00E40748
SDPSxax
pics/WIN3200090000.gif
E5
00E506E5
PDSPaoxn
pics/WIN3200090000.gif
E6
00E61CE8
SDPSanax
pics/WIN3200090000.gif
E7
00E70D79
SPxPDxan
pics/WIN3200090000.gif
E8
00E81D74
SSPxDSxax
pics/WIN3200090000.gif
E9
00E95CE6
DSPDSanaxxn
pics/WIN3200090000.gif
EA
00EA02E9
DPSao
pics/WIN3200090000.gif
EB
00EB0849
DPSxno
pics/WIN3200090000.gif
EC
00EC02E8
SDPao
pics/WIN3200090000.gif
ED
00ED0848
SDPxno
pics/WIN3200090000.gif
EE
00EE0086
DSo
SRCPAINT
EF
00EF0A08
SDPnoo
pics/WIN3200090000.gif
F0
00F00021
P
PATCOPY
F1
00F10885
PDSono
pics/WIN3200090000.gif
F2
00F20B05
PDSnao
pics/WIN3200090000.gif
F3
00F3022A
PSno
pics/WIN3200090000.gif
F4
00F40B0A
PSDnao
pics/WIN3200090000.gif
F5
00F50225
PDno
pics/WIN3200090000.gif
F6
00F60265
PDSxo
pics/WIN3200090000.gif
F7
00F708C5
PDSano
pics/WIN3200090000.gif
F8
00F802E5
PDSao
pics/WIN3200090000.gif
F9
00F90845
PDSxno
pics/WIN3200090000.gif
FA
00FA0089
DPo
pics/WIN3200090000.gif
FB
00FB0A09
DPSnoo
PATPAINT
FC
00FC008A
PSo
pics/WIN3200090000.gif
FD
00FD0A0A
PSDnoo
pics/WIN3200090000.gif
FE
00FE02A9
DPSoo
pics/WIN3200090000.gif
FF
00FF0062

WHITENESS

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database