Gustavo Puma
Gustavo Puma

Reputation: 1055

Get Color from 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,...);
}

I want something like the getcolor function above.

Upvotes: 2

Views: 2149

Answers (1)

Domenic
Domenic

Reputation: 112807

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

Upvotes: 5

Related Questions