Re: Creating an NSImage from an NSImage
Re: Creating an NSImage from an NSImage
- Subject: Re: Creating an NSImage from an NSImage
- From: Fritz Anderson <email@hidden>
- Date: Tue, 26 Nov 2002 16:34:33 -0600
- Resent-date: Tue, 26 Nov 2002 17:10:56 -0600
- Resent-from: Fritz Anderson <email@hidden>
- Resent-message-id: <email@hidden g>
- Resent-to: email@hidden
Being able to step through with a debugger would be helpful...
Are you sure that destRect.origin is {0,0}? If the origin is 'way
outside the {{0,0}, destRect.size} NSRect, all you'll get is a virgin
image, which, depending on the color space, might be all-black.
Second thoughts: Is the source image all-black at srcRect, and is
srcRect what you think it is? I know you're pretty sure of the answers,
but if everything were as you are pretty sure it is, then you wouldn't
have a bug.
-- F
On Monday, November 25, 2002, at 10:59 PM, tim lindner wrote:
In my subclass of NSImageView, I created a method to return a NSImage
based upon
two rectangles:
- (NSImage *) croppedImage: (NSRect)srcRect destination: (NSRect)
destRect
{
NSImage *newImage = [[NSImage alloc] initWithSize:destRect.size];
[newImage lockFocus];
[[self image] drawInRect:destRect fromRect:srcRect
operation:NSCompositeCopy
fraction:1.0 ];
[newImage unlockFocus];
return [newImage autorelease];
}
But the image returned is just black. What am I doing wrong?
--
Fritz Anderson - Consulting Programmer - Chicago, IL
Mail: <email@hidden>
Risumi: <
http://resume.manoverboard.org>
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.