That's strange. When I'm doing this, it scale properly (but it's slow).

- (void)drawRect:(NSRect)aRect {
  if (!gSticky) {
    gSticky = [[NSImage imageNamed:@"sticky"] retain];
    [gSticky setCacheMode:NSImageCacheNever];
  }

NSRect src = NSMakeRect(0, 0, [gSticky size].width, [gSticky size].height); [gSticky drawInRect:[self bounds] fromRect:src operation:NSCompositeSourceOver fraction:1];
}

It look like this pdf is rather heavy to draw. Even when I open it in Preview (on a 2.2 Ghz Core 2 Duo) it need some times to display it.

Le 6 avr. 08 à 01:45, Mike R. Manzano a écrit :
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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org

This email sent to [EMAIL PROTECTED]


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to