如何设置PDEColorValue?
我正在尝试将一些文本写入 PDF,但我的问题在于颜色。我正在使用 RGB 颜色空间,这就是我的代码的样子。
memset(&pdeColorValue, 0, sizeof(PDEColorValue));
pdeColorValue.color[0] = FloatToFixedAS(255.0f);
pdeColorValue.color[1] = FloatToFixedAS(0.0f);
pdeColorValue.color[2] = FloatToFixedAS(0.0f);
现在上面给了我一个漂亮的红色,一切都很好。但是,当我想将颜色更改为棕色(R,G,B = 100,0,0)时,如果我将第一个值设置为 100.0f,它仍然会给我相同的红色。我怎样才能得到想要的颜色?
I am trying to write some text to a PDF, and my problem is with the color. I am using the RGB Color Space, and this is what my code looks like.
memset(&pdeColorValue, 0, sizeof(PDEColorValue));
pdeColorValue.color[0] = FloatToFixedAS(255.0f);
pdeColorValue.color[1] = FloatToFixedAS(0.0f);
pdeColorValue.color[2] = FloatToFixedAS(0.0f);
Now the above gives me a nice red color and everything's fine. But when I want to change the color to, say a brown (R,G,B = 100,0,0), if I set the first value to 100.0f, it still gives me the same red color. How am I to get the desired colors?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试将范围从
0 <= x <= 255
更改为0 <= x <= 1.0
我对
PDEColorValue< 不太熟悉/code>,但 RBG 值很常见为 0 到 1.0 之间的小数。
确实,255 是 RGB 参数的正确值,但每个实现都不同。
Try changing the range from
0 <= x <= 255
to0 <= x <= 1.0
I'm not very familiar with
PDEColorValue
, but it's quite common for RBG values to be either a decimal between 0 and 1.0.It is true that 255 is a correct value for RGB parameters, yet again, each implementation is different.