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.

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.

Assume that I have the image I want to process and I can get that into a bitmap - because I do and I have.

I've looked at all the colour blending modes but unless I've missed something, all of them deal, as you'd expect, in colour, not alpha, so I can't find one of those I think I can use which totally ignores the colour information.

I thought about using a CFImageMask which has points which are white where the underlyer is alpha=1 and black where it's 0 and all points between but creating that from the original image is the same problem..

I thought about wandering through the bytes of data in the bitmap (assuming I can even figure out how to access them which currently I cannot) and changing them but that seems pretty hokey even if I deal correctly with the byte orderings the packing and .. getting to the data in the first place.

I'm sure I've entirely missed some piece of Quartz or CF here which does exactly what I want, or a blending mode I can use cleverly for this. Any pointers would be very useful.

Roland
_______________________________________________

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

Reply via email to