I'm tyring to add points to a a map. And regardless of how many pins are on this map, each pin will get its own color. I want to only change the hue
I'm using a template png that looks like this
I want to create function that when a new point occurs this file will get randomly colored.
How would I do this?
Code below I'm working with - I am unable to figure out how to throw random values in the matrix to output any good colors that are spaced far enough in the color palate
private Bitmap ColorMyPin()
{
Image imgPicture = Properties.Resources.green_MarkerBlank;
Bitmap bmp = new Bitmap(imgPicture.Width, imgPicture.Height);
ImageAttributes iaPicture = new ImageAttributes();
ColorMatrix cmPicture = new ColorMatrix(new float[][]
{
new float[] {0, 0, 0, 0, 0},
new float[] {0, 0, 0, 0, 0},
new float[] {0, 0, 0, 0, 0}, <-- //Hard part where do i throw random() values at
new float[] {0, 0, 0, 0, 0},
new float[] {0, 0, 0, 0, 0}
});
// Set the new color matrix
iaPicture.SetColorMatrix(cmPicture);
// Set the Graphics object from the bitmap
Graphics gfxPicture = Graphics.FromImage(bmp);
// New rectangle for the picture, same size as the original picture
Rectangle rctPicture = new Rectangle(0, 0, imgPicture.Width, imgPicture.Height);
// Draw the new image
gfxPicture.DrawImage(imgPicture, rctPicture, 0, 0, imgPicture.Width, imgPicture.Height, GraphicsUnit.Pixel, iaPicture);
return bmp;
}
After