• 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 buggy when scaling images above real size?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSImage buggy when scaling images above real size?


  • Subject: Re: NSImage buggy when scaling images above real size?
  • From: Wade Tregaskis <email@hidden>
  • Date: Fri, 19 Mar 2004 10:52:45 +1100

I don't know what is causing your current problem, but perhaps you could avoid actually changing the size of the images by using a different method to composite? For example, something like this, using drawInRect:fromRect:operation:fraction: instead of one of the compositeToPoint... methods:
<snip>
That way you never have to change the cached size of the images, and instead you can just calculate the scaled NSSize as needed or store it somehow if you prefer.

Ah, so you can do that. Reading the documentation for that method I found it difficult to figure out exactly whether it scaled to fit the destination rect or just clipped to - if it's the latter then that would be easier for me, and may well solve my problem.

Having tried that, I find it's much faster when rendering the image at a larger size, although not so good when the image is small - NSImage's caching must provide some mechanism for scaling the image at small sizes efficiently.

Unfortunately, it has the problem that if you try to draw the image such that any part of it goes outside the view in which you're drawing, the whole window turns white, the app locks up, and the thrashing starts. This isn't the same problem as I was having originally - the thrashing isn't nearly as severe - but the app is definitely dead.

I'm pretty sure this shouldn't be happening - clipping is done automatically, isn't it?

Interestingly, after force quitting the app I get the following output from gdb:

Program received signal: "SIGTERM".
No stack.
No stack.

It appears clipping is not occurring and it's just overwriting anything in it's path. This introduces a problem - I can't just adjust the destination rect, since that would squish my image. So I have to translate my scaling back to the source rect, shrink that, translate that back to the destination, then draw. Ick. Surely I'm doing something wrong, something simple? :)

Wade Tregaskis
-- Sed quis custodiet ipsos custodes?
_______________________________________________
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 buggy when scaling images above real size? (From: Wade Tregaskis <email@hidden>)
 >Re: NSImage buggy when scaling images above real size? (From: "Louis C. Sacha" <email@hidden>)

  • Prev by Date: Re: NSView setHidden vs. setTransparent
  • Next by Date: Re: Renaming a project destroys it?
  • Previous by thread: Re: NSImage buggy when scaling images above real size?
  • Next by thread: NSFilenamesPboardType, sevices, Finder, multiple file selection and Find
  • Index(es):
    • Date
    • Thread