Re: NSImage buggy when scaling images above real size?
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.