Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page > Hide TOC

Masking

In QuickDraw, masking can be accomplished using bitmaps that to determine how color information is copied from the pixels in a source image to the corresponding pixels in a destination image. Masks are passed to the QuickDraw functions CopyMask and CopyDeepMask in the maskBits parameter. Masks can have a depth of up to 8 bits per component.

QuickDraw uses the following compositing formula to compute the contribution of each color component in the source and destination pixels:

(1 – mask) x source + (mask) x destination

In this formula, the mask values are normalized to range from 0 through 1. High mask values reduce the contribution of source pixels—in effect, the mask contains “inverse alpha” information with respect to the source bitmap.

Quartz supports two kinds of masks:

Starting in Mac OS X v10.4, you can use the function CGImageCreateWithMask to mask an image with either an image mask or an image. The function CGImageCreateWithMaskingColors is used for chroma key masking. Masks can also be intersected with the current clipping area in a graphics context using the function CGContextClipToMask.

Contents:

Replacing Mask Regions
Relevant Resources




< Previous PageNext Page > Hide TOC


Last updated: 2006-09-05




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice