On Mar 6, 2014, at 8:34 AM, Leonardo <[email protected]> wrote:
> 
> Hi, I have an oval NSBezierPath path. I fill it with a blue color,
> then I draw an image within the same path. And I can still see a blue tiny
> border around the image. I would expect the color be never visible since the
> image covers the whole area. That's my code:
> 
> fillPath = [NSBezierPath bezierPathWithOvalInRect:fillBounds];
> [aBlueColor set];
> [fillPath fill];
> [fillPath addClip];
> [image drawInRect:fillBounds fromRect:NSZeroRect
> operation:NSCompositeSourceOver fraction:1.0];
> 
> Even if I draw the image in a bigger rect, the blue border is still there.
> What do I miss?

Due to antialiasing, the fringes of your mask have alpha < 1.

Let’s say there’s a pixel on the fringe of your mask that winds up with alpha 
0.5. Using your code, that pixel's final color will be 0.5 * (0.5 * Original 
background color + 0.5 * blue) + 0.5 * (color from image).

--Kyle Sluder

_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to