diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-07-06 08:39:46 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-07-06 08:39:46 -0700 |
commit | c31c02f0d11511fd8e3e2fe934dd1609ea97eb69 (patch) | |
tree | 69f2be4b59f99ca9cf2e0373e893cae6f6953a5a /colors.mu | |
parent | d84d17d6f5c3f7f3c7718bf42957d61ba4135609 (diff) | |
download | mu-c31c02f0d11511fd8e3e2fe934dd1609ea97eb69.tar.gz |
.
Diffstat (limited to 'colors.mu')
-rw-r--r-- | colors.mu | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/colors.mu b/colors.mu index 43094153..90f33454 100644 --- a/colors.mu +++ b/colors.mu @@ -240,47 +240,3 @@ fn print-nearby-colors screen: (addr screen), h: int, s: int, l: int { loop } } - -fn nearest-color-euclidean-hsl h: int, s: int, l: int -> _/eax: int { - var result/edi: int <- copy 0x100/invalid - var max-distance/esi: int <- copy 0x30000/max # 3 * 0x100*0x100 - var a/ecx: int <- copy 0 - var b/edx: int <- copy 0 - var c/ebx: int <- copy 0 - var color/eax: int <- copy 0 - { - compare color, 0x100 - break-if->= - $nearest-color-euclidean-hsl:body: { - a, b, c <- color-rgb color - a, b, c <- hsl a, b, c - { - var curr-distance/eax: int <- euclidean-distance-squared a, b, c, h, s, l - compare curr-distance, max-distance - break-if->= $nearest-color-euclidean-hsl:body - max-distance <- copy curr-distance - } - result <- copy color - } - color <- increment - loop - } - return result -} - -fn euclidean-distance-squared x1: int, y1: int, z1: int, x2: int, y2: int, z2: int -> _/eax: int { - var result/edi: int <- copy 0 - var tmp/eax: int <- copy x1 - tmp <- subtract x2 - tmp <- multiply tmp - result <- add tmp - tmp <- copy y1 - tmp <- subtract y2 - tmp <- multiply tmp - result <- add tmp - tmp <- copy z1 - tmp <- subtract z2 - tmp <- multiply tmp - result <- add tmp - return result -} |