ADC Home > Reference Library > Technical Q&As > Legacy Documents > Graphics & Imaging >

Legacy Documentclose button

Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.

Current information on this Reference Library topic can be found here:

Color-Separating Arbitrary Shapes

Q: I'm trying to color-separate arbitrary shapes. For example, to make the cyan plate, I want to take the shape's color, convert it to gxCMYKspace, then replace the black component with the cyan one, and zero out the others.

This is fairly easy to do for simple shapes, but bitmaps are going to give me problems. I need to find a way to convert a bitmap from one color space to another without changing its visual appearance (in other words, the pixel values have to change to reflect a GXConvertColor on them).

Is there a way to do this without traversing the whole bitmap "by hand"?

A: Using a transfer mode will do the trick for bitmaps, but it probably won't be all that speedy (it also probably won't be any worse than your slow alternative of traversing the bitmap by hand).

Transfer modes allow you to specify 5x4 matrices that specify which color component of the source gets mapped to which color component of the destination.

The easiest way to set up a transfer mode is to get the existing mode and then modify it as follows:

In the gxTransferMode struct:

  1. Set space to gxCMYKSpace.
  2. Then to copy cyan to black, set the sourceMatrix to
    [       0       0       0       1
            0       0       0       0
            0       0       0       0
            0       0       0       0
            0       0       0       0       ]

See Also:

  • Pages 5-33 and 34 in Inside Macintosh: QuickDraw GX Objects has further details on Transfer Mode matrices.

[Jun 11 1996]

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.