none
Shade , Tint, satMod percent values RRS feed

  • 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
    Thursday, November 10, 2011 10:03 AM

All replies

  • Hi NacyDrew,

    Would you please tell me where this tag will be use, Excel, Word or PowerPoint?

    Have a good day,

    Ice

    Friday, November 11, 2011 2:29 AM
  • It will be used in powerpoint.

    Thanks in advance

    Friday, November 11, 2011 10:37 AM
  • Also,

    As per thread:

    http://social.msdn.microsoft.com/Forums/en-US/oxmlsdk/thread/f6d26f2c-114f-4a0d-8bca-a27442aec4d0

    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 0-1:

     

    =IF(Tint>0,Red*(1-Tint)+Tint,Red*(1+Tint))

    =IF(Tint>0,Green*(1-Tint)+Tint,Green*(1+Tint))

    =IF(Tint>0,Blue*(1-Tint)+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
    Friday, November 11, 2011 10:43 AM
  • I think your must have some rounding errors.
     
    Red = 0xFF
    divide by 255 = 1
    the algorithm function returns: 1
    shading returns 0.25
    the second algorithm returns 0.537098730483194
    multiply by 255: 136.960176273214
    round to 137
    in hex: 89
     
    Green = 0x99
    divide by 255 = 0.6
    algorithm gives 0.318546778125092
    shading gives 0.079636694531273
    algorithm gives 0.31260632082132
    times 255 gives 79.7146118094366
    round to 80
    in hex 50
     
    Blue same as red gives #895089
     

    Enjoy,
    Tony
    www.WordArticles.com
    • Marked as answer by NacyDrew Thursday, November 17, 2011 9:38 AM
    • Unmarked as answer by NacyDrew Thursday, November 17, 2011 9:53 AM
    Wednesday, November 16, 2011 7:54 PM
  • Thanks tony values helped to solve the problem
    Thursday, November 17, 2011 9:38 AM
  • But what if shade or tint % is above 100?
    Thursday, November 17, 2011 9:53 AM
  • 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
    Friday, November 18, 2011 8:38 AM