Hi - I am trying to set the transperency of an icon, based on certain conditions. Essentially I am trying to achieve the "disabled" icon look. I was able to find code that is supposed to achieve this look, but it does not. Instead what I get is an icon with a blue tinge. I would have posted the image, but am not sure if one can or how. I am no expert at graphics and would not even know where to begin to resolve this issue.
Code block:
[code=cpp]
public static Bitmap returnAlpha(Bit map bmp, int alpha)
{
Color col;
Bitmap bmp2 = new Bitmap(bmp);
for (int i = 0; i < bmp.Width; i++)
for (int j = 0; j < bmp.Height; j++)
{
col = bmp.GetPixel(i, j);
if (col.A > 0)
bmp2.SetPixel(i , j, Color.FromArgb( min(col.A - alpha), col.R, col.G, col.B));
}
return bmp2;
}[/code]
Is anyone aware of code that can achieve this look. I cannot seem to locate anything. I will not pretend to want to know how this works, so actual source code will help as opposed to theory. Thanks a bunch in advance!!
Code block:
[code=cpp]
public static Bitmap returnAlpha(Bit map bmp, int alpha)
{
Color col;
Bitmap bmp2 = new Bitmap(bmp);
for (int i = 0; i < bmp.Width; i++)
for (int j = 0; j < bmp.Height; j++)
{
col = bmp.GetPixel(i, j);
if (col.A > 0)
bmp2.SetPixel(i , j, Color.FromArgb( min(col.A - alpha), col.R, col.G, col.B));
}
return bmp2;
}[/code]
Is anyone aware of code that can achieve this look. I cannot seem to locate anything. I will not pretend to want to know how this works, so actual source code will help as opposed to theory. Thanks a bunch in advance!!