• 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: Creating an NSImage from an NSImage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Re: Vermont Recipes vs Building Cocoa Applications
  • Next by Date: Re: Single document behavior
  • Previous by thread: Creating an NSImage from an NSImage
  • Next by thread: Newbie Question - selecting textFields
  • Index(es):
    • Date
    • Thread