views:

14

answers:

1

I am looking to implement a mechanism that combines bitmaps together in a variety of complex ways, using ternary raster operations like you can in Windows.

The idea is to be able to blt an image to a destination using any kind of combination of the source, brush, and destination pixels (source AND destination, source AND brush AND destination, etc.)

This is supported by Windows GDI in what's called Ternary Raster Operations (check out http://msdn.microsoft.com/en-us/library/dd145130(VS.85).aspx). Is it possible that OS X and iOS completely lack this functionality? The only thing I've been able to find are blend modes, but they are not nearly as flexible.

Any ideas?

A: 

There are no ternary operators in Quartz or AppKit, and almost certainly not in UIKit, either. All drawing in Quartz-land is from a single source (image, color, gradient, etc.) into a single destination (context).

You can have two source images, one as the “source” and the other as the “pattern”/“brush”. For actual pattern drawing, you can use a CGPattern instead of the second image.

Peter Hosey