Re: Scaling a window background image quickly
Re: Scaling a window background image quickly
- Subject: Re: Scaling a window background image quickly
- From: "Mike R. Manzano" <email@hidden>
- Date: Sat, 5 Apr 2008 16:45:01 -0700
Unfortunately, that still didn't work. The resultant images continue
to be pixelated, as you can see here:
http://instantvoodoomagic.com/stickycapture.png
In my window's -awakeFromNib:
gStickyImage = [NSImage imageNamed:@"sticky.pdf"] ;
[gStickyImage setDataRetained:YES] ; // Setting this to NO doesn't
seem to make a difference
[gStickyImage setCacheMode:NSImageCacheNever] ;
In -drawRect:
NSRect stickyBounds ;
// [gStickyImage setScalesWhenResized:YES] ;
// [gStickyImage setSize:[self bounds].size] ;
stickyBounds.size = [gStickyImage size] ;
stickyBounds.origin.x = stickyBounds.origin.y = 0.0f ;
[gStickyImage drawInRect:[self bounds]
fromRect:stickyBounds
operation:NSCompositeSourceAtop
fraction:1.0f] ;
If I uncomment the two lines in -drawRect:, the sticky is rendered
sharply, but as I noted before, it takes a long time to scale:
http://instantvoodoomagic.com/stickycapture2.png
Here's the original PDF:
http://instantvoodoomagic.com/sticky.pdf
Thanks for the suggestions so far. If I figure it out, I'll post my
solution.
Mike
On Apr 5, 2008, at 11:59 AM, Jean-Daniel Dupas wrote:
This is because Cocoa cache the first representation it draws and
then redraw the cached version.
Disabling the cache for your image should do the trick:
[_img setCacheMode:NSImageCacheNever];
Le 5 avr. 08 à 20:26, Mike R. Manzano a écrit :
I did try that at first, but the image becomes pixelated when you
make the window larger. What I'm trying now is to do an initial
scale of the image to some large dimensions, and then doing what
you suggested. Maybe it will look fine if the only scaling it has
to do is in the downwards direction.
Mike
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden