fix: add backend-clear method for raw 2D arrays

Same pattern as the draw-text array fix. Application code may call
backend-clear with a framebuffer array instead of a backend instance.
The array method clears all cells to default blank state.
This commit is contained in:
2026-05-13 16:29:50 -04:00
parent 3bc6df6fd0
commit 07cea571ef
2 changed files with 17 additions and 0 deletions

View File

@@ -382,6 +382,18 @@ framebuffer without wrapping it in a ~framebuffer-backend~.
:bold bold :italic italic :underline underline)))))
#+end_src
*** backend-clear (raw array)
Allow clearing a raw 2D framebuffer array directly (same type as returned by
~make-framebuffer~). Resets all cells to blank defaults.
#+begin_src lisp :tangle ../src/rendering/framebuffer.lisp
(defmethod backend-clear ((fb array))
(dotimes (y (array-dimension fb 0))
(dotimes (x (array-dimension fb 1))
(setf (aref fb y x) (make-cell)))))
#+end_src
*** draw-rect
Fill a rectangular region with space characters and an optional background