Using trackbar to adjust color filter of an image
I m trying to do wat my title above says however i m there is no change on my pic when i scroll the trackbar. i noe there is sth missing in my code ... can anyone help me out with this ? greatly appreciate it.
开发者_JAVA技巧private void SetTrackBarProp()
{
trackBar1.Maximum = 255;
trackBar1.Minimum = 0;
trackBar1.TickFrequency = 1;
}
private Bitmap ApplyRGBFilter(Bitmap pic2)
{
ColorFiltering filter = new ColorFiltering();
filter.Red = new IntRange(0, red);
filter.Blue = new IntRange(0, blue);
filter.Green = new IntRange(0, green);
Bitmap processedImage = filter.Apply(pic2);
return processedImage;
}
void picturebox2(object sender, PaintEventArgs e)
{
pictureBox2.Image = ApplyRGBFilter(pic2);
}
private void trackBar1_Scroll(object sender, EventArgs e)
{
red = trackBar1.Value;
}
Above is just a snippet of my code on the filtering part, "pic2" is the image that i can browsed from my computer with the browse button i had in my application. pictureBox2 will be the place where my pic2 will appear. THANKS A LOT IN ADVANCE !
It is not clear that the header files for the ColorFiltering
function. The only drawback of this Program is note of Header files.
精彩评论