种子填充算法中取一个像素点时,为什么编译时在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);
}

解决方案 »

  1.   

    Getpixel
    不是cdc的成员函数
      

  2.   

    把 pDC->Getpixel(x,y)
    改为
    GetPixel(pDC->GetSafeHdc(), x, y)试试看
      

  3.   

    把 pDC->Getpixel(x,y)
    改为
    GetPixel(pDC->GetSafeHdc(), x, y)
    调试没问题了,可是他还是填充不了,那是怎么一回事啊?
      

  4.   

    gdi 我没用过,不是很清楚。我只能说个大概
    setpixel();
    你用什么来填充的看不到你用dc,如果你做图像处理而不是图形图像建议不要使用gdi。我看过不少帖子直接用gdi说效率不高的