uLib  User mode C/C++ extended API library for Win32 programmers.
Ternary Raster Operations

Module Description

Reverse polish mnemonics for all GDI raster ops.
#include <uLib/TernaryOp.h>

This module defines symbolic mnemonics for all of the GDI ternary op codes.
The nomenclature of each is: R3_[operands][operators], following the Forth-like
operations scheme used by GDI. This type of notation lists all the operands first
followed by the list of operators. The operands and operators are as follows:

Operands: D - Destination bitmap, S - Source bitmap, P - Pattern (brush)
Operations: a - AND, o - OR, x - XOR, n - NOT

Bear in mind that NOT is a unary operation (one operand), and the rest are binary.
So f.ex, R3_DPx means Destination xor Pattern, a.k.a PATINVERT.
And R3_PSDPxax means effectively Put currrent brush where the mask has zeros.
Like this..

SelectBrush( hdc, hBrush );
// hdcMonoMask has a monochrome mask bitmap selected.
BitBlt( hdc, x, y, cx, cy, hdcMonoMask, 0, 0, R3_PSDPxax );

The mnemonics have all been sorted into operative groups.
Though intricate, these operations permit very complex pixel manipulation.

Groups

 Destination unary operations
 
 Source unary operations
 
 Pattern unary operations
 
 Destination/Source binary operations
 
 Destination/Pattern binary operations
 
 Pattern/Destination binary operations
 
 Source/Pattern binary operations
 
 Pattern/Source binary operations
 
 Destination/Pattern/Source ternary operations
 
 Destination/Source/Pattern ternary operations
 
 Source/Destination/Pattern ternary operations
 
 Complex ternary operations (Source primary)
 
 Complex ternary operations (Pattern primary)
 

Macros

#define R4_MASKBLT   MAKEROP4( R3_S, R3_D )
 

Macro Definition Documentation

◆ R4_MASKBLT

#define R4_MASKBLT   MAKEROP4( R3_S, R3_D )

Quaternary raster op for a standard MaskBlt()..
(FG = Src copy, BG = Dst copy)

Definition at line 46 of file TernaryOp.h.