... | ... |
@@ -39,7 +39,7 @@ |
39 | 39 |
;toolpane { x1 2 y1 2 x2 2 y2 2 } |
40 | 40 |
;pattpane { x1 2 y1 2 x2 2 y2 2 } |
41 | 41 |
;sizepane { x1 2 y1 2 x2 2 y2 2 } |
42 |
-;cursor { x 2 y 2 x0 2 y0 2 tool 1 size 1 patt 1 drag 1 mirror 1 oper 2 } |
|
42 |
+;cursor { x 2 y 2 x0 2 y0 2 dx 2 dy 2 tool 1 size 1 patt 1 drag 1 last 1 mirror 1 oper 2 } |
|
43 | 43 |
;zoom { active 1 x 2 y 2 } |
44 | 44 |
;rect { x1 2 y1 2 x2 2 y2 2 } |
45 | 45 |
;line { x0 2 y0 2 x 2 y 2 sx 2 sy 2 dx 2 dy 2 e1 2 e2 2 } |
... | ... |
@@ -122,6 +122,28 @@ BRK |
122 | 122 |
#00 =cursor.drag |
123 | 123 |
$no-release |
124 | 124 |
|
125 |
+ ( operations on release line/rect ) |
|
126 |
+ ,$no-touch-change ~Mouse.state ~cursor.last EQU JMP2? |
|
127 |
+ ,$no-touch-change ~Mouse.x CLN2r ~canvas.x1 GTS2 STH2r ~canvas.x2 LTS2 #0101 NEQ2 JMP2? |
|
128 |
+ ,$no-touch-change ~Mouse.y CLN2r ~canvas.y1 GTS2 STH2r ~canvas.y2 LTS2 #0101 NEQ2 JMP2? |
|
129 |
+ ,$no-touch-ondown ~Mouse.state #00 EQU JMP2? |
|
130 |
+ ( on down ) |
|
131 |
+ ~Mouse.x =cursor.dx |
|
132 |
+ ~Mouse.y =cursor.dy |
|
133 |
+ $no-touch-ondown |
|
134 |
+ ,$no-touch-onup ~Mouse.state #00 NEQ JMP2? |
|
135 |
+ ( on up ) |
|
136 |
+ ,$no-touch-line ~cursor.tool #02 NEQ JMP2? |
|
137 |
+ ~cursor.dx ~canvas.x1 SUB2 ~cursor.dy ~canvas.y1 SUB2 ~Mouse.x ~canvas.x1 SUB2 ~Mouse.y ~canvas.y1 SUB2 #01 ,paint-line JSR2 |
|
138 |
+ ,$touch-end JMP2 |
|
139 |
+ $no-touch-line |
|
140 |
+ ,$no-touch-rect ~cursor.tool #03 NEQ JMP2? |
|
141 |
+ ~cursor.dx ~canvas.x1 SUB2 ~cursor.dy ~canvas.y1 SUB2 ~Mouse.x ~canvas.x1 SUB2 ~Mouse.y ~canvas.y1 SUB2 #01 ,paint-rect JSR2 |
|
142 |
+ ,$touch-end JMP2 |
|
143 |
+ $no-touch-rect |
|
144 |
+ $no-touch-onup |
|
145 |
+ $no-touch-change |
|
146 |
+ |
|
125 | 147 |
,$no-touch ~Mouse.state #00 EQU JMP2? |
126 | 148 |
|
127 | 149 |
( drag ) |
... | ... |
@@ -184,13 +206,10 @@ BRK |
184 | 206 |
$no-touch-pen |
185 | 207 |
|
186 | 208 |
,$no-touch-brush ~cursor.tool #01 NEQ JMP2? |
187 |
- ~Mouse.x ~canvas.x1 SUB2 ~Mouse.y ~canvas.y1 SUB2 ,paint JSR2 |
|
209 |
+ ~Mouse.x ~canvas.x1 SUB2 ~Mouse.y ~canvas.y1 SUB2 ,paint-brush JSR2 |
|
188 | 210 |
,$touch-end JMP2 |
189 | 211 |
$no-touch-brush |
190 | 212 |
|
191 |
- ( unknown tool ) |
|
192 |
- #aa =Console.byte |
|
193 |
- |
|
194 | 213 |
$no-touch-canvas |
195 | 214 |
|
196 | 215 |
( background interface ) |
... | ... |
@@ -250,6 +269,7 @@ BRK |
250 | 269 |
|
251 | 270 |
~Mouse.x =cursor.x0 |
252 | 271 |
~Mouse.y =cursor.y0 |
272 |
+ ~Mouse.state =cursor.last |
|
253 | 273 |
|
254 | 274 |
BRK |
255 | 275 |
|
... | ... |
@@ -318,7 +338,31 @@ RTN |
318 | 338 |
|
319 | 339 |
RTN |
320 | 340 |
|
321 |
-@paint ( x y ) |
|
341 |
+;rpt { x 2 y 2 } |
|
342 |
+ |
|
343 |
+@paint-rect ( x1 y1 x2 y2 color ) |
|
344 |
+ |
|
345 |
+ ( load ) =color =rect.y2 =rect.x2 DUP2 =rpt.y =rect.y1 DUP2 =rpt.x =rect.x1 |
|
346 |
+ $ver |
|
347 |
+ ~rect.x1 =rpt.x |
|
348 |
+ $hor |
|
349 |
+ ~rpt.x SWP POP =px.x ~rpt.y SWP POP =px.y |
|
350 |
+ ,$no-pixel ,patternize JSR2 #00 EQU JMP2? |
|
351 |
+ ( draw ) ~rpt.x ~rpt.y ~cursor.oper JSR2 |
|
352 |
+ $no-pixel |
|
353 |
+ ( incr ) ~rpt.x ++ =rpt.x |
|
354 |
+ ,$hor ~rpt.x ~rect.x2 LTH2 JMP2? |
|
355 |
+ ~rpt.y ++ =rpt.y |
|
356 |
+ ,$ver ~rpt.y ~rect.y2 LTH2 JMP2? |
|
357 |
+ |
|
358 |
+ ,draw-canvas JSR2 |
|
359 |
+ ,draw-toolpane JSR2 |
|
360 |
+ ,draw-pattpane JSR2 |
|
361 |
+ ,draw-sizepane JSR2 |
|
362 |
+ |
|
363 |
+RTN |
|
364 |
+ |
|
365 |
+@paint-brush ( x y ) |
|
322 | 366 |
|
323 | 367 |
#0003 SUB2 =pt0.y #0003 SUB2 =pt0.x ( cursor offset ) |
324 | 368 |
|