Re: Drawing images on top of each other
Re: Drawing images on top of each other
- Subject: Re: Drawing images on top of each other
- From: Quincey Morris <email@hidden>
- Date: Thu, 3 Feb 2011 23:21:02 -0800
On Feb 3, 2011, at 22:58, Andrew Coad wrote:
> //[[self touchClearImage] drawAtPoint:aPoint blendMode:kCGBlendModeNormal alpha:0.0]; // <-- see note below
This doesn't do anything -- alpha == 0 turns the source image fully transparent (in effect), and a transparent source has no effect in this mode.
> [[item displayImage] drawAtPoint:aPoint
> blendMode:kCGBlendModeNormal alpha:[[item displayImageAlpha] doubleValue]]; // <-- alpha is in fact 1.0
According to CGContext.h (I looked in the Mac OS X SDK version because it was handy, but I assume the iOS formulas are the same), blendMode kCGBlendModeNormal is:
R = S + D*(1 - Sa)
which obviously blends the source into the destination. You probably want either kCGBlendModeCopy:
R = S
or kCGBlendModeSourceAtop:
R = S*Da + D*(1 - Sa)
depending on what you want to happen to transparency within the new image.
_______________________________________________
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