Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: User Spaces vs. Generic Spaces




On May 16, 2005, at 1:31 PM, Andrew Kimpton wrote:


On May 12, 2005, at 11:04 AM, Haroon Sheikh wrote:


Brendan does  a good job describing the issue.

DeviceRGB, CMYK, & Gray color spaces are deprecated. You should always use GenericRGB, etc. instead. GenericRGB represents an ideal 1.8 gamma Mac color space that all monitors strive to achieve. Think of it similar to sRGB but different gamma.

Are there performance impacts between the various colorspaces ?

For example we've been using (old code - I plan to update it) DeviceRGB, recently our marketing people noticed that some of our UI doesn't match the photoshop produced art they're used to seeing and I determined that the photoshop art was was using sRGB. I made the minor change to tweak our code to use the alternative colorspace but saw such a dramatic performance loss i backed my changes out again (at least for now 8-)

Any thoughts/suggestions ?

Andrew 8-)

This part I think I understand. :-)

If your code is reading in images, and those images are tagged as sRGB, when the application draws the images to the screen, they will have to go through a color management step. That color management step takes some time.

Your best bet would be to read the images and perform the color management on them once, then repeatedly draw the modified images. There are several strategies you might take to do this.

If you need to support something "less than" 10.3, you can create a bitmap context on your own memory and set that context's color space to either the generic space or (even better) the color space of the monitor. Then you can draw your image into that bitmap context and the system will run it through the color matching. You create a new CGImage from the results of that drawing (and dispose of the bitmap context). What you are left with is a representation of your image in a color space that will require little or no color matching.

If you support 10.3 and above, you can probably get away with using CGImageCreateCopyWithColorSpace. As you read in each image, create a copy and change the color space to the generic RGB space, or the color space of your monitor.

If you are working on 10.4, then you might find some advantage to drawing your UI elements into a CGLayer. A CGLayer is something like a mutable offscreen image when you are planning to draw that image repeatedly to the same context. When you create a CGLayer you associate it with the context that you will eventually be drawing on. Then, as you add things to the layer, the computer can optimize the repeated drawing of that layer to the destination context. That means, for example, that the CGLayer might choose to do the color matching up front once. If you can be Tiger only, I would at least consider trying CGLayer and see if it restores your performance.

Or you could talk your UI designers into using a color space other than sRGB :-)

Scott



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartz-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartz-dev/email@hidden

This email sent to email@hidden
References: 
 >User Spaces vs. Generic Spaces (From: "R. Scott Thompson" <email@hidden>)
 >Re: User Spaces vs. Generic Spaces (From: Brendan Younger <email@hidden>)
 >Re: User Spaces vs. Generic Spaces (From: Haroon Sheikh <email@hidden>)
 >Re: User Spaces vs. Generic Spaces (From: Andrew Kimpton <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.