w ImageAttributes () ;. SetColorMatrix (cm); temp=new Bitmap (bmp.Width, bmp.Height); gr=Graphics.FromImage (temp);.DrawImage (Bmp, new Rectangle (0, 0, bmp.Width, bmp.Height), 0, 0, bmp.Width, bmp.Height, GraphicsUnit.Pixel, ia) ;. Dispose () ;. Dispose (); temp;
} public Bitmap InvertColors (Bitmap bmp)
{cm=new ColorMatrix (float [] [] {float [] {- ??1, 0, 0, 0, 0}, float [] {0, - 1, 0, 0, 0 }, float [] {0, 0, - 1, 0, 0}, float [] {0, 0, 0, 1, 0}, float [] {1, 1, 1, 0, 1}
}=SetColorMatrix (bmp, cm); bmp;
} public Bitmap MakeBW (Bitmap bmp)
{cm=new ColorMatrix (float [] [] {float [] {0.3f, 0.3f, 0.3f, 0, 0}, float [] {0.59f, 0.59f, 0.59f , 0, 0}, float [] {0.11f, 0.11f, 0.11f, 0, 0}, float [] {0, 0, 0, 1, 0}, float [] {0, 0, 0, 0 , 1}
}=SetColorMatrix (bmp, cm); bmp;
} public Bitmap Sepia (Bitmap bmp)
{cm=new ColorMatrix (float [] [] {float [] {0.393f, 0.349f, 0.272f, 0, 0}, float [] {0.769f, 0.686f, 0.534f , 0, 0}, float [] {0.189f, 0.168f, 0.131f, 0, 0}, float [] {0, 0, 0, 1, 0}, float [] {0, 0, 0, 0 , 1}
}=SetColorMatrix (bmp, cm); bmp;
} public Bitmap FlipHorizontally (Bitmap bmp)
{. RotateFlip (RotateFlipType.RotateNoneFlipX); bmp;
} public Bitmap FlipVertically (Bitmap bmp)
{. RotateFlip (RotateFlipType.RotateNoneFlipY); bmp; public Bitmap Rotate90Clockwise (Bitmap bmp) bmp; public Bitmap Rotate90Anticlockwise (Bitmap bmp) bmp;
} public Bitmap Rotate180 (Bitmap bmp)
{bmp;
}