From 9c4a3817702458abde2b9f14f4da6850ba451353 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sun, 11 Jul 2021 15:35:55 -0700 Subject: . --- img.mu | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'img.mu') diff --git a/img.mu b/img.mu index 2016f571..dfca541a 100644 --- a/img.mu +++ b/img.mu @@ -504,7 +504,6 @@ fn compute-color-and-error buf: (addr array int), initial-color: byte, x: int, y var error/esi: int <- _read-dithering-error buf, x, y, width # error += initial-color << 16 var color-int/eax: int <- copy initial-color -#? draw-int32-decimal-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, initial-color-int, 2/fg 0/bg color-int <- shift-left 0x10 # we have 32 bits; we'll use 16 bits for the fraction and leave 8 for unanticipated overflow error <- add color-int # tmp = max(error, 0) @@ -529,14 +528,12 @@ fn compute-color-and-error buf: (addr array int), initial-color: byte, x: int, y var color/eax: int <- copy tmp color <- shift-right-signed 0x14 color <- add 0x10 -#? draw-int32-decimal-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, color, 3/fg 0/bg -#? draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, " ", 7/fg 0/bg var color-byte/eax: byte <- copy-byte color return color-byte, error } -# Use Floyd-Steinberg algorithm for turning an image of greyscale pixels into -# one of pure black or white pixels. +# Use Floyd-Steinberg algorithm for diffusing error at x, y in a 2D grid of +# dimensions (width, height) # # https://tannerhelland.com/2012/12/28/dithering-eleven-algorithms-source-code.html # -- cgit 1.4.1-2-gfad0