如何使用cmyk颜色代码在Android中? [英] How to use use cmyk color codes in android?

查看:405
本文介绍了如何使用cmyk颜色代码在Android中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个疑问,我不知道如何使用cmyk颜色在android。如果有人知道,请帮助我。

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.

推荐答案

您只需要一个将CMYK值转换为RGB的函数?

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

对于第一个问题,作为伪代码rgb2cmyk:

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 :)

对于问题no。 2:
它更容易,因为有一个名为ColorSpace的特殊工具:

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这有助于:3

Hope that helps :3

这篇关于如何使用cmyk颜色代码在Android中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