Skip navigation.
 
mlRe: Making a "shaped" NSImage
FROM : John C. Randolph
DATE : Mon Nov 18 23:46:09 2002

On Monday, November 18, 2002, at 07:30 AM, Jeremy Faller wrote:

> All:
>
>  Hello everyone.  I have a question that I'm sure is pretty easy, 
> although I haven't quite been able to smurf it.
>
>  Let's pretend that I have an NSBezierPath that describes some 
> region, and I would like to draw an NSImage ONLY in the path.  I'm not 
> concerned right now with alpha, or any other component of the image. 
> Additionally, to make it easy, let's assume the path is blackColor. 
> Does anyone know how to do this?


See the method  -croppedImage  in CroppingImageView.m in:

http://developer.apple.com/samplecode/Sample_Code/Cocoa/
Cropped_Image.htm

In a nutshell, fill the path, and then composite the image over it 
using the NSCompositeSourceIn operation.

-jcr


John C. Randolph    <<email_removed>>  (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
http://developer.apple.com/cocoa/index.html
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Related mailsAuthorDate
mlMaking a "shaped" NSImage Jeremy Faller Nov 18, 16:30
mlRe: Making a "shaped" NSImage Ondra Cada Nov 18, 16:59
mlRe: Making a "shaped" NSImage Marco Binder Nov 18, 17:06
mlRe: Making a "shaped" NSImage Dave Mattson Nov 18, 18:25
mlRe: Making a "shaped" NSImage John C. Randolph Nov 18, 23:46
mlRe: Making a "shaped" NSImage Marco Binder Nov 19, 11:07