• 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: Can't cache image
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't cache image


  • Subject: Re: Can't cache image
  • From: Brock Brandenberg <email@hidden>
  • Date: Fri, 21 Mar 2003 13:51:18 -0600

Hi Ben.

> I tried that first (I should have mentioned that). I didn't have the
> setCacheMode line in my code. But when I started getting the "Can't cache
> image" error, I figured I need to set the NSImage to not cache (I guess I
> understood the error wrong).
>
> So any other thoughts on what could be the issue? Could it be that init my
> NSImage with just a size is not good enough to then lockFocus on? Sorry I am
> pretty new to Cocoa, so I hope this isn't obvious (I tried searching the
> archives).

I'd NSLog the size values after the statements:

NSImage *image1 = [[NSImage alloc] initByReferencingFile:[mergeArray
objectAtIndex:(numPages-(i+1))]];

and

[image1 setSize:NSMakeSize([image1 size].width*(204.0/72.0),[image1
size].height*(196.0/72.0))];

... and see if the size values are what you think they are. If you pass
{0,0} to NSImage, it will initialize, but will not work until you explicitly
set the size to a non-zero rect size.

Also, the initByReferencingFile: is a lazy method, so you may not have the
NSImage in a usable state at the time you want to access its properties. I
don't use this method, but there are some caveats to it so you might look at
its docs more closely or swap in initWithContentsOfFile: as a quick sanity
check. There is also an isValid method for NSImage to check its state. I
know the technique of initializing with a size and immediately locking focus
and drawing works because I'm using it now to resample images :)

Brock

----- industrial design @ www.bergdesign.com ------
_______________________________________________
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: 
 >Re: Can't cache image (From: Ben Mackin <email@hidden>)

  • Prev by Date: Re: Can't cache image
  • Next by Date: Re: Sheet over a sheet ?
  • Previous by thread: Re: Can't cache image
  • Next by thread: Re: Can't cache image
  • Index(es):
    • Date
    • Thread