about summary refs log tree commit diff stats
path: root/html/linux/ex1.subx.html
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-04-20 19:47:57 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-04-20 19:47:57 -0700
commitfb34909b4eb744811f6da2354667179c108870cb (patch)
tree8b5f4c662b9868965645968ef188c5e7ec3b3d10 /html/linux/ex1.subx.html
parentfb3967876c8b97ebf8a7ad5570623a8a4c6dead6 (diff)
downloadmu-fb34909b4eb744811f6da2354667179c108870cb.tar.gz
get bresenham line drawing working with a trace
    (brline . (fn () (screen x0 y0 x1 y1 color)
                 ((fn (dx dy sx sy)
                    ((fn (err)
                       (brline1 screen x0 y0 x1 y1 dx dy sx sy err color))
                     (+ dx dy)))
                  (abs (- x1 x0))
                  (- 0 (abs (- y1 y0)))
                  (sgn (- x1 x0))
                  (sgn (- y1 y0)))))
    (brline1 . (fn () (screen x y xmax ymax dx dy sx sy err color)
                 (pixel screen x y color)
                 (if (andf (= x xmax) (= y ymax))
                   ()
                   ((fn (e2)
                      (brline1 screen
                        (if (>= e2 dy)
                          (+ x sx)
                          x)
                        (if (<= e2 dx)
                          (+ y sy)
                          y)
                        xmax
                        ymax
                        dx
                        dy
                        sx
                        sy
                        (+ err
                           (+
                             (if (>= e2 dy)
                               dy
                               0)
                             (if (<= e2 dx)
                               dx
                               0)))
                        color))
                    (* err 2)))))

sandbox: (brline screen 1 1 5 5 12)

There are two ideas stemming from this commit:
  - I need an extremely compact on-screen trace to underlie the trace UX
  - perhaps we should start truncating trace lines
Diffstat (limited to 'html/linux/ex1.subx.html')
0 files changed, 0 insertions, 0 deletions
'>171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250