Re: NSImage vs. NSBitmapImageRep color differences?
Re: NSImage vs. NSBitmapImageRep color differences?
- Subject: Re: NSImage vs. NSBitmapImageRep color differences?
- From: Thomas Finley <email@hidden>
- Date: Mon, 30 Jun 2003 11:54:53 -0400
On Monday, June 30, 2003, at 11:10 AM, Christopher Nagel wrote:
// This yields a yellowish image
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, [image size].width,
[image size].height, 0, GL_RGB, GL_UNSIGNED_BYTE,
[[image TIFFRepresentation] bytes] );
Yeah, that won't work, but why would you expect it to? GL accepts raw
pixel data for a texture, which a TIFFRepresentation will not provide
-- this code is functionally equivalent to dumping the raw data of a
TIFF file for use as a GL texture.
The only reason I can imagine why it even almost seems to work is
because TIFFRepresentation probably produces an image without
compression, which must be close enough to the raw pixels to resemble
the image somehow.
Yet NSBitmapImageRep is initialized with TIFFRepresentation.
That shouldn't matter. You could initialize it with any representation
you like, and bitmapData would always returns the raw pixels.
I was trying to avoid the overhead of creating the NSBitmapImageRep,
just for kicks.
You might check if [image representations] already has a bitmap image
rep rather than always creating one. WIth many types of files (i.e.
TIFFs, JPEGs, BMPs, etc) that representation will already exist in the
image, and only in cases where it does not exist would you be forced to
create the rep.
_______________________________________________
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.