honeylisp/editor/tileedit/iigs.fnl

13 lines
378 B
Fennel

(local {: pal : gs-to-rgb} (require :editor.tiledraw.iigs))
{:map-bitxy (fn [self x y]
(let [ibyte (+ (* y 8) (bit.rshift x 1))
ibit (match (% x 2) 0 4 1 0)]
(values ibyte ibit 0x0f)))
:pixel-color (fn [self b] (gs-to-rgb (. pal (+ b 1))))
:draw-bits #(- $1.icolor 1)
:palette #(icollect [_ color (ipairs pal)] (gs-to-rgb color))
:pixel-storage-divisor #2
}