I hadn't seen CIFilter, no, that might have been a good avenue to
explore however I think that's not available on the phone (and this is
for the phone even though I didn't explicitly state that earlier,
apologies). So I'll have to use something a bit more primitive.
I think perhaps a bitmap context is what I may want, it seems those can
be setup to be alpha only, so if I draw my image into one of those I've
started at least. Not quite sure where to go from there however, I
assume I'd then need to go back to an image from that bitmap context, or
to a bitmap, which I assume would be black at different alpha levels.
Err, it's got to be something in that direction. I'll look at those
blending modes again see if there's something there.
BravoBug Software wrote:
Modifying the bitmap data yourself shouldn't be too difficult, for an
NSBitmapImageRep you'd just grab the data with the -bitmapData method.
But have you checked out CIFilter? I'm not entirely sure I understood
what your goal is but there's likely a filter in place already that
will do it for you:
https://developer.apple.com/mac/library/documentation/GraphicsImaging/Reference/CoreImageFilterReference/Reference/reference.html
https://developer.apple.com/mac/library/documentation/GraphicsImaging/Reference/QuartzCoreFramework/Classes/CIFilter_Class/Reference/Reference.html
On Mon, Sep 21, 2009 at 9:32 PM, Roland King <[email protected]> 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.
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 ([email protected])
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/bravobug%40gmail.com
This email sent to [email protected]
_______________________________________________
Cocoa-dev mailing list ([email protected])
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 [email protected]