pencil tool (thickpixel)
This commit is contained in:
parent
6435128e22
commit
c7c145f0b1
2 changed files with 29 additions and 9 deletions
28
pixler.bas
28
pixler.bas
|
|
@ -6,8 +6,8 @@ type statetype
|
|||
offsetY as long
|
||||
zoom as single
|
||||
brushsize as integer
|
||||
startX as integer
|
||||
startY as integer
|
||||
startX as long
|
||||
startY as long
|
||||
isDrawing as integer
|
||||
end type
|
||||
|
||||
|
|
@ -303,8 +303,8 @@ sub canvas
|
|||
dim r as integer
|
||||
|
||||
' 3. Calculate Canvas Coordinates
|
||||
dim canX as integer
|
||||
dim canY as integer
|
||||
dim canX as long
|
||||
dim canY as long
|
||||
canX = int((_mousex - state.offsetX) / state.zoom)
|
||||
canY = int((_mousey - state.offsetY) / state.zoom)
|
||||
|
||||
|
|
@ -370,8 +370,15 @@ sub canvas
|
|||
select case state.tool
|
||||
case 1 ' Pencil
|
||||
_dest layers(1).ihandle
|
||||
thickline state.startX, state.startY, canX, canY, drawCol
|
||||
addcommand "line ("+str$(state.startX)+","+ str$(state.startY)+","+str$(canX)+","+str$(canY)+","+hex$(drawCol)+")"
|
||||
if canX=state.startX and canY=state.startY then
|
||||
thickpixel canX,canY,drawCol
|
||||
addcommand "pixel ("+str$(canX)+","+str$(canY)+","+hex$(drawCol)+")"
|
||||
else
|
||||
thickline state.startX, state.startY, canX, canY, drawCol
|
||||
addcommand "line ("+str$(state.startX)+","+str$(state.startY)+","+str$(canX)+","+str$(canY)+","+hex$(drawCol)+")"
|
||||
end if
|
||||
'thickline state.startX, state.startY, canX, canY, drawCol
|
||||
'addcommand "line ("+str$(state.startX)+","+ str$(state.startY)+","+str$(canX)+","+str$(canY)+","+hex$(drawCol)+")"
|
||||
state.startX = canX: state.startY = canY
|
||||
case 2 ' Straight Line
|
||||
thickline state.startX, state.startY, canX, canY, drawCol
|
||||
|
|
@ -433,8 +440,13 @@ sub canvas
|
|||
'_putimage , layers(2).ihandle, layers(1).ihandle
|
||||
select case state.tool
|
||||
case 2 ' Line
|
||||
thickline state.startX, state.startY, canX, canY, drawCol
|
||||
addcommand "line ("+str$(state.startX)+","+str$(state.startY)+","+str$(canX)+","+str$(canY)+","+hex$(drawCol)+")"
|
||||
if canX=state.startX and canY=state.startY then
|
||||
thickpixel canX,canY,drawCol
|
||||
addcommand "pixel ("+str$(canX)+","+str$(canY)+","+hex$(drawCol)+")"
|
||||
else
|
||||
thickline state.startX, state.startY, canX, canY, drawCol
|
||||
addcommand "line ("+str$(state.startX)+","+str$(state.startY)+","+str$(canX)+","+str$(canY)+","+hex$(drawCol)+")"
|
||||
end if
|
||||
case 3 ' Circle
|
||||
r = int(sqr((canX - state.startX)^2 + (canY - state.startY)^2))
|
||||
thickcircle state.startX, state.startY, r + 1, drawCol
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue