faint, 中文名真是怪异, 难道是 flood fill 算法?
图形颜色填充的一种算法.
图形颜色填充的一种算法.
解决方案 »
- 如何销毁singelton的obj? 如何在一个Singleton程序里 按序 多次运行Main函数?
- 如何在打包时设置JVM的虚拟内存大小 Manifest.mf文件中
- sql优化求助
- 在线等待回答,设置多个TextField内容。。
- 问大家一个问题,什么叫迭代器?
- 请问大家一下,现在用java 5.0的多么?
- 请问 \\s+({0})\\s 的正则代表什么含义?求大虾
- 开发java将近两年,一家单位血癌女冠让过去高php,请问值得吗?
- 高分征集Think in java(第2版)中文电子版
- String类的问题
- jdbc问题!
- 如何把“Mon Jan 07 17:24:36 CST 2002”转换为SQL SERVER里DATETIME接受的格式?
扫描中有特别的洪水算法,相关的好象只有这个,如果需要,还有ip欺骗中的
flood算法,不会是那个吧?FloodFill 函数从给定的起始位置开始,以给定的颜色向四面八方填充某个区域(像水一样蔓延,因此叫 Flood Filling),一直到遇到与给定起始位置的象素值不同的点为止。因此,在这一过程中,我们需要两个回调函数,一个回调函数用来判断蔓延过程中遇到的点的象素值是否和起始点相同,另外一个回调函数用来生成填充该区域的水平扫描线。在进行绘图时,该函数比较的是象素值,但实际上,该函数也可以比较任何其他值,从而完成特有的蔓延动作。
功 能: 填充一个有界区域
用 法: void far floodfill(int x, int y, int border);
程序例: #include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h> int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
int maxx, maxy; /* initialize graphics, local variables */
initgraph(&gdriver, &gmode, ""); /* read result of initialization */
errorcode = graphresult();
if (errorcode != grOk)
/* an error occurred */
{
printf("Graphics error: %s\n",
grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1);
/* terminate with an error code */
} maxx = getmaxx();
maxy = getmaxy(); /* select drawing color */
setcolor(getmaxcolor()); /* select fill color */
setfillstyle(SOLID_FILL, getmaxcolor()); /* draw a border around the screen */
rectangle(0, 0, maxx, maxy); /* draw some circles */
circle(maxx / 3, maxy /2, 50);
circle(maxx / 2, 20, 100);
circle(maxx-20, maxy-50, 75);
circle(20, maxy-20, 25); /* wait for a key */
getch(); /* fill in bounded region */
floodfill(2, 2, getmaxcolor()); /* clean up */
getch();
closegraph();
return 0;
}