OR compositing operation?
OR compositing operation?
- Subject: OR compositing operation?
- From: Colin Howarth <email@hidden>
- Date: Tue, 22 Sep 2009 15:59:36 +0200
On 22 Sep, 2009, at 15:22, Oleg Krupnov wrote:
Hi,
I'd like to draw in a graphics context in such a compositing mode:
R = MAX(S, D)
i.e. out of two colors (source and destination), the maximum color
(channel-wise) was chosen. This is basically equivalent to ORing the
colors.
Is this possible? I don't see such NSCompositingOperation. There's
only NSCompositeXOR, but no NSCompositeOR...
I'm not quite sure what you mean by "maximum color (channel-wise)".
Do you mean
Rr = (Sr > Dr) ? Sr : Dr
Rg = (Sg > Dg) ? Sg : Dg
Rb = (Sb > Db) ? Sb : Db
A quick google threw up http://my.safaribooksonline.com/0672322307/ch14
for the compositing operations. The logic operation XOR appears to be
binary
(opaque/transparent). It might be that what you want is simply called
something
else (like NSCompositeSourceOver).
A long time ago I remember XORing pixels D' = (S XOR D) changed the
colour and (S XOR D')
changed it back again. But that was bitwise XOR, ie.
Rr0 = Sr0 XOR Dr0
Rr1 = Sr1 XOR Dr1
...
etc.
And finally, mathematically, A OR B = (A XOR B) XOR (A AND B)
I wonder if any of that helps? :-)
_______________________________________________
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