DateTime startTime = DateTime .Now;
ImageAttributes ia = new ImageAttributes();
ColorMatrix cm = new ColorMatrix();
cm.Matrix00 = cm.Matrix01 = cm.Matrix02 =
cm.Matrix10 = cm.Matrix11 = cm.Matrix12 =
cm.Matrix20 = cm.Matrix21 = cm.Matrix22 = 0.34f;
ia.SetColorMatrix(cm);
Bitmap bmp = new Bitmap (pictureBox1.Image);
Graphics g = Graphics .FromImage(bmp);
g.DrawImage(bmp, new Rectangle(0, 0, bmp.Width, bmp.Height), 0, 0, bmp.Width, bmp.Height, GraphicsUnit.Pixel, ia);
pictureBox2.Image = (Image)bmp;
button1.Text = ( DateTime .Now - startTime).TotalSeconds + " c." ;
* This source code was highlighted with Source Code Highlighter .
cm.Matrix00 = cm.Matrix11 = cm.Matrix22 = 0;
cm.Matrix33 = 0.25f;
* This source code was highlighted with Source Code Highlighter .
ColorMatrix cm = 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},
new float [] { 0, 0, 0, 0.25f, 0},
new float [] { 0, 0, 0, 0, 0},
});
* This source code was highlighted with Source Code Highlighter .
Source: https://habr.com/ru/post/60175/
All Articles