Image loading design suggestions ?
Image loading design suggestions ?
- Subject: Image loading design suggestions ?
- From: Erik Buck <email@hidden>
- Date: Sat, 14 Jan 2006 14:37:14 -0500
I post this to the Cocoa list because I am looking for a Cocoa/
Objecive-C way to handle images, but the CIImage and QCRenderer
Objective-C classes are not strictly speaking Cocoa. I will move to
another list if this is considered off-topic for Cocoa.
I have a Cocoa application that I am updating to use CIImage and
QCRenderer instead of the antiquated Quicktime C API.
I used to use NSFileManager's -enumeratorAtPath: to recursively
search for images/animations with a particular extension and load
them. I used Quicktime to load the images/animations. I then used
the size provided by Quicktime to determine the right power of 2
dimensions for OpenGL pixel buffers. Finally, I used Quicktime to
render the images/animations into the pixel buffers.
CIImage and QCRenderer nicely load images and animations (sometimes
including Quicktime animations within the QC files). However, they
both seem to discard the original image dimensions stored in the
image files that are loaded, and QC doesn't have intrinsic
dimensions. I have to know what size the OpenGL pixel buffers should
be in order to create the pixel buffers and render the CIImage or QC
animations into the pixel buffers.
What does the list wisdom think of various alternatives ?
1) Provide a configuration file that specifies the paths to images
and the appropriate sizes instead of searching for images and reading
the size out of the image data. This duplicates information, is
susceptible to human error, and is less convenient.
2) Use NSBitmapImageRep to load the images, get their size, and then
convert them to CIImages. This requires twice the memory and
processing while images are loaded, but that is a temporary state and
is probably "fast enough". This doesn't work for QC animations.
3) Use Quicktime to load the images, get their size, and then convert
them to CIImages. This requires twice the memory and processing
while images are loaded, but that is a temporary state and is
probably "fast enough". This doesn't work for QC animations but does
work for Quicktime animations.
4) Find some way to store preferred pixel buffer sizes within the QC
files and find some way to get the information from CIImage. This is
my preferred approach, but I haven't yet connected the dots...
5) Find some other Cocoa/Objective-C way: I don't want to go back to
the old pre-CI Quicktime to OpenGL solution.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden