• 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: NSImage drawing way too small
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSImage drawing way too small


  • Subject: Re: NSImage drawing way too small
  • From: Thomas Finley <email@hidden>
  • Date: Sun, 29 Jun 2003 09:31:16 -0400

On Sunday, June 29, 2003, at 05:31 AM, Jon Hull wrote:
I have a very simple screensaver which draws a white screen with a picture on the left side. The problem is that the picture is drawing way too small (about 6%). The picture opens in normal size in Preview and Photoshop... but in the screensaver it draws small. It is actually a very large image (bigger than my screen) maybe that has something to do with it.
Has anyone seen anything like this before?

I had the same problem with a few JPEG files in an image tool I wrote. The problem is that the height or width of the image is sometimes set differently from the _pixel_ height or width of the image. When compositing the image, it puts the image in a box of the size of the image.

Fortunately, setting the size of an image is trivial, and the pixel width and height can be obtained from any image representation. (I personally limited myself to only changing size based on NSBitmapImageRep representations, but this is not required.) Where "image" is a "NSImage *" and "rep" is some "NSImageRep *" of that image (obtained by [image representations]), you can change the size by:

[image setSize:NSMakeSize([rep pixelsWide], [rep pixelsHigh])];

After that, when I composited "image", it appeared in a more familiar size.
_______________________________________________
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.
References: 
 >NSImage drawing way too small (From: Jon Hull <email@hidden>)

  • Prev by Date: Re: @Strings and strings in C
  • Next by Date: Re: JavaBridge question
  • Previous by thread: NSImage drawing way too small
  • Next by thread: JavaBridge question
  • Index(es):
    • Date
    • Thread