On Tue, Sep 22, 2009 at 9:20 AM, David Duncan <david.dun...@apple.com>wrote:
> On Sep 21, 2009, at 9:32 PM, Roland King wrote: > > I'm trying to construct an image which is colored according to the alpha >> value of a different image. I've been hunting around the Quartz Core docs >> and I can't figure out a good way to do this. The motivation is to do >> something similar to what apple does on the iphone tabbar items which are >> drawn white or blue using the alpha of the image you supply and it's a >> pretty good effect I want to reuse. >> > > > Just use your second image as a mask via CGContextClipToMask(). If you use > a normal image, then the alpha values are used as alpha for the drawing you > do which should do exactly what you want. Also, this bit So for instance if I my drawing color is D and the point on my underlying > image is {r,g,b,a}, I want to draw a point of color S * a. seems to have a typo, but there are compositing modes for whatever operation you're talking about here. DestinationIn is Result = DestinationColor * SourceAlpha. So you could do CGContextBeginTransparencyLayer, draw mask with SourceOver, draw color to be masked with DestinationIn, CGContextEndTransparencyLayer. There are quite a few modes that use only the alpha channel from either source or destination. -Ken _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com