Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Emulating PlotIconRefInContext icon transform behavior for CGImages
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emulating PlotIconRefInContext icon transform behavior for CGImages




On Apr 22, 2005, at 10:18 AM, David Niemeijer wrote:


Just to ensure I understand correctly, it accesses and manipulates the individual pixels of the icon bitmap directly, right? If so, it sounds like this is a destructive operation requiring the generation of a copy of the bitmap so that the original is not affected. Correct?

Correct.

Are the exact RGB transforms documented anywhere or could they be provided on this list, so that for pre-Tiger systems we can do the same raw pixel manipulations ensuring that an icon drawn by PlotIconRefInContext would looks exactly the same as a larger CGImage that we would "transform" ourselves? When icons and images are mixed in the same window one would prefer to get the same "looks" when the image need to be disabled or selected.

It looks like we have a "lighten" transformation for the disabled state and a "darken" transformation for the selected state.


Lighten:
for each pixel component, add 0xFF, and shift right by 1 bit. This pushes every component towards 0xFFFF.


Darken:
for each pixel component, shift right by 1
find the component with the largest value, and shift the other two components right by 1 again. This emphasizes the largest component. Don't do this step if all of the components (after the first right shift) are within 0x200 of each other - in this case, we have a gray pixel, and there's nothing to emphasize.


-eric

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartz-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Emulating PlotIconRefInContext icon transform behavior for CGImages (From: David Niemeijer <email@hidden>)
 >Re: Emulating PlotIconRefInContext icon transform behavior for CGImages (From: Eric Schlegel <email@hidden>)
 >Re: Emulating PlotIconRefInContext icon transform behavior for CGImages (From: David Niemeijer <email@hidden>)



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

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.