Export (0) Print
Expand All

Ternary Raster Operations (Windows CE 5.0)

Windows CE 5.0
Send Feedback

Ternary raster operation codes define how the graphics device interface (GDI) combines the bits in a source bitmap with the bits in the destination bitmap.

This topic lists the ternary raster-operation codes used by the BitBlt, PatBlt, and StretchBlt functions.

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.

The following table shows the three operands used in these operations.

OperandMeaning
DDestination bitmap
P Selected brush (also called pattern)
SSource bitmap

The following table shows the Boolean operators used in ternary raster operations.

OperatorMeaning
aBitwise AND
nBitwise NOT (inverse)
oBitwise OR
xBitwise 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 table.

PSDPSoDPSoo
00000
00 1 0 1
0 1 0 1 1
0 1 1 1 1
1 0 0 1 1
1 0 1 1 1
1 1 0 1 1
1 1 1 1 1
Operation index:  00FCh00FEh

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 the following Raster-Operation Codes table.

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 header file Wingdi.h (included through Windows.h).   These common names are shown in table below, use them whenever possible in your applications.

When the source and destination bitmaps are monochrome, a bit value of 0 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 PolishCommon name
00000000420BLACKNESS
0100010289DPSoon 
0200020C89DPSona 
03000300AAPSon 
0400040C88SDPona 
05000500A9DPon 
0600060865PDSxnon 
07000702C5PDSaon 
0800080F08SDPnaa 
0900090245PDSxon 
0A000A0329DPna 
0B000B0B2APSDnaon 
0C000C0324SPna 
0D000D0B25PDSnaon 
0E000E08A5PDSonon 
0F000F0001Pn 
1000100C85PDSona 
11001100A6DSonNOTSRCERASE
1200120868SDPxnon 
13001302C8SDPaon 
1400140869DPSxnon 
15001502C9DPSaon 
1600165CCAPSDPSanaxx 
1700171D54SSPxDSxaxn 
1800180D59SPxPDxa 
1900191CC8SDPSanaxn 
1A001A06C5PDSPaox 
1B001B0768SDPSxaxn 
1C001C06CAPSDPaox 
1D001D0766DSPDxaxn 
1E001E01A5PDSox 
1F001F0385PDSoan 
2000200F09DPSnaa 
2100210248SDPxon 
2200220326DSna 
2300230B24SPDnaon 
2400240D55SPxDSxa 
2500251CC5PDSPanaxn 
26002606C8SDPSaox 
2700271868SDPSxnox 
2800280369DPSxa 
29002916CAPSDPSaoxxn 
2A002A0CC9DPSana 
2B002B1D58SSPxPDxaxn 
2C002C0784SPDSoax 
2D002D060APSDnox 
2E002E064APSDPxox 
2F002F0E2APSDnoan 
300030032APSna 
3100310B28SDPnaon 
3200320688SDPSoox 
3300330008SnNOTSRCCOPY
34003406C4SPDSaox 
3500351864SPDSxnox 
36003601A8SDPox 
3700370388SDPoan 
380038078APSDPoax 
3900390604SPDnox 
3A003A0644SPDSxox 
3B003B0E24SPDnoan 
3C003C004APSx 
3D003D18A4SPDSonox 
3E003E1B24SPDSnaox 
3F003F00EAPSan 
4000400F0APSDnaa 
4100410249DPSxon 
4200420D5DSDxPDxa 
4300431CC4SPDSanaxn 
4400440328SDnaSRCERASE
4500450B29DPSnaon 
46004606C6DSPDaox 
470047076APSDPxaxn 
4800480368SDPxa 
49004916C5PDSPDaoxxn 
4A004A0789DPSDoax 
4B004B0605PDSnox 
4C004C0CC8SDPana 
4D004D1954SSPxDSxoxn 
4E004E0645PDSPxox 
4F004F0E25PDSnoan 
5000500325PDna 
5100510B26DSPnaon 
52005206C9DPSDaox 
5300530764SPDSxaxn 
54005408A9DPSonon 
5500550009DnDSTINVERT
56005601A9DPSox 
5700570389DPSoan 
5800580785PDSPoax 
5900590609DPSnox 
5A005A0049DPxPATINVERT
5B005B18A9DPSDonox 
5C005C0649DPSDxox 
5D005D0E29DPSnoan 
5E005E1B29DPSDnaox 
5F005F00E9DPan 
6000600365PDSxa 
61006116C6DSPDSaoxxn 
6200620786DSPDoax 
6300630608SDPnox 
6400640788SDPSoax 
6500650606DSPnox 
6600660046DSxSRCINVERT
67006718A8SDPSonox 
68006858A6DSPDSonoxxn 
6900690145PDSxxn 
6A006A01E9DPSax 
6B006B178APSDPSoaxxn 
6C006C01E8SDPax 
6D006D1785PDSPDoaxxn 
6E006E1E28SDPSnoax 
6F006F0C65PDSxnan 
7000700CC5PDSana 
7100711D5CSSDxPDxaxn 
7200720648SDPSxox 
7300730E28SDPnoan 
7400740646DSPDxox 
7500750E26DSPnoan 
7600761B28SDPSnaox 
77007700E6DSan 
78007801E5PDSax 
7900791786DSPDSoaxxn 
7A007A1E29DPSDnoax 
7B007B0C68SDPxnan 
7C007C1E24SPDSnoax 
7D007D0C69DPSxnan 
7E007E0955SPxDSxo 
7F007F03C9DPSaan 
80008003E9DPSaa 
8100810975SPxDSxon 
8200820C49DPSxna 
8300831E04SPDSnoaxn 
8400840C48SDPxna 
8500851E05PDSPnoaxn 
86008617A6DSPDSoaxx 
87008701C5PDSaxn 
88008800C6DSaSRCAND
8900891B08SDPSnaoxn 
8A008A0E06DSPnoa 
8B008B0666DSPDxoxn 
8C008C0E08SDPnoa 
8D008D0668SDPSxoxn 
8E008E1D7CSSDxPDxax 
8F008F0CE5PDSanan 
9000900C45PDSxna 
9100911E08SDPSnoaxn 
92009217A9DPSDPoaxx 
93009301C4SPDaxn 
94009417AAPSDPSoaxx 
95009501C9DPSaxn 
9600960169DPSxx 
970097588APSDPSonoxx 
9800981888SDPSonoxn 
9900990066DSxn 
9A009A0709DPSnax 
9B009B07A8SDPSoaxn 
9C009C0704SPDnax 
9D009D07A6DSPDoaxn 
9E009E16E6DSPDSaoxx 
9F009F0345PDSxan 
A000A000C9DPa 
A100A11B05PDSPnaoxn 
A200A20E09DPSnoa 
A300A30669DPSDxoxn 
A400A41885PDSPonoxn 
A500A50065PDxn 
A600A60706DSPnax 
A700A707A5PDSPoaxn 
A800A803A9DPSoa 
A900A90189DPSoxn 
AA00AA0029D 
AB00AB0889DPSono 
AC00AC0744SPDSxax 
AD00AD06E9DPSDaoxn 
AE00AE0B06DSPnao 
AF00AF0229DPno 
B000B00E05PDSnoa 
B100B10665PDSPxoxn 
B200B21974SSPxDSxox 
B300B30CE8SDPanan 
B400B4070APSDnax 
B500B507A9DPSDoaxn 
B600B616E9DPSDPaoxx 
B700B70348SDPxan 
B800B8074APSDPxax 
B900B906E6DSPDaoxn 
BA00BA0B09DPSnao 
BB00BB0226DSnoMERGEPAINT
BC00BC1CE4SPDSanax 
BD00BD0D7DSDxPDxan 
BE00BE0269DPSxo 
BF00BF08C9DPSano 
C000C000CAPSaMERGECOPY
C100C11B04SPDSnaoxn 
C200C21884SPDSonoxn 
C300C3006APSxn 
C400C40E04SPDnoa 
C500C50664SPDSxoxn 
C600C60708SDPnax 
C700C707AAPSDPoaxn 
C800C803A8SDPoa 
C900C90184SPDoxn 
CA00CA0749DPSDxax 
CB00CB06E4SPDSaoxn 
CC00CC0020SSRCCOPY
CD00CD0888SDPono 
CE00CE0B08SDPnao 
CF00CF0224SPno 
D000D00E0APSDnoa 
D100D1066APSDPxoxn 
D200D20705PDSnax 
D300D307A4SPDSoaxn 
D400D41D78SSPxPDxax 
D500D50CE9DPSanan 
D600D616EAPSDPSaoxx 
D700D70349DPSxan 
D800D80745PDSPxax 
D900D906E8SDPSaoxn 
DA00DA1CE9DPSDanax 
DB00DB0D75SPxDSxan 
DC00DC0B04SPDnao 
DD00DD0228SDno 
DE00DE0268SDPxo 
DF00DF08C8SDPano 
E000E003A5PDSoa 
E100E10185PDSoxn 
E200E20746DSPDxax 
E300E306EAPSDPaoxn 
E400E40748SDPSxax 
E500E506E5PDSPaoxn 
E600E61CE8SDPSanax 
E700E70D79SPxPDxan 
E800E81D74SSPxDSxax 
E900E95CE6DSPDSanaxxn 
EA00EA02E9DPSao 
EB00EB0849DPSxno 
EC00EC02E8SDPao 
ED00ED0848SDPxno 
EE00EE0086DSoSRCPAINT
EF00EF0A08SDPnoo 
F000F00021PPATCOPY
F100F10885PDSono 
F200F20B05PDSnao 
F300F3022APSno 
F400F40B0APSDnao 
F500F50225PDno 
F600F60265PDSxo 
F700F708C5PDSano 
F800F802E5PDSao 
F900F90845PDSxno 
FA00FA0089DPo 
FB00FB0A09DPSnooPATPAINT
FC00FC008APSo 
FD00FD0A0APSDnoo 
FE00FE02A9DPSoo 
FF00FF00621WHITENESS

See Also

Raster Operation Codes | Binary Raster Operations | BitBlt | PatBlt | StretchBlt | MAKEROP4


Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.


Show:
© 2015 Microsoft