三元光栅操作码

这篇补充文档列出了 putimage 函数支持的所有三元光栅操作码。

三元光栅操作码定义了源图像与目标图像的位合并形式,这个合并形式是以下三个操作数对应像素的布尔运算:

操作数含义
D目标图像
P当前填充颜色
S源图像

布尔运算符包括以下几种:

操作含义
a位的 AND 运算(双目运算)
n位的 NOT 运算(单目运算)
o位的 OR 运算(双目运算)
x位的 XOR 运算(双目运算)

所有的布尔操作都采用逆波兰表示法,例如,“当前填充颜色 or 源图像”可表示为:PSo。(当然 SPo 也是等价的,这里只列举出了其中一种等价格式)

三元光栅操作码是 __int32 类型,其高位字是布尔操作索引,低位字是操作码。布尔操作索引的 16 个位中,高 8 位用 0 填充,低 8 位是当前填充颜色、源图像和目标图像的布尔操作结果。例如,PSo 和 DPSoo 的操作索引如下:

PSDPSoDPSoo
00000
00101
01011
01111
10011
10111
11011
11111
操作索引:00FCh00FEh

上例中,PSo 的操作索引是 00FC (从下往上读),DPSoo 的是 00FE。这些值定义了相应的三元光栅操作码在“三元光栅操作码”表格中的位置,PSo 在 252 (00FCh) 行,DPSoo 在 254 (00FEh) 行。常用的三元光栅操作码已经定义了常量名,程序中可以直接使用。

 

三元光栅操作码

布尔功能 (16 进制)光栅操作 (16 进制)布尔功能的逆波兰表示法常量名
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