• 大小: 5MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-09-17
  • 语言: C#
  • 标签: C#  Instagram  Demo  

资源简介

一个用C#实现的Instagram中Toaster滤镜的Demo,同时包括Photoshop实现的文件,喜欢Instagram滤镜的同学,想弄明白滤镜如何编码的,或者PS如何实现的,可以看一下,下载免费!共勉!

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Imaging;
using System.IO;

namespace SpecialeffectDemo
{
    public unsafe partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            curBitmap = new Bitmap(“Test.jpg“);
            pictureBox1.Image = (Image)curBitmap;
        }
        private string curFileName = null;
        private Bitmap curBitmap = null;
        private Bitmap tempBitmap = null;
        private ToasterFilter toaster = null;

        //打开图像函数
        public void OpenFile()
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Filter = “所有图像文件 | *.bmp; *.pcx; *.png; *.jpg; *.gif;“ +
                   “*.tif; *.ico; *.dxf; *.cgm; *.cdr; *.wmf; *.eps; *.emf|“ +
                   “位图( *.bmp; *.jpg; *.png;...) | *.bmp; *.pcx; *.png; *.jpg; *.gif; *.tif; *.ico|“ +
                   “矢量图( *.wmf; *.eps; *.emf;...) | *.dxf; *.cgm; *.cdr; *.wmf; *.eps; *.emf“;
            ofd.ShowHelp = true;
            ofd.title = “打开图像文件“;
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                curFileName = ofd.FileName;
                try
                {
                    curBitmap = (Bitmap)System.Drawing.Image.FromFile(curFileName);

                }
                catch (Exception exp)
                { MessageBox.Show(exp.Message); }
            }
        }
        //保存图像函数
        public void SaveFile()
        {
            SaveFileDialog sfd = new SaveFileDialog();
            sfd.Filter = “位图文件(*.bmp)|*.bmp|Jpeg文件(*.jpg)|*.jpg|GIF文件(*.gif)|*.gif“;
            if (sfd.ShowDialog() == DialogResult.OK)
                pictureBox1.Image.Save(sfd.FileName);
        }
        private void button1_Click(object sender EventArgs e)
        {
            OpenFile();
            if (curBitmap != null)
            {
                pictureBox1.Image = (Image)curBitmap;
                pictureBox1.Width = curBitmap.Width;
                pictureBox1.Height = curBitmap.Height;
            }
        }

        private void button3_Click(object sender EventArgs e)
        {
            SaveFile();
        }

        private void button2_Click(object sender EventArgs e)
        {
            if (curBitmap != null)
            {
                Bitmap a = new Bitmap (“a.png“);
                Bitmap b = new Bitmap(“b.png“);
                Bitmap c = new Bitmap (“c.png“);
                toaster = new ToasterFilter(curBitmap a b c);
                pictureBox1.Image = (Image)toaster.Apply();
            }
        }

        
       
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2014-11-07 15:34  ToasterFilter\
     目录           0  2014-11-07 15:34  ToasterFilter\Demo\
     目录           0  2014-11-07 15:32  ToasterFilter\Demo\SpecialeffectDemo\
     目录           0  2014-11-07 15:32  ToasterFilter\Demo\SpecialeffectDemo\SpecialeffectDemo\
     文件     6016000  2014-11-07 15:32  ToasterFilter\Demo\SpecialeffectDemo\SpecialeffectDemo.ncb
     文件        2802  2014-09-24 11:16  ToasterFilter\Demo\SpecialeffectDemo\SpecialeffectDemo.sln
     文件       42496  2014-11-07 15:32  ToasterFilter\Demo\SpecialeffectDemo\SpecialeffectDemo.suo
     目录           0  2014-11-07 15:32  ToasterFilter\Demo\SpecialeffectDemo\SpecialeffectDemo\bin\
     目录           0  2014-11-07 15:32  ToasterFilter\Demo\SpecialeffectDemo\SpecialeffectDemo\bin\Debug\
     文件       35364  2014-10-22 09:07  ToasterFilter\Demo\SpecialeffectDemo\SpecialeffectDemo\bin\Debug\a.png
     文件       93687  2014-10-22 09:07  ToasterFilter\Demo\SpecialeffectDemo\SpecialeffectDemo\bin\Debug\b.png
     文件       91484  2014-10-22 09:07  ToasterFilter\Demo\SpecialeffectDemo\SpecialeffectDemo\bin\Debug\c.png
     文件       51712  2014-11-07 14:52  ToasterFilter\Demo\SpecialeffectDemo\SpecialeffectDemo\bin\Debug\SpecialEffect.dll
     文件        3859  2014-11-07 14:51  ToasterFilter\Demo\SpecialeffectDemo\SpecialeffectDemo\bin\Debug\SpecialEffect.exp
     文件      297316  2014-11-07 14:52  ToasterFilter\Demo\SpecialeffectDemo\SpecialeffectDemo\bin\Debug\SpecialEffect.ilk
     文件        7236  2014-11-07 14:51  ToasterFilter\Demo\SpecialeffectDemo\SpecialeffectDemo\bin\Debug\SpecialEffect.lib
     文件      814080  2014-11-07 14:52  ToasterFilter\Demo\SpecialeffectDemo\SpecialeffectDemo\bin\Debug\SpecialEffect.pdb
     文件       19456  2014-11-07 15:18  ToasterFilter\Demo\SpecialeffectDemo\SpecialeffectDemo\bin\Debug\SpecialeffectDemo.exe
     文件       42496  2014-11-07 15:18  ToasterFilter\Demo\SpecialeffectDemo\SpecialeffectDemo\bin\Debug\SpecialeffectDemo.pdb
     文件       14848  2014-11-07 15:18  ToasterFilter\Demo\SpecialeffectDemo\SpecialeffectDemo\bin\Debug\SpecialeffectDemo.vshost.exe
     文件         490  2009-06-11 05:14  ToasterFilter\Demo\SpecialeffectDemo\SpecialeffectDemo\bin\Debug\SpecialeffectDemo.vshost.exe.manifest
     文件      178959  2014-11-07 14:43  ToasterFilter\Demo\SpecialeffectDemo\SpecialeffectDemo\bin\Debug\Test.jpg
     文件        2920  2014-11-07 15:18  ToasterFilter\Demo\SpecialeffectDemo\SpecialeffectDemo\Form1.cs
     文件        4404  2014-11-07 14:24  ToasterFilter\Demo\SpecialeffectDemo\SpecialeffectDemo\Form1.Designer.cs
     文件        5814  2014-11-07 14:24  ToasterFilter\Demo\SpecialeffectDemo\SpecialeffectDemo\Form1.resx
     目录           0  2014-11-07 15:32  ToasterFilter\Demo\SpecialeffectDemo\SpecialeffectDemo\obj\
     目录           0  2014-11-07 15:32  ToasterFilter\Demo\SpecialeffectDemo\SpecialeffectDemo\obj\Debug\
     目录           0  2014-11-07 14:21  ToasterFilter\Demo\SpecialeffectDemo\SpecialeffectDemo\obj\Debug\Refactor\
     文件        1708  2014-11-07 15:18  ToasterFilter\Demo\SpecialeffectDemo\SpecialeffectDemo\obj\Debug\SpecialeffectDemo.csproj.FileListAbsolute.txt
     文件         847  2014-11-07 14:24  ToasterFilter\Demo\SpecialeffectDemo\SpecialeffectDemo\obj\Debug\SpecialeffectDemo.csproj.GenerateResource.Cache
     文件       19456  2014-11-07 15:18  ToasterFilter\Demo\SpecialeffectDemo\SpecialeffectDemo\obj\Debug\SpecialeffectDemo.exe
............此处省略22个文件信息

评论

共有 条评论