Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
14
Task/Bitmap-Flood-fill/Zkl/bitmap-flood-fill-1.zkl
Normal file
14
Task/Bitmap-Flood-fill/Zkl/bitmap-flood-fill-1.zkl
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
fcn flood(pixmap, x,y, repl){ // slow!
|
||||
targ,h,w:=pixmap[x,y], pixmap.h,pixmap.w;
|
||||
stack:=List(T(x,y));
|
||||
while(stack){
|
||||
x,y:=stack.pop();
|
||||
if((0<=y<h) and (0<=x<w)){
|
||||
p:=pixmap[x,y];
|
||||
if(p==targ){
|
||||
pixmap[x,y]=repl;
|
||||
stack.append( T(x-1,y), T(x+1,y), T(x, y-1), T(x, y+1) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
8
Task/Bitmap-Flood-fill/Zkl/bitmap-flood-fill-2.zkl
Normal file
8
Task/Bitmap-Flood-fill/Zkl/bitmap-flood-fill-2.zkl
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
pixmap:=PPM(250,302,0xFF|FF|FF);
|
||||
pixmap.circle(101,200,100,0); pixmap.circle(75,100,25,0);
|
||||
|
||||
flood(pixmap,200,100, 0xF0|00|00);
|
||||
flood(pixmap, 75,110, 0x00|F0|00);
|
||||
flood(pixmap, 75,100, 0x00|00|F0);
|
||||
|
||||
pixmap.writeJPGFile("flood.zkl.jpg");
|
||||
Loading…
Add table
Add a link
Reference in a new issue