May 24th, 2005

Understanding ternary raster operations

It’s perfectly logical, which doesn’t mean that it’s easy to understand. A ternary raster operation describes how three boolean values should combine to form an output boolean. I was going to write up a description but found that the existing documentation pretty much covers it, so I refer you to that. In particular, look at the table that explains where PSo and DPSoo come from.

Now, one question that has come up is “What is the algorithm for deriving the RPN raster operation description string from the operation index?” The answer is, “You stare at it and use your brain’s power of pattern-matching.” There is no single “correct” expression of an operation index as RPN. For example, “DPSoo” could have been written as “DSPoo” or “DSoPo” or as the equivalent but pointlessly esoteric “DPoDnPnSaao”. All of these expressions have the same boolean truth table.

Topics
Code

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.