从int获取颜色 [英] Get Color from int

查看:246
本文介绍了从int获取颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在显示灰度图像的直方图,我想绘制每条线的相应颜色。例如:

I'm displaying a histogram for a grayscale image and I would like to draw each line with its respective color. For example:

for(int i=0;i<256;i++)
{
  Color c=getcolor(i);
  drawline(c,x,y,...);
}



我想要类似上面的getcolor函数。

I want something like the getcolor function above.

推荐答案

private static Color getcolor(int grayScale)
{
   return Color.FromArgb(grayScale, grayScale, grayScale);
}

这篇关于从int获取颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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