How to use use cmyk color codes in android?

▼魔方 西西 提交于 2020-01-06 08:31:38

问题


I have an doubt, I don't know how to use cmyk colors in android. If any one knows please help me. I am waiting for your valuable replies.


回答1:


You just need a function, which converts the CMYK value to RGB? Or do you want to convert a whole image, which is CMYK?

For the first problem, as pseudocode rgb2cmyk:

int r,g,b,c,m,y,k;
int computedC,computedM,computedY;
int minCMY;

if(r==0 && g==0 && b==0) return {0,0,0,1}

computedC = 1 - (r/255);
computedM = 1 - (g/255);
computedY = 1 - (b/255);

minCMY = Math.min(computedC,Math.min(computedM,computedY));

computedC = (computedC - minCMY) / (1 - minCMY) ;
computedM = (computedM - minCMY) / (1 - minCMY) ;
computedY = (computedY - minCMY) / (1 - minCMY) ;

return {computedC,computedM,computedY,minCMY};

And for the other way around, just calculate it backwards :)

For the problem no. 2: Its easier, 'cause there is a special tool called ColorSpace: How do I convert images between CMYK and RGB in ColdFusion (Java)?

Hope that helps :3



来源:https://stackoverflow.com/questions/3315439/how-to-use-use-cmyk-color-codes-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!