Added boundary fill, and removed unused variables.
This commit is contained in:
parent
89602f1804
commit
bbdb7a3033
3 changed files with 213 additions and 135 deletions
25
pixler.bas
25
pixler.bas
|
|
@ -35,8 +35,8 @@ screen _newimage(750,480,32)
|
|||
_delay 0.1
|
||||
temp&=_resize
|
||||
redim shared pal(0) as _unsigned long
|
||||
dim as integer ch1,ch2,ch3,bt
|
||||
loadpalette"slso8",pal()
|
||||
|
||||
loadpalette"custodian-8",pal()
|
||||
layers(0).ihandle=_newimage(320,320,32)
|
||||
layers(1).ihandle=_newimage(320,320,32)
|
||||
layers(2).ihandle=_newimage(320,320,32)
|
||||
|
|
@ -238,6 +238,8 @@ sub redraw
|
|||
filledpolygon numarr(),state.fcolor
|
||||
case "floodfill"
|
||||
floodfill numarr(0),numarr(1),numarr(2)
|
||||
case "boundaryfill"
|
||||
boundaryfill numarr(0),numarr(1),numarr(2),numarr(3)
|
||||
case "gradient"
|
||||
ditheredgradient numarr(0),numarr(1),numarr(2),numarr(3),state.fcolor,state.bcolor
|
||||
case ""
|
||||
|
|
@ -426,17 +428,12 @@ sub canvas
|
|||
end if
|
||||
end if
|
||||
|
||||
dim r as integer
|
||||
|
||||
' 3. Calculate Canvas Coordinates
|
||||
dim canx as long
|
||||
dim cany as long
|
||||
canx=int((_mousex-state.offsetx)/state.zoom)
|
||||
cany=int((_mousey-state.offsety)/state.zoom)
|
||||
|
||||
static polypoints(200) as single
|
||||
static pointcount as integer
|
||||
|
||||
static drawcol
|
||||
if _mousebutton(1) then drawcol=state.fcolor
|
||||
if _mousebutton(2) then drawcol=state.bcolor
|
||||
|
|
@ -704,8 +701,18 @@ sub do.floodfill(x as long,y as long,col as long)
|
|||
if mouseclicked or rmouseclicked then
|
||||
_source layers(1).ihandle
|
||||
_dest layers(1).ihandle
|
||||
floodfill x,y,col
|
||||
addcommand"floodfill ("+tst(x)+","+tst(y)+","+hex$(col)+")"
|
||||
|
||||
' Check if either Left Shift (100303) or Right Shift (100304) is held down
|
||||
if _keydown(100303) or _keydown(100304) then
|
||||
' Fill until it hits the background color as a border
|
||||
boundaryfill x,y,col,state.bcolor
|
||||
addcommand"boundaryfill ("+tst(x)+","+tst(y)+","+hex$(col)+","+hex$(state.bcolor)+")"
|
||||
else
|
||||
' Standard color-replace flood fill
|
||||
floodfill x,y,col
|
||||
addcommand"floodfill ("+tst(x)+","+tst(y)+","+hex$(col)+")"
|
||||
end if
|
||||
|
||||
state.isdrawing=0
|
||||
_source osource
|
||||
_dest odest
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue