• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: drawing/masking one image with the alpha value from another
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: drawing/masking one image with the alpha value from another


  • Subject: Re: drawing/masking one image with the alpha value from another
  • From: Ken Ferry <email@hidden>
  • Date: Tue, 22 Sep 2009 13:05:07 -0700

On Tue, Sep 22, 2009 at 9:20 AM, David Duncan <email@hidden>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 (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: drawing/masking one image with the alpha value from another
      • From: Roland King <email@hidden>
References: 
 >drawing/masking one image with the alpha value from another (From: Roland King <email@hidden>)
 >Re: drawing/masking one image with the alpha value from another (From: David Duncan <email@hidden>)

  • Prev by Date: Re: UITableView Custom cell with image
  • Next by Date: Re: UITableView Custom cell with image
  • Previous by thread: Re: drawing/masking one image with the alpha value from another
  • Next by thread: Re: drawing/masking one image with the alpha value from another
  • Index(es):
    • Date
    • Thread