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

  • 大小: 3.99M
    文件類型: .rar
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2025-01-25
  • 語言: 其他
  • 標(biāo)簽: 其他??

資源簡介


計算機(jī)圖形學(xué) 邊填充算法實(shí)現(xiàn)代碼,運(yùn)用了MFC模塊,使填充過程直觀易學(xué)

資源截圖

代碼片段和文件信息

#include??
#include??
#include??
#include??
#include?
class?HPoint
{

public:
HPoint(){x=y=0;}
void?move(int?mint?n){x=m;y=n;}
int?xy;
};
int?inline?Sign(int?ff)
{
return?(ff??0)???1?:?0);
}
void?inline?Swap(int?&xint?&y)
{
?????int?t;
?t=x;
?x=y;
?y=t;

}
void?Bresenham(HDC?hdcint?xsint?ysint?xeint?ye)
{

int?xysxsydif_xdif_y;
int?FlagNError;
x=xs;
y=ys;
dif_x=abs(xe-xs);
????dif_y=abs(ye-ys);
????sx=Sign(xe-xs);
sy=Sign(ye-ys);
if(dif_y>dif_x)
{
Swap(dif_xdif_y);
Flag=1;
}
else
Flag=0;
NError=2*dif_y-dif_x;
for(int?i=0;i<=dif_x;i++)
{
??????????SetPixel(hdcxyRGB(02550));
??if(NError>=0)
??{
??if(Flag)
??x=x+sx;
??else
??y=y+sy;
???????????????NError=NError-2*dif_x;
??}
??if(Flag)
??y=y+sy;
??else
??x=x+sx;
??NError=NError+2*dif_y;
}
}

void?Draw(HDC?hdc)
{
????HPoint?*Point?=new?HPoint[5];
Point[0].move(300300);
Point[1].move(300400);
Point[2].move(400450);
Point[3].move(400200);
Point[4].move(350150);
int?mnyminymax;
double?ab;
double?k;
for?(int?i=0;i<=4;i++)???????????????????//對于所有邊循環(huán)
{
m=in=i+1;????????????????????????????//對點(diǎn)的循環(huán)
if(5==n)?n=0;
k=(double?(Point[m].x-Point[n].x))/(Point[m].y-Point[n].y);
if(Point[m].y {
ymin=Point[m].y;
ymax=Point[n].y;
a=Point[m].x;
}
else?
{
?????????????ymin=Point[n].y;
ymax=Point[m].y;
a=Point[n].x;
}
for(b=ymin;b {
?????????????for(int?j=a;j<400;j++)????????????????????????????//對每一條掃描線與邊的交點(diǎn)的右側(cè)像素循環(huán)
?{
?if(GetPixel(hdcjb)==RGB(25500))?????????//如果像素的顏色是填充色
?{
?SetPixel(hdcjbRGB(255255255));??????????//改為背景色
?}
?else
????????????????????????SetPixel(hdcjbRGB(25500));??????????//改為填充色
?}
????????????a+=k;???????????????????????????//計算下一個x起點(diǎn)值
}
}
}

LRESULT?CALLBACK?WndProc(HWND?hwndUINT?messageWPARAM?wParamLPARAM?lParam);

int?WINAPI?WinMain(
??HINSTANCE?hInstance??????//?handle?to?current?instance
??HINSTANCE?hPrevInstance??//?handle?to?previous?instance
??LPSTR?lpCmdLine??????????//?command?line
??int?nCmdShow??????????????//?show?state

{
HWND?hwnd; //窗口句柄
MSG?Msg; //消息
WNDCLASS?wndclass;?//窗口類
char?lpszClassName[]=“窗口“;
char?lpsztitle[]=“My_Windows“;

//定義窗口類
wndclass.style=0;
wndclass.lpfnWndProc?=WndProc;
wndclass.cbClsExtra=0;
wndclass.cbWndExtra=0;
wndclass.hInstance=hInstance;
wndclass.hIcon=LoadIcon(NULLIDI_APPLICATION);//加載窗口圖標(biāo)
wndclass.hCursor=LoadCursor(NULLIDC_ARROW);//加載窗口光標(biāo)
wndclass.hbrBackground=(HBRUSH)GetStockobject(WHITE_BRUSH);
wndclass.lpszMenuName=NULL;
wndclass.lpszClassName=lpszClassName;

//注冊窗口類
if(!RegisterClass(&wndclass))
{
MessageBeep(0);
return?FAL

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????7648??2009-04-28?21:40??biantianchong\Debug\BuildLog.htm

?????文件?????????65??2009-04-28?21:40??biantianchong\Debug\mt.dep

?????文件?????148480??2009-04-22?23:24??biantianchong\Debug\vc60.idb

?????文件??????77824??2009-04-22?23:24??biantianchong\Debug\vc60.pdb

?????文件?????338944??2009-04-28?21:40??biantianchong\Debug\vc90.idb

?????文件?????110592??2009-04-28?21:40??biantianchong\Debug\vc90.pdb

?????文件??????35369??2009-04-28?21:40??biantianchong\Debug\邊.obj

?????文件?????361984??2009-04-28?21:40??biantianchong\Debug\邊填充.exe

?????文件????????406??2009-04-28?20:34??biantianchong\Debug\邊填充.exe.embed.manifest

?????文件????????472??2009-04-28?20:34??biantianchong\Debug\邊填充.exe.embed.manifest.res

?????文件????????381??2009-04-28?21:40??biantianchong\Debug\邊填充.exe.intermediate.manifest

?????文件?????244296??2009-04-28?21:40??biantianchong\Debug\邊填充.ilk

?????文件????1969152??2009-04-28?21:40??biantianchong\Debug\邊填充.pdb

?????文件???????4977??2009-04-28?21:40??biantianchong\邊.cpp

?????文件???????3916??2009-04-22?22:29??biantianchong\邊填充.dsp

?????文件????????537??2009-04-22?21:57??biantianchong\邊填充.dsw

?????文件???13495296??2009-04-28?21:40??biantianchong\邊填充.ncb

?????文件??????48640??2009-04-22?23:24??biantianchong\邊填充.opt

?????文件????????742??2009-04-22?23:24??biantianchong\邊填充.plg

?????文件????????883??2009-04-28?21:38??biantianchong\邊填充.sln

????..A..H.??????7680??2009-04-28?21:40??biantianchong\邊填充.suo

?????文件???????5421??2009-04-28?20:34??biantianchong\邊填充.vcproj

?????文件???????1407??2009-04-28?21:40??biantianchong\邊填充.vcproj.hp-PC.hp.user

?????目錄??????????0??2010-02-20?20:06??biantianchong\Debug

?????目錄??????????0??2010-02-20?20:06??biantianchong

-----------?---------??----------?-----??----

?????????????16865112????????????????????25


評論

共有 條評論