简体   繁体   English

RGB和CMYK的TranslateColors()颜色范围

[英]TranslateColors() color range of RGB and CMYK

I am using the API TranslateColors() to convert RGB to CYMK. 我正在使用API​​ TranslateColors()将RGB转换为CYMK。 I could convert it. 我可以转换它。

http://www.tech-archive.net/Archive/Development/microsoft.public.win32.programmer.gdi/2007-10/msg00049.html http://www.tech-archive.net/Archive/Development/microsoft.public.win32.programmer.gdi/2007-10/msg00049.html

In the above sample RGB value is left shifted by 8 and passed to the above function. 在上面的示例中,RGB值左移8并传递给上面的函数。 And the result, CYMK is right shifted by 8. 结果是CYMK向右移8。

As I know CYMK values vary from 0 to 1. But the result are more than 1. 据我了解,CYMK值从0到1不等。但是结果超过1。

Can any one tell me how to get the CYMK values in 0-1. 谁能告诉我如何获得0-1的CYMK值。

RGB values are between the range 0-255 to get this range between 0-1 you will need to do: RGB值介于0-255之间, 0-255该范围介于0-1之间,您需要执行以下操作:

ic[0].rgb.red = (255.0 / 255.0) << 8 ;
ic[0].rgb.green = (0 / 255.0);
ic[0].rgb.blue = (0 / 255.0);

basically 基本上

value = value / max_range_of_value;

make sure the variables used are floats or decimals (or anything that supports decimals). 确保使用的变量为floatsdecimals (或任何支持小数的内容)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM