Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Indexed Bitmaps and CGImageCreateWithMaskingColors



Re:
On May 15, 2006, at 6:41 AM, Steve Mills wrote:

On May 15, 2006, at 05:25, Arne Scheffler wrote:

I've an index bitmap and I like to create an image where the white
color will be transparent.
I'm not sure how I would create the masking color components for the
second parameter in CGImageCreateWithMaskingColors. Any Hints ?

Did you read this page?

<http://developer.apple.com/documentation/GraphicsImaging/ Conceptual/drawingwithquartz2d/dq_images/chapter_12_section_6.html>

The important thing to remember is that the colors in the color array that you supply to CGImageCreateWithMaskingColors are the undecoded color values in your image.


For an image characterized by an index color space, that is a 1 component image so you supply a masking color array of 2 values, the min and max color values you want to be transparent (i.e. mask out). The color value you would use for your array would be the index of the color in your color table that you want to be transparent. You should use the same color for the minimum and maximum value of your masking color.

Say the white color that you want to be transparent is entry 5 in your color table (note that indexes start at 0). The code could look like:

const float myMaskingColors[] = {5, 5};

myColorMaskedImage = CGImageCreateWithMaskingColors (image, myMaskingColors);


Hope this helps, David

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartz-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartz-dev/email@hidden

This email sent to email@hidden
References: 
 >Indexed Bitmaps and CGImageCreateWithMaskingColors (From: "Arne Scheffler" <email@hidden>)
 >Re: Indexed Bitmaps and CGImageCreateWithMaskingColors (From: "Steve Mills" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.