Asked by:
Shade , Tint, satMod percent values
Question

Hi All,
How to calculate values for <a:tint> and <a:shade>. Not finding any proper formula.
<a:shade val="25000"/>
what is shade %? Is it 25?
If yes,
What if its <a:shade val="250000"/>
what is shade %? Is it 250?
Any standard formula to get %?
 Edited by NacyDrew Thursday, November 10, 2011 10:04 AM
All replies



Also,
As per thread:
http://social.msdn.microsoft.com/Forums/enUS/oxmlsdk/thread/f6d26f2c114f4a0d8bcaa27442aec4d0
The concluded method of applying tints or shades is:
1. Convert hex to rgb
2. rgb to srgb (by dividing by 255)
3. srgb to linear rgb using the algo from thread
4. Apply tints or shades as:
=IF(Red*Shade<0,0,IF(Red*Shade>1,1,Red*Shade))
=IF(Green*Shade<0,0,IF(Green*Shade>1,1,Green*Shade))
=IF(Blue*Shade<0,0,IF(Blue*Shade>1,1,Blue*Shade))
· *Or* Tint each component using these formulas where Tint is a value from 01:
=IF(Tint>0,Red*(1Tint)+Tint,Red*(1+Tint))
=IF(Tint>0,Green*(1Tint)+Tint,Green*(1+Tint))
=IF(Tint>0,Blue*(1Tint)+Tint,Blue*(1+Tint))
5. Convert linear rgb to srgb by algo from above thread
6. Convert srgb back to rgb ( val*255)
7. back to hex
But,
For hex = #FF99FF with <a:shade val="25000" > i.e 0.25
Output produced is #884F88 by my way
where as per office it should produce #895089
(though these two are very similar)
Is this process correct ?
If am missing anything please let me know the right way.
Thanks
 Edited by NacyDrew Friday, November 11, 2011 12:21 PM

I think your must have some rounding errors.Red = 0xFFdivide by 255 = 1the algorithm function returns: 1shading returns 0.25the second algorithm returns 0.537098730483194multiply by 255: 136.960176273214round to 137in hex: 89Green = 0x99divide by 255 = 0.6algorithm gives 0.318546778125092shading gives 0.079636694531273algorithm gives 0.31260632082132times 255 gives 79.7146118094366round to 80in hex 50Blue same as red gives #895089
Enjoy,
Tony
www.WordArticles.com 


But what if shade or tint % is above 100?It can't be  it would violate the schema and PowerPoint wouldn't open the file.
Enjoy,
Tony
www.WordArticles.com