@@ 64,6 64,7 @@
%BANK { #2000 }
%GET-ADDR { .settings/selection LDZ TOS #0010 ** BANK ++ }
+%GET-COLOR { STHk #02 / + DEI STHr #01 #02 MOD - #04 * SFT #0f AND }
( devices )
@@ 83,7 84,6 @@
&blending $1
&depth $1
&brush $1
- &page $2
&tile $2
&ratio $1
&selection $1
@@ 99,12 99,8 @@
@dataview [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
@preview [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
@tileview [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
-
-@rect [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
-@mouse [ &x $2 &y $2 ]
-@pt [ &x $1 &y $1 ]
-
-@color $1
+@pointer [ &x $2 &y $2 ]
+@color $1
( program )
@@ 125,12 121,12 @@
VER TOS #0008 ** #0048 ++ .frame/height STZ2
#01 .settings/brush STZ
#32 .settings/ratio STZ
- BANK .settings/page STZ2
BANK #0448 ++ .settings/tile STZ2
#01 .settings/depth STZ
#01 .settings/blending STZ
#01 .settings/color STZ
#01 .settings/tool STZ
+ BANK .settings/focus STZ2
.Screen/width DEI2 #0001 SFT2 .frame/width LDZ2 #0001 SFT2 --
.Screen/height DEI2 #0001 SFT2 .frame/height LDZ2 #0001 SFT2 --
@@ 145,53 141,6 @@
.frame/x1 LDZ2 #0060 ++ .frame/y1 LDZ2 #0020 #0020 SIZE-TO-RECT ;colorview SET-RECT
.frame/x1 LDZ2 #0090 ++ .frame/y1 LDZ2 #0048 #0020 SIZE-TO-RECT ;dataview SET-RECT
-(
-
- .frame/x1 LDZ2 #0002 --
- .frame/y1 LDZ2 #0002 --
- .frame/x2 LDZ2 #0001 ++
- .frame/y2 LDZ2 #0001 ++ #02 ;line-rect JSR2
-
- .tileview/x1 LDZ2 #0002 --
- .tileview/y1 LDZ2 #0002 --
- .tileview/x2 LDZ2 #0001 ++
- .tileview/y2 LDZ2 #0001 ++ #03 ;line-rect JSR2
- .toolview/x1 LDZ2 #0002 --
- .toolview/y1 LDZ2 #0002 --
- .toolview/x2 LDZ2 #0001 ++
- .toolview/y2 LDZ2 #0001 ++ #03 ;line-rect JSR2
-
-
- .frame/x1 LDZ2 .frame/x2 LDZ2 .frame/y1 LDZ2 #0032 ++ #03 ;line-hor JSR2
-
-
- .blendview/x1 LDZ2 #0002 --
- .blendview/y1 LDZ2 #0002 --
- .blendview/x2 LDZ2 #0001 ++
- .blendview/y2 LDZ2 #0001 ++ #03 ;line-rect JSR2
-
- .preview/x1 LDZ2 #0002 --
- .preview/y1 LDZ2 #0002 --
- .preview/x2 LDZ2 #0001 ++
- .preview/y2 LDZ2 #0001 ++ #03 ;line-rect JSR2
-
- .colorview/x1 LDZ2 #0002 --
- .colorview/y1 LDZ2 #0002 --
- .colorview/x2 LDZ2 #0001 ++
- .colorview/y2 LDZ2 #0001 ++ #03 ;line-rect JSR2
-
- .dataview/x1 LDZ2 #0002 --
- .dataview/y1 LDZ2 #0002 --
- .dataview/x2 LDZ2 #0001 ++
- .dataview/y2 LDZ2 #0001 ++ #03 ;line-rect JSR2
-
- .frame/x1 LDZ2 #0002 --
- .frame/y1 LDZ2 #0002 --
- .frame/x2 LDZ2 #0001 ++
- .frame/y2 LDZ2 #0001 ++ #02 ;line-rect JSR2
-
-)
-
;filepath1 .File/name DEO2 #2000 .File/length DEO2 BANK .File/load DEO2
;redraw JSR2
@@ 208,16 157,6 @@ BRK
( skip ) .Controller/button DEI #00 ! #01 JCN [ BRK ]
- .Controller/button DEI #11 ! ,&no-pageup JCN .settings/page LDZ2
- #0800 -- .settings/page STZ2
- ;redraw JSR2
- BRK &no-pageup
-
- .Controller/button DEI #21 ! ,&no-pagedown JCN .settings/page LDZ2
- #0800 ++ .settings/page STZ2
- ;redraw JSR2
- BRK &no-pagedown
-
.Controller/button DEI #f0 AND
DUP #04 SFT #01 AND #01 ! ,&no-up JCN
( move ) .settings/selection LDZ #10 - .settings/selection STZ &no-up
@@ 281,6 220,7 @@ BRK
.settings/color LDZ
;put-pixel JSR2
;draw-tileview JSR2
+ ;draw-preview JSR2
BRK &no-brush
DUP #01 ! ,&no-selector JCN
POP
@@ 301,6 241,7 @@ BRK
DUP #02 > ,&no-color JCN
DUP #01 + .settings/color STZ
#00 .settings/tool STZ
+ ;draw-colorview JSR2
;draw-toolview JSR2 POP BRK
&no-color
DUP #06 > ,&no-tool JCN
@@ 346,17 287,6 @@ BRK
@on-touch-colorview ( -> )
- ( channel ) .Mouse/y DEI2 .colorview/y1 LDZ2 -- #0008 // TOB STH
- ( rgb ) .Mouse/x DEI2 .colorview/x1 LDZ2 -- #0008 // TOB
- DUP #00 ! ,&no-brush JCN
- STHkr .settings/brush STZ &no-brush
- DUP #01 ! ,&no-red JCN
- STHkr .System/r ;set-color JSR2 &no-red
- DUP #02 ! ,&no-green JCN
- STHkr .System/g ;set-color JSR2 &no-green
- DUP #03 ! ,&no-blue JCN
- STHkr .System/b ;set-color JSR2 &no-blue
- POP POPr
( release ) #00 .Mouse/state DEO
;redraw JSR2
@@ 656,50 586,31 @@ RTN
RTN
@draw-colorview ( -- )
-
- ( value )
- .colorview/x1 LDZ2 .Screen/x DEO2
- .colorview/y2 LDZ2 #0001 ++ .Screen/y DEO2
- .settings/brush LDZ #23 ;draw-byte JSR2
-
+
+ .colorview/y2 LDZ2 .Screen/y DEO2
.colorview/x1 LDZ2 .Screen/x DEO2
- ;circle-icns .Screen/addr DEO2
+ ;font-hex [ .System/r .settings/color LDZ GET-COLOR ] TOS #0008 ** ++ .Screen/addr DEO2
+ #20 .settings/color LDZ + .Screen/color DEO
+ .Screen/x DEI2 #0008 ++ .Screen/x DEO2
+ ;font-hex [ .System/g .settings/color LDZ GET-COLOR ] TOS #0008 ** ++ .Screen/addr DEO2
+ #20 .settings/color LDZ + .Screen/color DEO
+ .Screen/x DEI2 #0008 ++ .Screen/x DEO2
+ ;font-hex [ .System/b .settings/color LDZ GET-COLOR ] TOS #0008 ** ++ .Screen/addr DEO2
+ #20 .settings/color LDZ + .Screen/color DEO
- #00 #04
- &loop
- OVR .settings/brush LDZ = #00 SWP #0008 ** ;circle-icns ++ .Screen/addr DEO2
- OVR .colorview/y1 LDZ2 ROT #00 SWP #0008 ** ++ .Screen/y DEO2
- OVR #20 + .Screen/color DEO
- INCR
- LTHk ,&loop JCN
- POP2
+ .colorview/x1 LDZ2 .colorview/y1 LDZ2
+ [ .System/r .settings/color LDZ GET-COLOR ] ,draw-slider JSR
+ .colorview/x1 LDZ2 .colorview/y1 LDZ2
+ [ .System/g .settings/color LDZ GET-COLOR ] ,draw-slider JSR
+ .colorview/x1 LDZ2 .colorview/y1 LDZ2
+ [ .System/b .settings/color LDZ GET-COLOR ] ,draw-slider JSR
- .colorview/y1 LDZ2 #0018 ++ .Screen/y DEO2
- .colorview/x1 LDZ2 #0008 ++ .Screen/x DEO2
- .System/r DEI2 ,&draw-color-code JSR
- .colorview/y1 LDZ2 #0018 ++ .Screen/y DEO2
- .colorview/x1 LDZ2 #0010 ++ .Screen/x DEO2
- .System/g DEI2 ,&draw-color-code JSR
- .colorview/y1 LDZ2 #0018 ++ .Screen/y DEO2
- .colorview/x1 LDZ2 #0018 ++ .Screen/x DEO2
- .System/b DEI2 ,&draw-color-code JSR
-
- RTN
-
- &draw-color-code ( color* -- )
- DUP ;font-hex ROT #0f AND #08 * #00 SWP ++ .Screen/addr DEO2
- ( draw ) #22 .Screen/color DEO
- .colorview/y1 LDZ2 #0010 ++ .Screen/y DEO2
- ;font-hex ROT #04 SFT #08 * #00 SWP ++ .Screen/addr DEO2
- ( draw ) #22 .Screen/color DEO
- .colorview/y1 LDZ2 #0008 ++ .Screen/y DEO2
- DUP ;font-hex ROT #0f AND #08 * #00 SWP ++ .Screen/addr DEO2
- ( draw ) #22 .Screen/color DEO
- .colorview/y1 LDZ2 .Screen/y DEO2
- ;font-hex ROT #04 SFT #08 * #00 SWP ++ .Screen/addr DEO2
- ( draw ) #22 .Screen/color DEO
- RTN
+RTN
+@draw-slider ( x* y* -- )
+
+ POP2 POP2
+
RTN
@draw-dataview ( -- )
@@ 726,17 637,17 @@ RTN
@draw-cursor ( -- )
( clear last cursor )
- .mouse/x LDZ2 .Screen/x DEO2
- .mouse/y LDZ2 .Screen/y DEO2
+ .pointer/x LDZ2 .Screen/x DEO2
+ .pointer/y LDZ2 .Screen/y DEO2
#30 .Screen/color DEO
( record mouse positions )
- .Mouse/x DEI2 .mouse/x STZ2
- .Mouse/y DEI2 .mouse/y STZ2
+ .Mouse/x DEI2 .pointer/x STZ2
+ .Mouse/y DEI2 .pointer/y STZ2
( draw new cursor )
- .mouse/x LDZ2 .Screen/x DEO2
- .mouse/y LDZ2 .Screen/y DEO2
+ .pointer/x LDZ2 .Screen/x DEO2
+ .pointer/y LDZ2 .Screen/y DEO2
;brush-icn #00 .settings/tool LDZ #08 * ++ .Screen/addr DEO2
#32 .Mouse/state DEI #00 ! + .Screen/color DEO
@@ 770,73 681,6 @@ RTN
RTN
-( Utils )
-
-@line-rect ( x1* y1* x2* y2* color -- )
-
- ( load ) .color STZ STH2k .rect/y2 STZ2 .rect/x2 STZ2 STH2k .rect/y1 STZ2 .rect/x1 STZ2
- STH2r STH2r
- &ver
- ( save ) OVR2 .Screen/y DEO2
- ( draw ) .rect/x1 LDZ2 .Screen/x DEO2 .color LDZ DUP .Screen/color DEO
- ( draw ) .rect/x2 LDZ2 .Screen/x DEO2 .Screen/color DEO
- ( incr ) SWP2 #0001 ++ SWP2
- LTH2k ,&ver JCN
- POP2 POP2
- .rect/x1 LDZ2 .rect/x2 LDZ2
- &hor
- ( save ) OVR2 .Screen/x DEO2
- ( draw ) .rect/y1 LDZ2 .Screen/y DEO2 .color LDZ DUP .Screen/color DEO
- ( draw ) .rect/y2 LDZ2 .Screen/y DEO2 .Screen/color DEO
- ( incr ) SWP2 #0001 ++ SWP2
- OVR2 OVR2 #0001 ++ LTS2 ,&hor JCN
- POP2 POP2
-
-RTN
-
-@fill-rect ( x1* y1* x2* y2* color -- )
-
- .color STZ
- ( x1 x2 y1 y2 ) ROT2 SWP2
- &ver
- ( save ) OVR2 .Screen/y DEO2
- STH2 STH2 OVR2 OVR2
- &hor
- ( save ) OVR2 .Screen/x DEO2
- ( draw ) .color LDZ .Screen/color DEO
- ( incr ) SWP2 #0001 ++ SWP2
- LTH2k ,&hor JCN
- POP2 POP2 STH2r STH2r
- ( incr ) SWP2 #0001 ++ SWP2
- LTH2k ,&ver JCN
- POP2 POP2 POP2 POP2
-
-RTN
-
-@line-hor ( x0* x1* y* color -- )
-
- STH .Screen/y DEO2
- &loop
- ( save ) OVR2 .Screen/x DEO2
- ( draw ) STHkr .Screen/color DEO
- ( incr ) SWP2 #0002 ++ SWP2
- LTH2k ,&loop JCN
- POP2 POP2 POPr
-
-RTN
-
-@line-ver ( x* y0* y1* color -- )
-
- STH ROT2 .Screen/x DEO2
- &loop
- ( save ) OVR2 .Screen/y DEO2
- ( draw ) STHkr .Screen/color DEO
- ( incr ) SWP2 #0002 ++ SWP2
- LTH2k ,&loop JCN
- POP2 POP2 POPr
-
-RTN
-
@brush-icn 8040 e070 381c 0c00
@tool_selector 80c0 e0f0 f8e0 1000
@tool_hand 2020 20b8 7c7c 3838