add layer field to app type, as preparation for switching to layer tree

This commit is contained in:
2025-08-09 08:15:11 +01:00
parent 8e475a3abe
commit 8d855be27a
5 changed files with 108 additions and 3 deletions

View File

@@ -1,16 +1,19 @@
structure LayerTree =
struct
type square = {r: int, g: int, b: int, a: int}
val emptyPixel = {r = 0, g = 0, b = 0, a = 0}
type grid = square vector vector
fun isBlank ({a, ...}: square) = a = 0
datatype tree =
NODE of {key: int, value: grid, left: tree, right: tree}
| LEAF
val emptyPixel = {r = 0, g = 0, b = 0, a = 0}
val emptyTree = LEAF
fun isBlank ({a, ...}: square) = a = 0
fun insert (newKey, newValue, tree) =
case tree of
LEAF => NODE {key = newKey, value = newValue, left = LEAF, right = LEAF}