• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Simulate Photoshop's "Overlay" compositing method
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simulate Photoshop's "Overlay" compositing method


  • Subject: Re: Simulate Photoshop's "Overlay" compositing method
  • From: Shawn Erickson <email@hidden>
  • Date: Thu, 02 Nov 2006 07:44:31 -0800


On Nov 2, 2006, at 7:26 AM, Jesse Grosjean wrote:

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


  • Follow-Ups:
    • Re: Simulate Photoshop's "Overlay" compositing method
      • From: Jesse Grosjean <email@hidden>
References: 
 >Re: Simulate Photoshop's "Overlay" compositing method (From: Jesse Grosjean <email@hidden>)

  • Prev by Date: Re: Simulate Photoshop's "Overlay" compositing method
  • Next by Date: Re: Open my Application via safari
  • Previous by thread: Re: Simulate Photoshop's "Overlay" compositing method
  • Next by thread: Re: Simulate Photoshop's "Overlay" compositing method
  • Index(es):
    • Date
    • Thread