本例应用场合:对图片进行基本的翻转操作,图片浮雕、黑白、油画效果的实现。
本例编译环境:VS2010及以上版本编译通过。
运行效果:
主要功能:
-
图片浮雕、黑白、油画效果处理;
-
图片翻转处理——旋转180°,顺时针、逆时针旋转90°,垂直、水平翻转;
-
图片保存、另存为。
主要代码:
/// <summary
/// 浮雕效果
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnFudiao_Click(object sender, EventArgs e)
{
label1.Text = "正在完成图片操作,可能会出现程序未响应的情况。请稍等一段时间,如果等待时间过长,请重新启动程序!";
shangyibu = new Bitmap(pictureBox1.Image);
Thread.Sleep(500);
try
{
Bitmap newBitmap = new Bitmap(intWidth, intHeight);
Bitmap oldBitmap = (Bitmap)this.pictureBox1.Image;
Color pixel1, pixel2;
for (int x = 0; x < intWidth - 1; x++)
{
for