资源描述:
《实验三 区域填充扫描线算法》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、计算机图形学实验报告班级:计科14-3班学号:1406010325姓名:张磊日期:2017.4.11成绩:__________1、实验题目及目的1.1实验题目实验三区域填充扫描线算法1.2实验目的掌握区域填充扫描线算法2、实验内容及实验步骤实验内容:要求:(1)画基本图形(2)采用扫描线填充算法进行区域填充实验步骤:voidScanLineFill4(HDChdc,intx,inty,intoldColor,intnewColor);扫描线填充算法LRESULTCALLBACKWndProc(HWNDhWnd,UINTmess
2、age,WPARAMwParam,LPARAMlParam);处理主窗口的消息,WM_PAINT绘制要填充的图形3、程序关键代码和注释#include"stdafx.h"#include"区域填充的扫描线算法.h"#defineMAX_LOADSTRING100HINSTANCEhInst;//当前实例TCHARszTitle[MAX_LOADSTRING];//标题栏文本TCHARszWindowClass[MAX_LOADSTRING];//主窗口类名ATOMMyRegisterClass(HINSTANCEhInstan
3、ce);BOOLInitInstance(HINSTANCE,int);LRESULTCALLBACKWndProc(HWND,UINT,WPARAM,LPARAM);INT_PTRCALLBACKAbout(HWND,UINT,WPARAM,LPARAM);intAPIENTRY_tWinMain(HINSTANCEhInstance,HINSTANCEhPrevInstance,LPTSTRlpCmdLine,intnCmdShow){UNREFERENCED_PARAMETER(hPrevInstance);UNREFE
4、RENCED_PARAMETER(lpCmdLine);//TODO:在此放置代码。MSGmsg;HACCELhAccelTable;//初始化全局字符串LoadString(hInstance,IDS_APP_TITLE,szTitle,MAX_LOADSTRING);LoadString(hInstance,IDC_MY,szWindowClass,MAX_LOADSTRING);MyRegisterClass(hInstance);//执行应用程序初始化:if(!InitInstance(hInstance,nCmdSh
5、ow)){returnFALSE;}hAccelTable=LoadAccelerators(hInstance,MAKEINTRESOURCE(IDC_MY));//主消息循环:while(GetMessage(&msg,NULL,0,0)){if(!TranslateAccelerator(msg.hwnd,hAccelTable,&msg)){TranslateMessage(&msg);DispatchMessage(&msg);}}return(int)msg.wParam;}ATOMMyRegisterClass(
6、HINSTANCEhInstance){WNDCLASSEXwcex;wcex.cbSize=sizeof(WNDCLASSEX);wcex.style=CS_HREDRAW
7、CS_VREDRAW;wcex.lpfnWndProc=WndProc;wcex.cbClsExtra=0;wcex.cbWndExtra=0;wcex.hInstance=hInstance;wcex.hIcon=LoadIcon(hInstance,MAKEINTRESOURCE(IDI_MY));wcex.hCursor=LoadCursor(NU
8、LL,IDC_ARROW);wcex.hbrBackground=(HBRUSH)(COLOR_WINDOW+1);wcex.lpszMenuName=MAKEINTRESOURCE(IDC_MY);wcex.lpszClassName=szWindowClass;wcex.hIconSm=LoadIcon(wcex.hInstance,MAKEINTRESOURCE(IDI_SMALL));returnRegisterClassEx(&wcex);}BOOLInitInstance(HINSTANCEhInstance,in
9、tnCmdShow){HWNDhWnd;hInst=hInstance;//将实例句柄存储在全局变量中hWnd=CreateWindow(szWindowClass,szTitle,WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,0,CW_USEDEFAU