Re: I just don't get NSAffineTransform and compositeToPoint:
Re: I just don't get NSAffineTransform and compositeToPoint:
- Subject: Re: I just don't get NSAffineTransform and compositeToPoint:
- From: James Housley <email@hidden>
- Date: Mon, 14 Mar 2005 06:16:23 -0500
On Mar 13, 2005, at 10:59 PM, Serge Meynard wrote:
NSImage* newImage = [[NSImage alloc] initWithSize:
newImageBounds.size];
NSBezierPath* croppingPath = [selectionMarker selectedPath];
[newImage lockFocus];
[[NSGraphicsContext currentContext] saveGraphicsState];
NSAffineTransform* pathAdjustment = [NSAffineTransform transform];
[pathAdjustment translateXBy:-newImageBounds.origin.x
yBy:-newImageBounds.origin.y];
[pathAdjustment concat];
[[NSGraphicsContext currentContext] setShouldAntialias:NO];
[[NSColor clearColor] set];
NSRectFill(newImageBounds);
[[NSColor blackColor] set];
[croppingPath fill];
[[self image] compositeToPoint:newImageBounds.origin
fromRect:newImageBounds operation:NSCompositeSourceIn];
[[NSGraphicsContext currentContext] restoreGraphicsState];
[newImage unlockFocus];
Thank you that worked perfectly. It looks like some of the major
differences that were you [[NSGraphicsContext currentContext]
save/restore....] and the [pathAdjustment concat]. That and
copositeToPoine:newImageBounds instead of NSZeroPoint.
This works and I am greatful, I also understand a little better.
Jim.
--
/"\ ASCII Ribbon Campaign .
\ / - NO HTML/RTF in e-mail .
X - NO Word docs in e-mail .
/ \ -----------------------------------------------------------------
email@hidden http://www.FreeBSD.org The Power to Serve
email@hidden http://www.TheHousleys.net
---------------------------------------------------------------------
Do not meddle in the affairs of dragons, for you are crunchy and taste
good with ketchup.
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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