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: Image Mask from Grayscale JPEG




On May 14, 2005, at 11:15 PM, R. Scott Thompson wrote:

I have a grayscale JPEG (a lovely, blurry circle) and I want to use that as an Image Mask. Can load the file's pixel data into a CGImage, through ImageIO, but that creates an Image (i.e. a CGImage with a color space) and not an image mask (which I gather is a CGImage with no color space).

What I don't know is what is the best way to convert the Image into an Image Mask.

The most obvious way to do what I want, I believe, is going to be to create a grayscale bitmap context, draw the image I want to use as my mask into that bitmap, then use CGCreateImageMask to create a mask from the pixels. That seems like a very round-about way to create a mask from an image.

FWIW, that's what I do. It's not particularly inefficient since you have to allocate the mask's backing store at some point anyway.


Nick

_______________________________________________
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: 
 >Image Mask from Grayscale JPEG (From: "R. Scott Thompson" <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.