• 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: Avoiding Cached ImageReps?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Avoiding Cached ImageReps?


  • Subject: Re: Avoiding Cached ImageReps?
  • From: Tom Waters <email@hidden>
  • Date: Sun, 7 Jul 2002 15:02:13 -0700

you can get it back...

- (NSBitmapImageRep *)bitmapRep
{
NSBitmapImageRep *rep = [[self representations] objectAtIndex:0];
if (![rep isKindOfClass:[NSBitmapImageRep class]]) {
id birep = [NSBitmapImageRep imageRepWithData:[self TIFFRepresentation]];
[self removeRepresentation:rep];
[self addRepresentation:birep];
rep = birep;
}
return rep;
}

i wrote this category on NSImage to say "get me the bits back and replace that pesky cachedimagerep with it".

might not be exactly right for your application, but it shows you how to use TIFFRepresentation, which is what you are looking for...


On Sunday, July 7, 2002, at 02:46 PM, Fritz Anderson wrote:

I'm working on a simple bitmap-analysis program. The user pulls in images though NSImage and then selecting parts of the images for further work. The application attempts to obtain the underlying bitmap data through NSBitmapImageRep.

It seems that as soon as I lock focus on the image, the contained representation becomes an NSCachedImageRep, and the underlying bitmap is forever out of my reach. This means I can't use much of Cocoa (or at least much of NSImage and its cousins) to do the convenience and human-interface work leading up to my bitmap-level image processing.

Now, I recognize that there are good performance reasons (which Apple has promised will soon become even better) to want to turn buffers over to hardware. I also know that much (_but not all_) low-level graphics work is unsuited to Cocoa-level programming.

It just seems to me that once I entrust data to Cocoa, I ought to be able to trust Cocoa to give me my data back. (I swear I'm not trying to generate unauthorized re-dithers of trademarked or copyrighted mice, if that's the issue.)

Is there some way to achieve this? Or, if Cocoa is not the higher-than-POSIX level for reading, presenting, and moving images, can someone point me in the right direction in, for instance, Core Graphics?

-- F

[Apologies if this comes as a re-send; I was a bit confused about my subscription.]

--
Fritz Anderson - Consulting Programmer - Chicago, IL
Mail: <email@hidden>
Risumi: <http://resume.manoverboard.org>
_______________________________________________
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.
_______________________________________________
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: 
 >Avoiding Cached ImageReps? (From: Fritz Anderson <email@hidden>)

  • Prev by Date: Re: Preview in Internet Explorer
  • Next by Date: Re: Tabbing a NSTableView
  • Previous by thread: Avoiding Cached ImageReps?
  • Next by thread: Re: Avoiding Cached ImageReps?
  • Index(es):
    • Date
    • Thread