fix floodfill redraw, added eyedropper tool back in.
This commit is contained in:
parent
7aacca5803
commit
a0b0bbc939
3 changed files with 34 additions and 8 deletions
28
pixler.bas
28
pixler.bas
|
|
@ -90,8 +90,6 @@ do
|
||||||
if showcolorpicker then colorpicker
|
if showcolorpicker then colorpicker
|
||||||
if showcommands then commandlist
|
if showcommands then commandlist
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
'Mouse Handling
|
'Mouse Handling
|
||||||
while _mouseinput:mw=mw+_mousewheel:wend
|
while _mouseinput:mw=mw+_mousewheel:wend
|
||||||
mouseclicked = 0
|
mouseclicked = 0
|
||||||
|
|
@ -198,6 +196,7 @@ sub redraw
|
||||||
for i=lbound(commands) to ubound(commands)
|
for i=lbound(commands) to ubound(commands)
|
||||||
getnums commands(i),numarr()
|
getnums commands(i),numarr()
|
||||||
_dest layers(1).ihandle
|
_dest layers(1).ihandle
|
||||||
|
_source layers(1).ihandle
|
||||||
select case lcase$(_trim$(left$(commands(i),instr(commands(i),"(")-1)))
|
select case lcase$(_trim$(left$(commands(i),instr(commands(i),"(")-1)))
|
||||||
case "canvas"
|
case "canvas"
|
||||||
for j=0 to 3
|
for j=0 to 3
|
||||||
|
|
@ -704,18 +703,31 @@ sub do.floodfill(x as long,y as long, col as long)
|
||||||
_dest layers(1).ihandle
|
_dest layers(1).ihandle
|
||||||
FloodFill x,y,col
|
FloodFill x,y,col
|
||||||
addcommand "floodfill ("+tst(x)+","+tst(y)+","+hex$(col)+")"
|
addcommand "floodfill ("+tst(x)+","+tst(y)+","+hex$(col)+")"
|
||||||
|
state.isDrawing = 0
|
||||||
_source osource
|
_source osource
|
||||||
_dest odest
|
_dest odest
|
||||||
end if
|
end if
|
||||||
end sub
|
end sub
|
||||||
|
|
||||||
sub do.eyedropper(x,y)
|
sub do.eyedropper(x as long, y as long)
|
||||||
dim osource as long
|
dim osource as long
|
||||||
dim odest as long
|
if _mousebutton(1) or _mousebutton(2) then
|
||||||
osource = _source
|
osource = _source
|
||||||
odest = _dest
|
_source layers(1).ihandle ' Read from the main drawing layer
|
||||||
_source layers(1).ihandle
|
' Ensure the coordinates are within the canvas boundaries
|
||||||
|
if x >= 0 and x < _width(layers(1).ihandle) and y >= 0 and y < _height(layers(1).ihandle) then
|
||||||
|
' Left click sets foreground color, Right click sets background color
|
||||||
|
if _mousebutton(1) then
|
||||||
|
state.fcolor = pickedColor
|
||||||
|
addcommand "fcolor (" + hex$(point(x, y)) + ")"
|
||||||
|
elseif _mousebutton(2) then
|
||||||
|
state.bcolor = pickedColor
|
||||||
|
addcommand "bcolor (" + hex$(point(x, y)) + ")"
|
||||||
|
end if
|
||||||
|
end if
|
||||||
|
state.isDrawing = 0
|
||||||
|
_source osource
|
||||||
|
end if
|
||||||
end sub
|
end sub
|
||||||
|
|
||||||
function icon (index as long)
|
function icon (index as long)
|
||||||
|
|
|
||||||
6
test.pxl
Normal file
6
test.pxl
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
canvas (320,320)
|
||||||
|
fcolor (FF0D2B45)
|
||||||
|
bcolor (FFFFECD6)
|
||||||
|
floodfill (124,121,FFFFECD6)
|
||||||
|
fcircle (124,121,111,FF0D2B45)
|
||||||
|
|
||||||
8
test2.pxl
Normal file
8
test2.pxl
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
canvas (640,350)
|
||||||
|
fcolor (FF0D2B45)
|
||||||
|
bcolor (FFFFECD6)
|
||||||
|
fcircle (246,140,115,FF0D2B45)
|
||||||
|
fcircle (495,98,108,FFFFECD6)
|
||||||
|
fcolor (FF8D697A)
|
||||||
|
floodfill (68,90,FF8D697A)
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue