oldfill.txt
来自「图的建立、遍历、最小生成树、最短路径 图的建立、遍历、最小生成树、最短路径」· 文本 代码 · 共 58 行
TXT
58 行
{
if(newColor == oldColor)
return;
int tempX, leftX, rightX;
int index=0;
int stackX[500], stackY[500];
stackX[index]= x;
stackY[index]= y;
while(index> -1)
{
y=stackY[index];
tempX=x=stackX[index];
index--;
while(GetColor(x, y) == oldColor && x<MAPWIDTH)
{
FillGrid(&dcMemory, x, y, newColor);
x++;
}
rightX=x;
x=tempX-1;
while(GetColor(x, y) == oldColor && x>0 )
{
FillGrid(&dcMemory, x, y, newColor);
x--;
}
leftX=x;
y++;
while(x<rightX)
{
while(++x<rightX && GetColor(x ,y) != newColor)
;
if(x == rightX)
break;
while(++x<rightX && GetColor(x ,y) == newColor)
index++;
stackX[index]=x;
stackY[index]=y;
}
x=leftX;
y-=2;
while(x<rightX)
{
while(++x<rightX && GetColor(x,y)!=newColor)
;
if(x==rightX)
break;
while(++x<rightX && GetColor(x,y)==newColor)
;
index++;
stackX[index]=x;
stackY[index]=y;
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?