![計算機圖形學區(qū)域填充算法的實現(xiàn)_第1頁](http://file3.renrendoc.com/fileroot_temp3/2022-3/1/56c48bbc-9d96-47ad-9baa-35864cd675f9/56c48bbc-9d96-47ad-9baa-35864cd675f91.gif)
![計算機圖形學區(qū)域填充算法的實現(xiàn)_第2頁](http://file3.renrendoc.com/fileroot_temp3/2022-3/1/56c48bbc-9d96-47ad-9baa-35864cd675f9/56c48bbc-9d96-47ad-9baa-35864cd675f92.gif)
![計算機圖形學區(qū)域填充算法的實現(xiàn)_第3頁](http://file3.renrendoc.com/fileroot_temp3/2022-3/1/56c48bbc-9d96-47ad-9baa-35864cd675f9/56c48bbc-9d96-47ad-9baa-35864cd675f93.gif)
![計算機圖形學區(qū)域填充算法的實現(xiàn)_第4頁](http://file3.renrendoc.com/fileroot_temp3/2022-3/1/56c48bbc-9d96-47ad-9baa-35864cd675f9/56c48bbc-9d96-47ad-9baa-35864cd675f94.gif)
![計算機圖形學區(qū)域填充算法的實現(xiàn)_第5頁](http://file3.renrendoc.com/fileroot_temp3/2022-3/1/56c48bbc-9d96-47ad-9baa-35864cd675f9/56c48bbc-9d96-47ad-9baa-35864cd675f95.gif)
版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、實驗四 區(qū)域填充算法的實現(xiàn)班級 08信計 學號 58 姓名 陳瑞雪 分數(shù) 一、實驗目的和要求:1、掌握區(qū)域填充算法基本知識2、理解區(qū)域的表示和類型,能正確區(qū)分四連通和八連通的區(qū)域3、了解區(qū)域填充的實現(xiàn)原理,利用Microsoft Visual C+ 6.0(及EasyX_2011版)實現(xiàn)區(qū)域種子填充的遞歸算法。二、實驗內容:1、編程完成區(qū)域填色2、利用畫線函數(shù),在屏幕上定義一個封閉區(qū)域。3、利用以下兩種種子填充算法,填充上述步驟中定義的區(qū)域(1) 邊界表示的四連通區(qū)域種子填充的實現(xiàn)(2) 內點表示的四連通區(qū)域種子填充的實現(xiàn)4、將上述算法作部分改動應用于八連通區(qū)域,構成八連通區(qū)域種子填充算法,并
2、編程實現(xiàn)。 三、實驗結果分析1、以上各種算法相應代碼及運行結果如下:程序代碼:#include<graphics.h>#include<conio.h>#include<time.h>void FloodFill4(int x,int y,int oldcolor,int newcolor)if(getpixel(x,y)=oldcolor)putpixel(x,y,newcolor);Sleep(1);FloodFill4(x-1,y,oldcolor,newcolor);FloodFill4(x,y+1,oldcolor,newcolor);FloodF
3、ill4(x+1,y,oldcolor,newcolor);FloodFill4(x,y-1,oldcolor,newcolor);void main()int a,b,c,d,i,j;int graphdriver=DETECT;int graphmode=0;initgraph(&graphdriver,&graphmode," ");cleardevice();setcolor(RED);setfillstyle(RGB(255,255,0);fillcircle(315,200,50);a=300;b=200;c=RGB(255,255,0);d=R
4、GB(0,255,0);FloodFill4(a,b,c,d);getch();closegraph();運行結果:程序代碼:#include<graphics.h>#include <conio.h>#include<time.h>void BoundaryFill4(int x,int y,int Boundarycolor,int newcolor)if(getpixel(x,y) != newcolor && getpixel(x,y) !=Boundarycolor)putpixel(x,y,newcolor);Sleep(1);B
5、oundaryFill4(x-1,y,Boundarycolor,newcolor);BoundaryFill4(x,y+1,Boundarycolor,newcolor);BoundaryFill4(x+1,y,Boundarycolor,newcolor);BoundaryFill4(x,y-1,Boundarycolor,newcolor);void main()int a,b,c,d,i,j;int graphdriver=DETECT;int graphmode=0;initgraph(&graphdriver,&graphmode," ");cl
6、eardevice();setcolor(RGB(0,255,0);setfillstyle(WHITE);fillellipse(50,75,150,125);a=100;b=100;c=RGB(0,255,0);d=RGB(255,0,255);BoundaryFill4(a,b,c,d);getch();closegraph();運行結果:程序代碼:#include<graphics.h>#include<conio.h>#include<time.h>void FloodFill8(int x,int y,int oldcolor,int newco
7、lor)if(getpixel(x,y)=oldcolor)putpixel(x,y,newcolor);Sleep(1);FloodFill8(x-1,y,oldcolor,newcolor);FloodFill8(x,y+1,oldcolor,newcolor);FloodFill8(x+1,y,oldcolor,newcolor);FloodFill8(x,y-1,oldcolor,newcolor);FloodFill8(x-1,y+1,oldcolor,newcolor);FloodFill8(x+1,y+1,oldcolor,newcolor);FloodFill8(x+1,y-1
8、,oldcolor,newcolor);FloodFill8(x-1,y-1,oldcolor,newcolor);void main()int a,b,c,d,i,j;int graphdriver=DETECT;int graphmode=0;int points = 250, 250, 300, 150, 350, 250,300,350;initgraph(&graphdriver,&graphmode," ");cleardevice();setcolor(GREEN);setfillstyle(RGB(0,0,255);fillpoly(4, p
9、oints);a=300;b=200;c=RGB(0,0,255);d=RGB(255,255,0);FloodFill8(a,b,c,d);getch();closegraph();運行結果:程序代碼:#include<graphics.h>#include <conio.h>#include<time.h>void BoundaryFill8(int x,int y,int Boundarycolor,int newcolor)if(getpixel(x,y) != newcolor && getpixel(x,y) !=Boundary
10、color)putpixel(x,y,newcolor);Sleep(1);BoundaryFill8(x-1,y,Boundarycolor,newcolor);BoundaryFill8(x,y+1,Boundarycolor,newcolor);BoundaryFill8(x+1,y,Boundarycolor,newcolor);BoundaryFill8(x,y-1,Boundarycolor,newcolor);BoundaryFill8(x-1,y+1,Boundarycolor,newcolor);BoundaryFill8(x+1,y+1,Boundarycolor,newc
11、olor);BoundaryFill8(x+1,y-1,Boundarycolor,newcolor);BoundaryFill8(x-1,y-1,Boundarycolor,newcolor);void main()int a,b,c,d,i,j;int graphdriver=DETECT;int graphmode=0;initgraph(&graphdriver,&graphmode," ");cleardevice();setcolor(RGB(255,0,255);rectangle(170,80,270,130);for(i=171;i<270;i+)for(j=81;j<130;j+)putpixel(i,j,RGB(0,255,0);a=200;b=100;c=RGB(255,0,255);d=R
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年智能真空斷路器項目立項申請報告模范
- 2025年農(nóng)業(yè)服務項目申請報告模稿
- 2025年紫外固化材料項目立項申請報告
- 2025年角鋼項目提案報告模板
- 2025年腈類項目申請報告模板
- 2025年拼多多店鋪策劃出租協(xié)議書
- 2025年全球銷售合同風險管理與控制實驗評估報告
- 2025年鄉(xiāng)鎮(zhèn)校園設施租賃合同
- 2025年專利權合作開發(fā)協(xié)議范本
- 2025年合同保證書樣式
- 復產(chǎn)復工試題含答案
- 湖南省長沙市2023-2024學年八年級下學期入學考試英語試卷(附答案)
- 部編版語文三年級下冊第六單元大單元整體作業(yè)設計
- 售后服務經(jīng)理的競聘演講
- 臨床醫(yī)技科室年度運營發(fā)展報告
- 慢加急性肝衰竭護理查房課件
- 文件丟失應急預案
- 從建設和諧社會角度思考治超限載(十)
- 幼兒園小班開學家長會課件
- 云南華葉投資公司2023年高校畢業(yè)生招聘1人筆試參考題庫(共500題)答案詳解版
- ABB電子時間繼電器CTMVS系列操作與安裝指南
評論
0/150
提交評論