OpenXML 方案颜色转换 - 应用
处理打开的 xml 文档时,颜色可以对基色进行各种变换以生成相对颜色。例如
会将基色饱和度修改 25%。我能找到的信息很少,有两种转换:
<a:gamma>
文档说“此元素指定生成应用程序渲染的输出颜色应该是输入颜色的 sRGB gamma 偏移。”
并且
<a:invGamma>
文档说“此元素指定生成应用程序渲染的输出颜色应该是输入颜色的逆 sRGB gamma 偏移。”
我想了解我必须对基色进行哪些计算才能使用这些转换中的任何一个来转换它。有人弄清楚这一点了吗?
When processing an open xml document, colors can have various transformations applied to a base color to generate a relative color. For instance <a:satMod value="25000">
would modify the base colors saturation by 25%. There are two transforms I have been able to find very little information on and they are:
<a:gamma>
The docs say "This element specifies that the output color rendered by the generating application should be the sRGB gamma shift of the input color."
and
<a:invGamma>
The docs say "This element specifies that the output color rendered by the generating application should be the inverse sRGB gamma shift of the input color."
I would like to understand what calculation I would have to do on the base color to transform it using either of these transformations. Has anybody figured this out?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的。简单来说,
只是表示获取 sRGB 值(0-1 刻度)并将其线性化(转换为线性 RGB)。获取这些线性 RGB 值并将它们保存为 sRGB(如果需要,可以转换为 0-255 范围)。
则相反 - 获取线性 RGB 值(0-1 刻度)并将其去线性化(转换为 sRGB)。获取这些去线性化的 RGB 值并将它们保存为 sRGB(如果需要,可以转换为 0-255 范围)。那么什么是线性RGB呢?计算结果位于维基百科的 sRGB 页面。
这也是一个 VBA 版本:
您传入的
value
是 0-1 范围内的 R、G、B 分量,可以是 sRGB 或线性 RGB。您将收到相同的范围(0-1),然后根据您的需要,您可以转换为 0-255 范围来构建您的颜色。Yeah. Simply put,
<a:gamma>
simply means to take the sRGB value (0-1 scale) and linearize it (convert to linear RGB). Take those linear RGB values and save them as sRGB (and convert to 0-255 range if you want).<a:invGamma>
is the opposite - take the linear RGB value (0-1 scale) and delinearize it (convert to sRGB). Take those delinearized RGB values and save them as sRGB (and convert to 0-255 range if you want).So what is linear RGB? The calculation is here on Wikipedia's sRGB page.
Here's also a VBA version:
The
value
that you pass in is the R, G, B component in 0-1 range, either sRGB or linear RGB. You'll receive the same range back, 0-1, and depending on your needs, you can then convert to 0-255 range to construct your color.