Thanks!

It seemed exactly what I need but I've found that it doesn't work as
expected. The interpolated semi-transparent parts of the rendered text
still appears brighter than it should.

Namely, consider drawing white text on black background, and then
drawing the same white text one more time over the first one.

Suppose that when a letter is rasterized, one of the resulting
interpolated pixels is semitransparent white, with alpha = 50%. After
alpha blending with the black background, the pixel becomes a 50% gray
pixel.

Now when the second text is drawn on top, there will be also the same
semitransparent white pixel with alpha = 50% at the same location.
What result I'd like to achieve would be to have the same 50% gray
pixel at this location. However, with kCGBlendModeLighten mode, what I
think what's happening is that the system picks pure white as the
lighter of two colors: 50% gray of the background and pure white
(without taking into account the alpha of the new pixel), and then
applies the usual alpha blending rule, which results in 75% gray.

Is there a workaround? Or am I doing something wrong? Thanks!

On Tue, Sep 22, 2009 at 7:23 PM, David Duncan <david.dun...@apple.com> wrote:
> On Sep 22, 2009, at 6:22 AM, 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.
>
>
> This is the Lighten blend mode (kCGBlendModeLighten). There doesn't appear
> to be a corresponding NS composting mode, and I'm not sure why, but you can
> easily get a CGContext from an NSGraphicsContext by asking it for its
> graphicsPort, so this shouldn't be hard to integrate.
> --
> David Duncan
> Apple DTS Animation and Printing
>
>
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to