Hi,
I have a image of surfboard(i.e. the object i have to color) (in any format)..
I want to set color to surfboard only.
Also I have to add border to surfboard with different color.
public static Bitmap setColour(string NewFileName)
{
ColorDialog cDia = new ColorDialog();
if (cDia.ShowDialog() == DialogResult.OK)
{
Graphics NewGraphics = Graphics.FromImage(NewBitmap);
float[][] FloatColorMatrix = { new float[] { float.Parse(cDia.Color.R.ToString())/255,0,0,0,0}, new float[] { 0,float.Parse(cDia.Color.G.ToString())/255,0,0,0}, new float[] { 0,0,float.Parse(cDia.Color.B.ToString())/255,0,0}, new float[] { 0,0,0,1,0 }, new float[] { 0.11F,0.0F,0.0F,0.0F,1} };
ColorMatrix NewColorMatrix = new ColorMatrix(FloatColorMatrix);
ImageAttributes Attributes = new ImageAttributes();
Attributes.SetColorMatrix(NewColorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Default);
NewGraphics.DrawImage(NewBitmap, new Rectangle(0, 0, NewBitmap.Width, NewBitmap.Height), 0, 0, NewBitmap.Width, NewBitmap.Height, System.Drawing.GraphicsUnit.Pixel, Attributes);
NewGraphics.Dispose();
}
return NewBitmap;
}
Please help me for this..