diff --git a/pixler.bas b/pixler.bas index 4d63c1d..22479e1 100644 --- a/pixler.bas +++ b/pixler.bas @@ -90,8 +90,6 @@ do if showcolorpicker then colorpicker if showcommands then commandlist - - 'Mouse Handling while _mouseinput:mw=mw+_mousewheel:wend mouseclicked = 0 @@ -198,6 +196,7 @@ sub redraw for i=lbound(commands) to ubound(commands) getnums commands(i),numarr() _dest layers(1).ihandle + _source layers(1).ihandle select case lcase$(_trim$(left$(commands(i),instr(commands(i),"(")-1))) case "canvas" 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 FloodFill x,y,col addcommand "floodfill ("+tst(x)+","+tst(y)+","+hex$(col)+")" + state.isDrawing = 0 _source osource _dest odest end if end sub -sub do.eyedropper(x,y) +sub do.eyedropper(x as long, y as long) dim osource as long - dim odest as long - osource = _source - odest = _dest - _source layers(1).ihandle - + if _mousebutton(1) or _mousebutton(2) then + osource = _source + _source layers(1).ihandle ' Read from the main drawing layer + ' 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 function icon (index as long) diff --git a/test.pxl b/test.pxl new file mode 100644 index 0000000..1c62028 --- /dev/null +++ b/test.pxl @@ -0,0 +1,6 @@ +canvas (320,320) +fcolor (FF0D2B45) +bcolor (FFFFECD6) +floodfill (124,121,FFFFECD6) +fcircle (124,121,111,FF0D2B45) + diff --git a/test2.pxl b/test2.pxl new file mode 100644 index 0000000..15c90f4 --- /dev/null +++ b/test2.pxl @@ -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) +