• 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
Getting actual size of NSImage in NSImageView?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Getting actual size of NSImage in NSImageView?


  • Subject: Getting actual size of NSImage in NSImageView?
  • From: email@hidden
  • Date: Tue, 29 Apr 2003 15:23:05 -0700

I'm doing some dragging out of an NSImageView subclass, and I want the "dragImage" to be not the original image that is scaled down to fit inside the NSImageView, but a copy of the image that it the same size as what's displayed. (Otherwise, the original image, which is much bigger, pops up out of seemingly nowhere!)

I can ask the NSImageView for its size, and size the image to be that -- but that doesn't handle the proportions correctly, so the image is still not right.

Any suggestions for asking the NSImageView, or its NSImage, what size it is *currently* displaying at?


// CODE SNIPPET -- CLOSE, BUT NOT QUITE.

- dragImage
{
#warning -- not quite right.
NSSize viewSize = [self bounds].size;
NSImage *newImage = [[[self image] copy] autorelease];
[newImage setScalesWhenResized:YES];
[newImage setSize:viewSize];
return newImage;
}


--
Dan Wood
Karelia Software, LLC
email@hidden
http://www.karelia.com/
Watson for Mac OS X: http://www.karelia.com/watson/

The Arrogance of Power: <http://www.fatdawg.com/senbyrd.html>

To announce that there must be no criticism of the president, or that we are to stand by the president, right or wrong,is not only unpatriotic and servile, but is morally treasonable to the American public.
-- Theodore Roosevelt _______________________________________________
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.
  • Follow-Ups:
    • Re: Getting actual size of NSImage in NSImageView?
      • From: "John C. Randolph" <email@hidden>
    • Re: Getting actual size of NSImage in NSImageView?
      • From: Nicholas Riley <email@hidden>
  • Prev by Date: Appending multiple dictionaries to a plist
  • Next by Date: Re: Newbie Build Error
  • Previous by thread: Re: Appending multiple dictionaries to a plist
  • Next by thread: Re: Getting actual size of NSImage in NSImageView?
  • Index(es):
    • Date
    • Thread