种子填充算法中取一个像素点时,为什么编译时在return pDC->Getpixel(x,y)这一步出现error C2039: 'Getpixel' : is not a member of 'CDC'
e:\语言\microsoft visual studio\vc98\mfc\include\afxwin.h(636) : see declaration of 'CDC'
Error executing cl.exe.
小妹初学计算机图形学,还请各位高手帮忙解决一下void CMyDrawView::GetIJ(CDC *pDC, int x, int y)
{
x=x*10;
y=y*10;
x=x+5;
y=y+5;
return pDC->Getpixel(x,y);}void CMyDrawView::seed_fill(CDC *pDC, int x, int y, int ecolor, int fcolor)
{
ecolor=RGB(0,0,255);
fcolor=RGB(255,0,0);
if(Getpixel(x,y)!=ecolor&&Getpixel(x,y)!=fcolor)
{
setpixel(pDC,x,y);
seed_fill(pDC,x,y+1,ecolor,fcolor);
seed_fill(pDC,x,y-1,ecolor,fcolor);
seed_fill(pDC,x+1,y,ecolor,fcolor);
seed_fill(pDC,x-1,y,ecolor,fcolor);
}
}
void CMyDrawView::setpixel(CDC *pDC, int i, int j)
{
CBrush br(RGB(255,0,0));
pDC->SelectObject(&br);
pDC->Rectangle(i*10,j*10,i*10+10,j*10+10);
}
e:\语言\microsoft visual studio\vc98\mfc\include\afxwin.h(636) : see declaration of 'CDC'
Error executing cl.exe.
小妹初学计算机图形学,还请各位高手帮忙解决一下void CMyDrawView::GetIJ(CDC *pDC, int x, int y)
{
x=x*10;
y=y*10;
x=x+5;
y=y+5;
return pDC->Getpixel(x,y);}void CMyDrawView::seed_fill(CDC *pDC, int x, int y, int ecolor, int fcolor)
{
ecolor=RGB(0,0,255);
fcolor=RGB(255,0,0);
if(Getpixel(x,y)!=ecolor&&Getpixel(x,y)!=fcolor)
{
setpixel(pDC,x,y);
seed_fill(pDC,x,y+1,ecolor,fcolor);
seed_fill(pDC,x,y-1,ecolor,fcolor);
seed_fill(pDC,x+1,y,ecolor,fcolor);
seed_fill(pDC,x-1,y,ecolor,fcolor);
}
}
void CMyDrawView::setpixel(CDC *pDC, int i, int j)
{
CBrush br(RGB(255,0,0));
pDC->SelectObject(&br);
pDC->Rectangle(i*10,j*10,i*10+10,j*10+10);
}
解决方案 »
- 简单的非模式对话框create出错
- 用IDispatch的方法创建Outlook或者Word失败!有没有遇到过这种情况的???
- 怎么在单(多)文档的客户区添加对话框???
- 请问有没有一个函数实现将一串字符转化为十六进制形式显示的字符串呀,请高手进来,多多指教,在线等!
- 新手!小问题!!
- 毕业设计:请问谁有bmp的霍夫曼压缩算法源代码?
- 初级问题
- 使用过解霸的朋友请进来帮我解决下这个问题,急!
- 求助 怎样把函数转化为语言并用VC++把图线做出来
- 刚开始学vc没多久 各位大哥给点指导
- error C2039: 'Getpixel' : is not a member of 'CDC'
- SetWindowText和OnTimer问题。
不是cdc的成员函数
改为
GetPixel(pDC->GetSafeHdc(), x, y)试试看
改为
GetPixel(pDC->GetSafeHdc(), x, y)
调试没问题了,可是他还是填充不了,那是怎么一回事啊?
setpixel();
你用什么来填充的看不到你用dc,如果你做图像处理而不是图形图像建议不要使用gdi。我看过不少帖子直接用gdi说效率不高的