Re: Simulate Photoshop's "Overlay" compositing method
Re: Simulate Photoshop's "Overlay" compositing method
- Subject: Re: Simulate Photoshop's "Overlay" compositing method
- From: Jesse Grosjean <email@hidden>
- Date: Thu, 2 Nov 2006 12:04:28 -0500
Thanks. I was thinking that it must be possible using the standard
NSComposite methods and so didn't really think about Core Image. But
the core image CIWhitePointAdjust filter makes it easy.
Jesse
I'm reviving this old thread because I have the same need. Here's
what I'm trying to simulate in photoshop:
1. Double click on Photoshop layer to open layer style panel.
2. Check "Color Overlay".
3. Choose a "Blend Mode" of "Darken".
4. Choose an Opacity of 100%.
The goal is to replace white with the overlay color, while leaving
dark alone.
I can come close with this modified code from the archives:
NSSize theSize = [originialImage size];
NSImage *theNewImage = [[[NSImage alloc] initWithSize:theSize]
autorelease];
[theNewImage lockFocus];
[originialImage compositeToPoint:NSZeroPoint
operation:NSCompositeSourceOver];
[tintColor set];
[[NSGraphicsContext currentContext]
setCompositingOperation:NSCompositePlusDarker];
NSRect r = NSZeroRect;
r.size = [theNewImage size];
[inTint setFill];
[NSBezierPath fillRect:r];
[theNewImage unlockFocus];
return theNewImage;
But it's not handling transparency in the original image that way
that I would like. In the above code transparent regions in the
original image will be filled with 100% of the tintColor. Instead
I want transparency in the original image to be persevered in
theNewImage.
Thanks for any help or pointers.
You may want to look at using Core Image for this type of thing.
-Shawn
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden