資源簡介
C# winform VS2013項目實現的去油填充-活性邊表

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Threading.Tasks;
using?System.Windows.Forms;
namespace?活性邊表
{
????public?partial?class?Form1?:?Form
????{
????????Bitmap?bmp;
????????Graphics?graphics;
????????void?MidpointLine(int?x0?int?y0?int?x1?int?y1)
????????{
????????????//bmp?=?new?Bitmap(pictureBox1?.Width?pictureBox1?.Height?);
????????????//Graphics?graphics?=?Graphics.FromImage(bmp);????????????
????????????int?a?b?delta1?delta2?d?x?y;
????????????int?xf?xs?yf?ys;
????????????if?((x1?-?x0)?!=?0?&&?(float)(y1?-?y0)?/?(float)(x1?-?x0)?>=?0)
????????????{
????????????????xs?=?x1?>?x0???x0?:?x1;
????????????????xf?=?x1?+?x0?-?xs;
????????????????ys?=?y1?>?y0???y0?:?y1;
????????????????yf?=?y1?+?y0?-?ys;
????????????????if?((float)((yf?-?ys)?/?(xf?-?xs))?<=?1)
????????????????{
????????????????????y0?=?ys;
????????????????????y1?=?yf;
????????????????????x0?=?xs;
????????????????????x1?=?xf;
????????????????????a?=?y0?-?y1;
????????????????????b?=?x1?-?x0;
????????????????????d?=?2?*?a?+?b;
????????????????????delta1?=?2?*?a;
????????????????????delta2?=?2?*?(a?+?b);
????????????????????x?=?x0;
????????????????????y?=?y0;
????????????????????bmp.SetPixel(x?y?Color.Black);?//方法2
????????????????????//g.DrawLine(new?Pen(Color.Green)?x?bmp.Height?-?y??x+1?bmp.Height?-?y);//方法3
????????????????????while?(x?????????????????????{
????????????????????????if?(d?0)
????????????????????????{
????????????????????????????x++;?y++;
????????????????????????????d?+=?delta2;
????????????????????????}
????????????????????????else
????????????????????????{
????????????????????????????x++;
????????????????????????????d?+=?delta1;
????????????????????????}
????????????????????????bmp.SetPixel(x?y?Color.Black);//方法2
????????????????????????//g.DrawLine(new?Pen(Color.Green)?xbmp.Height?-?y??x+1?bmp.Height?-?y?);//方法3
????????????????????}
????????????????}
????????????????else
????????????????{
????????????????????a?=?y0?-?y1;
????????????????????b?=?x1?-?x0;
????????????????????d?=?a?+?2?*?b;
????????????????????delta1?=?2?*?b;
????????????????????delta2?=?2?*?(a?+?b);
????????????????????x?=?x0;
????????????????????y?=?y0;
????????????????????bmp.SetPixel(x?y?Color.Black);?//方法2
????????????????????//g.DrawLine(new?Pen(Color.Green)?x?bmp.Height?-?y??x+1?bmp.Height?-?y);//方法3
????????????????????while?(y?????????????????????{
????????????????????????if?(d?>?0)
????????????????????????{
????????????????????????????x++;?y++;
????????????????????????????d?+=?delta2;
????????????????????????}
????????????????????????else
????????????????????????{
????????????????????????????y++;
????????????????????????????d?+=?delta1;
????????????????????????}
????????????????????????bmp.SetPixel(x?y?Color.Black);//方法2
??????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2014-10-28?08:23??活性邊表\
?????目錄???????????0??2014-11-12?03:11??活性邊表\活性邊表\
?????文件????????1005??2014-10-28?08:23??活性邊表\活性邊表.sln
?????文件???????39424??2014-11-12?03:11??活性邊表\活性邊表.v12.suo
?????文件?????????187??2014-10-28?08:23??活性邊表\活性邊表\App.config
?????目錄???????????0??2014-10-28?08:23??活性邊表\活性邊表\bin\
?????目錄???????????0??2014-10-28?08:25??活性邊表\活性邊表\bin\Debug\
?????文件???????20992??2014-11-12?03:11??活性邊表\活性邊表\bin\Debug\活性邊表.exe
?????文件?????????187??2014-10-28?08:23??活性邊表\活性邊表\bin\Debug\活性邊表.exe.config
?????文件???????40448??2014-11-12?03:11??活性邊表\活性邊表\bin\Debug\活性邊表.pdb
?????文件???????24224??2014-11-12?03:11??活性邊表\活性邊表\bin\Debug\活性邊表.vshost.exe
?????文件?????????187??2014-10-28?08:23??活性邊表\活性邊表\bin\Debug\活性邊表.vshost.exe.config
?????文件?????????490??2013-06-18?20:28??活性邊表\活性邊表\bin\Debug\活性邊表.vshost.exe.manifest
?????文件???????18389??2014-11-12?03:11??活性邊表\活性邊表\Form1.cs
?????文件???????21258??2014-11-12?02:11??活性邊表\活性邊表\Form1.Designer.cs
?????文件????????5817??2014-11-12?02:11??活性邊表\活性邊表\Form1.resx
?????目錄???????????0??2014-10-28?08:23??活性邊表\活性邊表\obj\
?????目錄???????????0??2014-11-12?03:11??活性邊表\活性邊表\obj\Debug\
?????文件????????1453??2014-11-08?16:11??活性邊表\活性邊表\obj\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件????????7156??2014-10-28?08:23??活性邊表\活性邊表\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件???????????0??2014-10-28?08:23??活性邊表\活性邊表\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
?????文件???????????0??2014-10-28?08:23??活性邊表\活性邊表\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
?????文件???????????0??2014-10-28?08:23??活性邊表\活性邊表\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
?????目錄???????????0??2014-10-28?08:23??活性邊表\活性邊表\obj\Debug\TempPE\
?????文件????????1149??2014-11-12?03:11??活性邊表\活性邊表\obj\Debug\活性邊表.csproj.FileListAbsolute.txt
?????文件?????????977??2014-11-12?02:11??活性邊表\活性邊表\obj\Debug\活性邊表.csproj.GenerateResource.Cache
?????文件????????2211??2014-10-28?09:36??活性邊表\活性邊表\obj\Debug\活性邊表.csprojResolveAssemblyReference.cache
?????文件???????20992??2014-11-12?03:11??活性邊表\活性邊表\obj\Debug\活性邊表.exe
?????文件?????????180??2014-11-12?02:11??活性邊表\活性邊表\obj\Debug\活性邊表.Form1.resources
?????文件???????40448??2014-11-12?03:11??活性邊表\活性邊表\obj\Debug\活性邊表.pdb
?????文件?????????180??2014-10-28?08:25??活性邊表\活性邊表\obj\Debug\活性邊表.Properties.Resources.resources
............此處省略8個文件信息
評論
共有 條評論