Re: Layers and transparency Core Image
Re: Layers and transparency Core Image
- Subject: Re: Layers and transparency Core Image
- From: leenoori <email@hidden>
- Date: Sun, 24 Dec 2006 18:42:49 +0100
El 23/12/2006, a las 19:43, Scott Stevenson escribió:
First up, thanks for the reply, Scott. Now a couple of clarifications.
On Dec 23, 2006, at 8:12 AM, leenoori wrote:
What Core Image filters would I need to use to take a source image
and layer a semi-transparent version of another image on top?
I guess CISourceOverCompositing is part of the solution, but I
don't know how to make the overlaid image transparent. I suspect
that CIColorMatrix might help but I haven't yet been able to
figure out how to use it.
I'd basically like to be able to do this with an arbitrary number
of layers.
If I'm reading your question correctly, you don't need a filter for
this. Alpha transparency is basic Quartz.
CIImage *image1 = [self imageFromSomewhere];
CIImage *image2 = [self anotherImageFromSomewhere];
[image1 drawAtPoint:point fromRect:rect
operation:NSCompositeSourceOver fraction:1.0];
[image2 drawAtPoint:point fromRect:rect
operation:NSCompositeSourceOver fraction:0.8];
My understanding of the rationale behind Core Image is that you can
chain filters together cheaply and only incur the expense of actually
drawing in the last step of the chain, so I would like to be able to
do this without actually having to draw, if possible. I don't really
want to have to draw each layer separately, especially when the
number of layers starts to grow. In the end I intend to pass the
resulting image off to something else anyway; I don't want to have to
draw myself.
Or are you trying to make the image itself into a sort of filter?
No, I think in it's most basic form what I want to know if how I can
take a CIImage and uniformly apply an alpha value to it without
actually having to draw it. Like I said, I thought that CIColorMatrix
might be the right tack but I don't understand how to use it.
Are you looking for something like CGLayer?
I don't know as CGLayer is new to me but I will check it out. I'm
trying to look for the simplest solution at this point to replace my
existing code which is all NSImage based. So Core Image seemed like
the way to go.
Any chance this is what you need? (the open panel won't open
accept .jpg files, btw)
http://developer.apple.com/samplecode/CIAnnotation/
Thanks, I'll take a look at that and see if can help...
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden