Draw off the stage, on a work area that grows to hold it
A brush stroke was cut at the stage's edge, because its mask was the
stage's size, and anything drawn off the stage was invisible, because the
raster and the canvas were. Flash draws on a pasteboard and lets the
passepartout do the hiding; so does this now.
The picture is rasterised over what is drawn AND on screen, not over the
whole work area: each frame takes the bounds of its ops, cuts them to the
pane, and draws that. A frame with nothing off the stage is the stage, and
costs what it did; a background many stages wide costs the pane it is
seen through. Measured on a 320x200 stage at 200%, 12 shapes: 1.39 ms a
frame before, 1.46 after; with a 5000 px background, 1.65.
- a raster may have an :origin, the stage point its first pixel is, and
ops stay in stage pixels
- off the stage the raster has coverage, and what nothing drew on is
left transparent, so the work area shows through
- the work area grows to everything drawn and a stage round it, in steps
of 64, and never shrinks under the view; it is margins on the stage
box, so it scrolls left and up as well as right and down
- a brush stroke's mask is what is on screen
- onion ghosts and tracing reach off the stage the same way
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
ddef5c6bfd
commit
9af21c5d10
9 changed files with 316 additions and 98 deletions
|
|
@ -250,3 +250,19 @@
|
|||
(is (= 2 (count-index (-> (r/make 20 10) (r/clear! 0)
|
||||
(r/draw-ops! [{:kind :mask :mask m :color 4}]))
|
||||
4)))))
|
||||
|
||||
(deftest a-raster-with-an-origin-is-that-part-of-the-stage
|
||||
;; Ops stay in stage pixels: a raster whose first pixel is stage point
|
||||
;; (-10, -10) holds what is drawn there, layers included, 10 further on.
|
||||
(let [ops [{:kind :begin}
|
||||
{:kind :poly :pts (sq -5 -5 5 5) :n 4 :color 1}
|
||||
{:kind :end}
|
||||
{:kind :disc :cx -5 :cy 15 :r 2 :color 2}
|
||||
{:kind :rect :cx 15 :cy -5 :size 3 :color 3}]
|
||||
moved (-> (r/make 30 30) (assoc :origin [-10 -10]) (r/clear! 0) (r/draw-ops! ops))
|
||||
plain (-> (r/make 30 30) (r/clear! 0)
|
||||
(r/draw-ops! [{:kind :poly :pts (sq 5 5 15 15) :n 4 :color 1}
|
||||
{:kind :disc :cx 5 :cy 25 :r 2 :color 2}
|
||||
{:kind :rect :cx 25 :cy 5 :size 3 :color 3}]))]
|
||||
(is (= 100 (count-index moved 1)))
|
||||
(is (= (vec (array-seq (:buf plain))) (vec (array-seq (:buf moved)))))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue