问题
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