91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡(jiǎn)介

這是Cohen-Sutherland直線段的裁剪算法在VC下的實(shí)現(xiàn),連續(xù)單擊兩個(gè)點(diǎn)繪制直線段,直線段位于裁剪窗口內(nèi)的部分顯示為黑色,其它部分為灰色。

資源截圖

代碼片段和文件信息

//?Cohen-Sutherland.cpp?:?定義應(yīng)用程序的入口點(diǎn)。
//

#include?“stdafx.h“
#include?“Cohen-Sutherland.h“

#define?MAX_LOADSTRING?100

//?全局變量:
HINSTANCE?hInst; //?當(dāng)前實(shí)例
TCHAR?sztitle[MAX_LOADSTRING]; //?標(biāo)題欄文本
TCHAR?szWindowClass[MAX_LOADSTRING]; //?主窗口類名

//?此代碼模塊中包含的函數(shù)的前向聲明:
ATOM MyRegisterClass(HINSTANCE?hInstance);
BOOL InitInstance(HINSTANCE?int);
LRESULT?CALLBACK WndProc(HWND?UINT?WPARAM?LPARAM);
INT_PTR?CALLBACK About(HWND?UINT?WPARAM?LPARAM);

int?APIENTRY?_tWinMain(HINSTANCE?hInstance
?????????????????????HINSTANCE?hPrevInstance
?????????????????????LPTSTR????lpCmdLine
?????????????????????int???????nCmdShow)
{
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);

? //?TODO:?在此放置代碼。
MSG?msg;
HACCEL?hAccelTable;

//?初始化全局字符串
LoadString(hInstance?IDS_APP_title?sztitle?MAX_LOADSTRING);
LoadString(hInstance?IDC_COHENSUTHERLAND?szWindowClass?MAX_LOADSTRING);
MyRegisterClass(hInstance);

//?執(zhí)行應(yīng)用程序初始化:
if?(!InitInstance?(hInstance?nCmdShow))
{
return?FALSE;
}

hAccelTable?=?LoadAccelerators(hInstance?MAKEINTRESOURCE(IDC_COHENSUTHERLAND));

