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