//?主消息循環(huán):
while?(GetMessage(&msg?NULL?0?0))
{
if?(!TranslateAccelerator(msg.hwnd?hAccelTable?&msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}

return?(int)?msg.wParam;
}

typedef?struct?{
unsigned?int?all;
unsigned?left?top?right?bottom;
}?OutCode;
void?CompOutCode(float?x?float?y?RECT?*rect?OutCode?*outCode)
{
outCode->all?=?0;
outCode->left?=?outCode->top?=?outCode->right?=?outCode->bottom?=?0;
if?(x?left)
{
outCode->left?=?1;
outCode->all?+=?1;
}
if?(y?top)
{
outCode->top?=?1;
outCode->all?+=?2;
}
if?(x?>?rect->right)
{
outCode->right?=?1;
outCode->all?+=?4;
}
if?(y?>?rect->bottom)
{
outCode->bottom?=?1;
outCode->all?+=?8;
}
}
void?CohenSutherlandLineClip(HDC?hdc?float?x0?float?y0?float?x1?float?y1?RECT?*rect)
{
bool?accept?done;
OutCode?outCode0?outCode1;

float?x?y;
accept?=?false;
done?=?false;
CompOutCode(x0?y0?rect?&outCode0);
CompOutCode(x1?y1?rect?&outCode1);
do?{
if?(outCode0.all?==?0?&&?outCode1.all?==?0)
{
accept?=?true;
done?=?true;
}
else?if?((outCode0.all?&?outCode1.all)?!=?0)
{
done?=?true;
}
else
{
OutCode?*outCodeOut;
if?(outCode0.all?!=?0)
outCodeOut?=?&outCode0;
else
outCodeOut?=?&outCode1;

if?(outCodeOut->left)
{
x?=?rect->left;
y?=?y0+(y1-y0)*(rect->left-x0)/(x1-x0);
}
else?if?(outCodeOut->top)
{
x?=?x0+(x1-x0)*(rect->top-y0)/(y1-y0);
y?=?rect->top;
}
else?if?(outCodeOut->right)
{
x?=?rect->right;
y?=?y0+(y1-y0)*(rect->right-x0)/(x1-x0);
}
else?if?(outCodeOut->bottom)
{
x?=?x0+(x1-x0)*(rect->bottom-y0)/(y1-y0);
y?=?rect->bottom;
}

if?(outCodeOut?==?&outCode0)
{
x0?=?x

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----

?????文件????????915??2017-02-24?13:54??Cohen-Sutherland.sln

?????文件???????4636??2017-02-24?13:54??Cohen-Sutherland\Cohen-Sutherland.vcxproj

?????文件????????143??2017-02-24?13:54??Cohen-Sutherland\Cohen-Sutherland.vcxproj.user

?????文件???????1828??2017-02-24?13:54??Cohen-Sutherland\Cohen-Sutherland.vcxproj.filters

?????文件???????2432??2017-02-24?13:54??Cohen-Sutherland\ReadMe.txt

?????文件????????420??2017-02-24?13:54??Cohen-Sutherland\stdafx.h

?????文件????????236??2017-02-24?13:54??Cohen-Sutherland\targetver.h

?????文件????????221??2017-02-24?13:54??Cohen-Sutherland\stdafx.cpp

?????文件???????7282??2017-02-24?15:33??Cohen-Sutherland\Cohen-Sutherland.cpp

?????文件????????753??2017-02-24?13:54??Cohen-Sutherland\Resource.h

?????文件???????6678??2017-02-24?13:54??Cohen-Sutherland\Cohen-Sutherland.rc

?????文件?????????39??2017-02-24?13:54??Cohen-Sutherland\Cohen-Sutherland.h

????.......?????23558??2009-08-31?02:31??Cohen-Sutherland\small.ico

????.......?????23558??2009-08-31?02:31??Cohen-Sutherland\Cohen-Sutherland.ico

?????文件???????4043??2017-02-24?15:33??Cohen-Sutherland\Debug\Cohen-Sutherland.log

?????文件????????713??2017-02-24?15:18??Cohen-Sutherland\Debug\Cohen-Sutherland.vcxprojResolveAssemblyReference.cache

?????文件?????????73??2017-02-24?15:33??Cohen-Sutherland\Debug\Cohen-Sutherland.lastbuildstate

?????文件??????????0??2017-02-24?15:18??Cohen-Sutherland\Debug\Cohen-Sutherland.write.1.tlog

?????文件?????281600??2017-02-24?15:33??Cohen-Sutherland\Debug\vc100.idb

?????文件????4456448??2017-02-24?15:18??Cohen-Sutherland\Debug\Cohen-Sutherland.pch

?????文件?????405504??2017-02-24?15:33??Cohen-Sutherland\Debug\vc100.pdb

?????文件?????125875??2017-02-24?15:18??Cohen-Sutherland\Debug\stdafx.obj

?????文件???????9662??2017-02-24?15:33??Cohen-Sutherland\Debug\CL.read.1.tlog

?????文件????????948??2017-02-24?15:33??Cohen-Sutherland\Debug\CL.write.1.tlog

?????文件???????1586??2017-02-24?15:33??Cohen-Sutherland\Debug\cl.command.1.tlog

?????文件??????48336??2017-02-24?15:18??Cohen-Sutherland\Debug\Cohen-Sutherland.res

?????文件???????3298??2017-02-24?15:18??Cohen-Sutherland\Debug\rc.read.1.tlog

?????文件????????646??2017-02-24?15:18??Cohen-Sutherland\Debug\rc.write.1.tlog

?????文件???????1252??2017-02-24?15:18??Cohen-Sutherland\Debug\rc.command.1.tlog

?????文件????????406??2017-02-24?15:18??Cohen-Sutherland\Debug\Cohen-Sutherland.exe.embed.manifest

............此處省略17個(gè)文件信息

評(píng)論

共有 條評(píng)論