diff options
author | Kartik Agaram <vc@akkartik.com> | 2021-10-11 21:35:16 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2021-10-11 21:35:16 -0700 |
commit | 132d72d28a63e58ec7f5e6fc955be140ee5844b0 (patch) | |
tree | a169eda8e804e45aaca32bf23df4dcb27b25e255 /html/511image.mu.html | |
parent | a54b2cb7af733ae053b0aa78eca2bd4a3419d23d (diff) | |
download | mu-132d72d28a63e58ec7f5e6fc955be140ee5844b0.tar.gz |
.
Diffstat (limited to 'html/511image.mu.html')
-rw-r--r-- | html/511image.mu.html | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/html/511image.mu.html b/html/511image.mu.html index 5593195b..e51afe38 100644 --- a/html/511image.mu.html +++ b/html/511image.mu.html @@ -117,13 +117,13 @@ if ('onhashchange' in window) { <span id="L52" class="LineNr"> 52 </span><span class="muComment"># dispatch to a few variants with mostly identical boilerplate</span> <span id="L53" class="LineNr"> 53 </span><span class="muComment"># TODO: if we have more resolution we could actually use it to improve</span> <span id="L54" class="LineNr"> 54 </span><span class="muComment"># dithering</span> -<span id="L55" class="LineNr"> 55 </span><span class="PreProc">fn</span> <span class="muFunction"><a href='511image.mu.html#L55'>render-image</a></span> <a href='500fake-screen.mu.html#L14'>screen</a>: (addr <a href='500fake-screen.mu.html#L14'>screen</a>), _img: (addr <a href='511image.mu.html#L6'>image</a>), xmin: int, ymin: int, width: int, height: int <span class="Delimiter">{</span> +<span id="L55" class="LineNr"> 55 </span><span class="PreProc">fn</span> <span class="muFunction"><a href='511image.mu.html#L55'>render-image</a></span> <a href='500fake-screen.mu.html#L16'>screen</a>: (addr <a href='500fake-screen.mu.html#L16'>screen</a>), _img: (addr <a href='511image.mu.html#L6'>image</a>), xmin: int, ymin: int, width: int, height: int <span class="Delimiter">{</span> <span id="L56" class="LineNr"> 56 </span> <span class="PreProc">var</span> img/<span class="muRegEsi">esi</span>: (addr <a href='511image.mu.html#L6'>image</a>) <span class="Special"><-</span> copy _img <span id="L57" class="LineNr"> 57 </span> <span class="PreProc">var</span> type-a/eax: (addr int) <span class="Special"><-</span> get img, <span class="PreProc">type</span> <span id="L58" class="LineNr"> 58 </span> <span class="Delimiter">{</span> <span id="L59" class="LineNr"> 59 </span> compare *type-a, <span class="Constant">1</span>/pbm <span id="L60" class="LineNr"> 60 </span> <span class="PreProc">break-if-!=</span> -<span id="L61" class="LineNr"> 61 </span> <a href='511image.mu.html#L127'>render-pbm-image</a> <a href='500fake-screen.mu.html#L14'>screen</a>, img, xmin, ymin, width, height +<span id="L61" class="LineNr"> 61 </span> <a href='511image.mu.html#L127'>render-pbm-image</a> <a href='500fake-screen.mu.html#L16'>screen</a>, img, xmin, ymin, width, height <span id="L62" class="LineNr"> 62 </span> <span class="PreProc">return</span> <span id="L63" class="LineNr"> 63 </span> <span class="Delimiter">}</span> <span id="L64" class="LineNr"> 64 </span> <span class="Delimiter">{</span> @@ -132,7 +132,7 @@ if ('onhashchange' in window) { <span id="L67" class="LineNr"> 67 </span> <span class="PreProc">var</span> img2-storage: <a href='511image.mu.html#L6'>image</a> <span id="L68" class="LineNr"> 68 </span> <span class="PreProc">var</span> img2/<span class="muRegEdi">edi</span>: (addr <a href='511image.mu.html#L6'>image</a>) <span class="Special"><-</span> address img2-storage <span id="L69" class="LineNr"> 69 </span> <a href='511image.mu.html#L391'>dither-pgm-unordered</a> img, img2 -<span id="L70" class="LineNr"> 70 </span> <a href='511image.mu.html#L1035'>render-raw-image</a> <a href='500fake-screen.mu.html#L14'>screen</a>, img2, xmin, ymin, width, height +<span id="L70" class="LineNr"> 70 </span> <a href='511image.mu.html#L1035'>render-raw-image</a> <a href='500fake-screen.mu.html#L16'>screen</a>, img2, xmin, ymin, width, height <span id="L71" class="LineNr"> 71 </span> <span class="PreProc">return</span> <span id="L72" class="LineNr"> 72 </span> <span class="Delimiter">}</span> <span id="L73" class="LineNr"> 73 </span> <span class="Delimiter">{</span> @@ -141,7 +141,7 @@ if ('onhashchange' in window) { <span id="L76" class="LineNr"> 76 </span> <span class="PreProc">var</span> img2-storage: <a href='511image.mu.html#L6'>image</a> <span id="L77" class="LineNr"> 77 </span> <span class="PreProc">var</span> img2/<span class="muRegEdi">edi</span>: (addr <a href='511image.mu.html#L6'>image</a>) <span class="Special"><-</span> address img2-storage <span id="L78" class="LineNr"> 78 </span> <a href='511image.mu.html#L836'>dither-ppm-unordered</a> img, img2 -<span id="L79" class="LineNr"> 79 </span> <a href='511image.mu.html#L1035'>render-raw-image</a> <a href='500fake-screen.mu.html#L14'>screen</a>, img2, xmin, ymin, width, height +<span id="L79" class="LineNr"> 79 </span> <a href='511image.mu.html#L1035'>render-raw-image</a> <a href='500fake-screen.mu.html#L16'>screen</a>, img2, xmin, ymin, width, height <span id="L80" class="LineNr"> 80 </span> <span class="PreProc">return</span> <span id="L81" class="LineNr"> 81 </span> <span class="Delimiter">}</span> <span id="L82" class="LineNr"> 82 </span><span class="CommentedCode">#? abort "render-image: unrecognized image type"</span> @@ -189,7 +189,7 @@ if ('onhashchange' in window) { <span id="L124" class="LineNr"> 124 </span><span class="Delimiter">}</span> <span id="L125" class="LineNr"> 125 </span> <span id="L126" class="LineNr"> 126 </span><span class="muComment"># render a black-and-white ascii bitmap (each pixel is 0 or 1)</span> -<span id="L127" class="LineNr"> 127 </span><span class="PreProc">fn</span> <span class="muFunction"><a href='511image.mu.html#L127'>render-pbm-image</a></span> <a href='500fake-screen.mu.html#L14'>screen</a>: (addr <a href='500fake-screen.mu.html#L14'>screen</a>), _img: (addr <a href='511image.mu.html#L6'>image</a>), xmin: int, ymin: int, width: int, height: int <span class="Delimiter">{</span> +<span id="L127" class="LineNr"> 127 </span><span class="PreProc">fn</span> <span class="muFunction"><a href='511image.mu.html#L127'>render-pbm-image</a></span> <a href='500fake-screen.mu.html#L16'>screen</a>: (addr <a href='500fake-screen.mu.html#L16'>screen</a>), _img: (addr <a href='511image.mu.html#L6'>image</a>), xmin: int, ymin: int, width: int, height: int <span class="Delimiter">{</span> <span id="L128" class="LineNr"> 128 </span> <span class="PreProc">var</span> img/<span class="muRegEsi">esi</span>: (addr <a href='511image.mu.html#L6'>image</a>) <span class="Special"><-</span> copy _img <span id="L129" class="LineNr"> 129 </span> <span class="muComment"># yratio = height/img->height</span> <span id="L130" class="LineNr"> 130 </span> <span class="PreProc">var</span> img-height-a/eax: (addr int) <span class="Special"><-</span> get img, height @@ -235,7 +235,7 @@ if ('onhashchange' in window) { <span id="L170" class="LineNr"> 170 </span> compare idx, len <span id="L171" class="LineNr"> 171 </span> <span class="Delimiter">{</span> <span id="L172" class="LineNr"> 172 </span> <span class="PreProc">break-if-<</span> -<span id="L173" class="LineNr"> 173 </span> <a href='500fake-screen.mu.html#L267'>set-cursor-position</a> <span class="Constant">0</span>/screen, <span class="Constant">0x20</span>/x <span class="Constant">0x20</span>/y +<span id="L173" class="LineNr"> 173 </span> <a href='500fake-screen.mu.html#L269'>set-cursor-position</a> <span class="Constant">0</span>/screen, <span class="Constant">0x20</span>/x <span class="Constant">0x20</span>/y <span id="L174" class="LineNr"> 174 </span> <a href='501draw-text.mu.html#L449'>draw-int32-decimal-wrapping-right-then-down-from-cursor-over-full-screen</a> <span class="Constant">0</span>/screen, imgx, <span class="Constant">3</span>/fg <span class="Constant">0</span>/bg <span id="L175" class="LineNr"> 175 </span> <a href='501draw-text.mu.html#L449'>draw-int32-decimal-wrapping-right-then-down-from-cursor-over-full-screen</a> <span class="Constant">0</span>/screen, imgy, <span class="Constant">4</span>/fg <span class="Constant">0</span>/bg <span id="L176" class="LineNr"> 176 </span> <a href='501draw-text.mu.html#L449'>draw-int32-decimal-wrapping-right-then-down-from-cursor-over-full-screen</a> <span class="Constant">0</span>/screen, idx, <span class="Constant">5</span>/fg <span class="Constant">0</span>/bg @@ -252,7 +252,7 @@ if ('onhashchange' in window) { <span id="L187" class="LineNr"> 187 </span> screenx <span class="Special"><-</span> add xmin <span id="L188" class="LineNr"> 188 </span> <span class="PreProc">var</span> screeny/<span class="muRegEdx">edx</span>: int <span class="Special"><-</span> convert y <span id="L189" class="LineNr"> 189 </span> screeny <span class="Special"><-</span> add ymin -<span id="L190" class="LineNr"> 190 </span> <a href='500fake-screen.mu.html#L578'>pixel</a> <a href='500fake-screen.mu.html#L14'>screen</a>, screenx, screeny, color-int +<span id="L190" class="LineNr"> 190 </span> <a href='500fake-screen.mu.html#L580'>pixel</a> <a href='500fake-screen.mu.html#L16'>screen</a>, screenx, screeny, color-int <span id="L191" class="LineNr"> 191 </span> x <span class="Special"><-</span> add one-f <span id="L192" class="LineNr"> 192 </span> <span class="PreProc">loop</span> <span id="L193" class="LineNr"> 193 </span> <span class="Delimiter">}</span> @@ -311,7 +311,7 @@ if ('onhashchange' in window) { <span id="L246" class="LineNr"> 246 </span><span class="Delimiter">}</span> <span id="L247" class="LineNr"> 247 </span> <span id="L248" class="LineNr"> 248 </span><span class="muComment"># render a greyscale ascii "greymap" (each pixel is a shade of grey from 0 to 255) by quantizing the shades</span> -<span id="L249" class="LineNr"> 249 </span><span class="PreProc">fn</span> <span class="muFunction"><a href='511image.mu.html#L249'>render-pgm-image</a></span> <a href='500fake-screen.mu.html#L14'>screen</a>: (addr <a href='500fake-screen.mu.html#L14'>screen</a>), _img: (addr <a href='511image.mu.html#L6'>image</a>), xmin: int, ymin: int, width: int, height: int <span class="Delimiter">{</span> +<span id="L249" class="LineNr"> 249 </span><span class="PreProc">fn</span> <span class="muFunction"><a href='511image.mu.html#L249'>render-pgm-image</a></span> <a href='500fake-screen.mu.html#L16'>screen</a>: (addr <a href='500fake-screen.mu.html#L16'>screen</a>), _img: (addr <a href='511image.mu.html#L6'>image</a>), xmin: int, ymin: int, width: int, height: int <span class="Delimiter">{</span> <span id="L250" class="LineNr"> 250 </span> <span class="PreProc">var</span> img/<span class="muRegEsi">esi</span>: (addr <a href='511image.mu.html#L6'>image</a>) <span class="Special"><-</span> copy _img <span id="L251" class="LineNr"> 251 </span> <span class="muComment"># yratio = height/img->height</span> <span id="L252" class="LineNr"> 252 </span> <span class="PreProc">var</span> img-height-a/eax: (addr int) <span class="Special"><-</span> get img, height @@ -357,7 +357,7 @@ if ('onhashchange' in window) { <span id="L292" class="LineNr"> 292 </span> compare idx, len <span id="L293" class="LineNr"> 293 </span> <span class="Delimiter">{</span> <span id="L294" class="LineNr"> 294 </span> <span class="PreProc">break-if-<</span> -<span id="L295" class="LineNr"> 295 </span> <a href='500fake-screen.mu.html#L267'>set-cursor-position</a> <span class="Constant">0</span>/screen, <span class="Constant">0x20</span>/x <span class="Constant">0x20</span>/y +<span id="L295" class="LineNr"> 295 </span> <a href='500fake-screen.mu.html#L269'>set-cursor-position</a> <span class="Constant">0</span>/screen, <span class="Constant">0x20</span>/x <span class="Constant">0x20</span>/y <span id="L296" class="LineNr"> 296 </span> <a href='501draw-text.mu.html#L449'>draw-int32-decimal-wrapping-right-then-down-from-cursor-over-full-screen</a> <span class="Constant">0</span>/screen, imgx, <span class="Constant">3</span>/fg <span class="Constant">0</span>/bg <span id="L297" class="LineNr"> 297 </span> <a href='501draw-text.mu.html#L449'>draw-int32-decimal-wrapping-right-then-down-from-cursor-over-full-screen</a> <span class="Constant">0</span>/screen, imgy, <span class="Constant">4</span>/fg <span class="Constant">0</span>/bg <span id="L298" class="LineNr"> 298 </span> <a href='501draw-text.mu.html#L449'>draw-int32-decimal-wrapping-right-then-down-from-cursor-over-full-screen</a> <span class="Constant">0</span>/screen, idx, <span class="Constant">5</span>/fg <span class="Constant">0</span>/bg @@ -369,7 +369,7 @@ if ('onhashchange' in window) { <span id="L304" class="LineNr"> 304 </span> screenx <span class="Special"><-</span> add xmin <span id="L305" class="LineNr"> 305 </span> <span class="PreProc">var</span> screeny/<span class="muRegEdx">edx</span>: int <span class="Special"><-</span> convert y <span id="L306" class="LineNr"> 306 </span> screeny <span class="Special"><-</span> add ymin -<span id="L307" class="LineNr"> 307 </span> <a href='500fake-screen.mu.html#L578'>pixel</a> <a href='500fake-screen.mu.html#L14'>screen</a>, screenx, screeny, color-int +<span id="L307" class="LineNr"> 307 </span> <a href='500fake-screen.mu.html#L580'>pixel</a> <a href='500fake-screen.mu.html#L16'>screen</a>, screenx, screeny, color-int <span id="L308" class="LineNr"> 308 </span> x <span class="Special"><-</span> add one-f <span id="L309" class="LineNr"> 309 </span> <span class="PreProc">loop</span> <span id="L310" class="LineNr"> 310 </span> <span class="Delimiter">}</span> @@ -802,7 +802,7 @@ if ('onhashchange' in window) { <span id="L737" class="LineNr"> 737 </span><span class="Delimiter">}</span> <span id="L738" class="LineNr"> 738 </span> <span id="L739" class="LineNr"> 739 </span><span class="muComment"># import a color ascii "pixmap" (each pixel consists of 3 shades of r/g/b from 0 to 255)</span> -<span id="L740" class="LineNr"> 740 </span><span class="PreProc">fn</span> <span class="muFunction"><a href='511image.mu.html#L740'>render-ppm-image</a></span> <a href='500fake-screen.mu.html#L14'>screen</a>: (addr <a href='500fake-screen.mu.html#L14'>screen</a>), _img: (addr <a href='511image.mu.html#L6'>image</a>), xmin: int, ymin: int, width: int, height: int <span class="Delimiter">{</span> +<span id="L740" class="LineNr"> 740 </span><span class="PreProc">fn</span> <span class="muFunction"><a href='511image.mu.html#L740'>render-ppm-image</a></span> <a href='500fake-screen.mu.html#L16'>screen</a>: (addr <a href='500fake-screen.mu.html#L16'>screen</a>), _img: (addr <a href='511image.mu.html#L6'>image</a>), xmin: int, ymin: int, width: int, height: int <span class="Delimiter">{</span> <span id="L741" class="LineNr"> 741 </span> <span class="PreProc">var</span> img/<span class="muRegEsi">esi</span>: (addr <a href='511image.mu.html#L6'>image</a>) <span class="Special"><-</span> copy _img <span id="L742" class="LineNr"> 742 </span> <span class="muComment"># yratio = height/img->height</span> <span id="L743" class="LineNr"> 743 </span> <span class="PreProc">var</span> img-height-a/eax: (addr int) <span class="Special"><-</span> get img, height @@ -854,7 +854,7 @@ if ('onhashchange' in window) { <span id="L789" class="LineNr"> 789 </span> compare idx, len <span id="L790" class="LineNr"> 790 </span> <span class="Delimiter">{</span> <span id="L791" class="LineNr"> 791 </span> <span class="PreProc">break-if-<</span> -<span id="L792" class="LineNr"> 792 </span> <a href='500fake-screen.mu.html#L267'>set-cursor-position</a> <span class="Constant">0</span>/screen, <span class="Constant">0x20</span>/x <span class="Constant">0x20</span>/y +<span id="L792" class="LineNr"> 792 </span> <a href='500fake-screen.mu.html#L269'>set-cursor-position</a> <span class="Constant">0</span>/screen, <span class="Constant">0x20</span>/x <span class="Constant">0x20</span>/y <span id="L793" class="LineNr"> 793 </span> <a href='501draw-text.mu.html#L449'>draw-int32-decimal-wrapping-right-then-down-from-cursor-over-full-screen</a> <span class="Constant">0</span>/screen, imgx, <span class="Constant">3</span>/fg <span class="Constant">0</span>/bg <span id="L794" class="LineNr"> 794 </span> <a href='501draw-text.mu.html#L449'>draw-int32-decimal-wrapping-right-then-down-from-cursor-over-full-screen</a> <span class="Constant">0</span>/screen, imgy, <span class="Constant">4</span>/fg <span class="Constant">0</span>/bg <span id="L795" class="LineNr"> 795 </span> <a href='501draw-text.mu.html#L449'>draw-int32-decimal-wrapping-right-then-down-from-cursor-over-full-screen</a> <span class="Constant">0</span>/screen, idx, <span class="Constant">5</span>/fg <span class="Constant">0</span>/bg @@ -889,7 +889,7 @@ if ('onhashchange' in window) { <span id="L824" class="LineNr"> 824 </span> screenx <span class="Special"><-</span> add xmin <span id="L825" class="LineNr"> 825 </span> <span class="PreProc">var</span> screeny/<span class="muRegEdx">edx</span>: int <span class="Special"><-</span> convert y <span id="L826" class="LineNr"> 826 </span> screeny <span class="Special"><-</span> add ymin -<span id="L827" class="LineNr"> 827 </span> <a href='500fake-screen.mu.html#L578'>pixel</a> <a href='500fake-screen.mu.html#L14'>screen</a>, screenx, screeny, color +<span id="L827" class="LineNr"> 827 </span> <a href='500fake-screen.mu.html#L580'>pixel</a> <a href='500fake-screen.mu.html#L16'>screen</a>, screenx, screeny, color <span id="L828" class="LineNr"> 828 </span> x <span class="Special"><-</span> add one-f <span id="L829" class="LineNr"> 829 </span> <span class="PreProc">loop</span> <span id="L830" class="LineNr"> 830 </span> <span class="Delimiter">}</span> @@ -1097,7 +1097,7 @@ if ('onhashchange' in window) { <span id="L1032" class="LineNr">1032 </span><span class="Delimiter">}</span> <span id="L1033" class="LineNr">1033 </span> <span id="L1034" class="LineNr">1034 </span><span class="muComment"># each byte in the image data is a color of the current palette</span> -<span id="L1035" class="LineNr">1035 </span><span class="PreProc">fn</span> <span class="muFunction"><a href='511image.mu.html#L1035'>render-raw-image</a></span> <a href='500fake-screen.mu.html#L14'>screen</a>: (addr <a href='500fake-screen.mu.html#L14'>screen</a>), _img: (addr <a href='511image.mu.html#L6'>image</a>), xmin: int, ymin: int, width: int, height: int <span class="Delimiter">{</span> +<span id="L1035" class="LineNr">1035 </span><span class="PreProc">fn</span> <span class="muFunction"><a href='511image.mu.html#L1035'>render-raw-image</a></span> <a href='500fake-screen.mu.html#L16'>screen</a>: (addr <a href='500fake-screen.mu.html#L16'>screen</a>), _img: (addr <a href='511image.mu.html#L6'>image</a>), xmin: int, ymin: int, width: int, height: int <span class="Delimiter">{</span> <span id="L1036" class="LineNr">1036 </span> <span class="PreProc">var</span> img/<span class="muRegEsi">esi</span>: (addr <a href='511image.mu.html#L6'>image</a>) <span class="Special"><-</span> copy _img <span id="L1037" class="LineNr">1037 </span> <span class="muComment"># yratio = height/img->height</span> <span id="L1038" class="LineNr">1038 </span> <span class="PreProc">var</span> img-height-a/eax: (addr int) <span class="Special"><-</span> get img, height @@ -1143,7 +1143,7 @@ if ('onhashchange' in window) { <span id="L1078" class="LineNr">1078 </span> compare idx, len <span id="L1079" class="LineNr">1079 </span> <span class="Delimiter">{</span> <span id="L1080" class="LineNr">1080 </span> <span class="PreProc">break-if-<</span> -<span id="L1081" class="LineNr">1081 </span> <a href='500fake-screen.mu.html#L267'>set-cursor-position</a> <span class="Constant">0</span>/screen, <span class="Constant">0x20</span>/x <span class="Constant">0x20</span>/y +<span id="L1081" class="LineNr">1081 </span> <a href='500fake-screen.mu.html#L269'>set-cursor-position</a> <span class="Constant">0</span>/screen, <span class="Constant">0x20</span>/x <span class="Constant">0x20</span>/y <span id="L1082" class="LineNr">1082 </span> <a href='501draw-text.mu.html#L449'>draw-int32-decimal-wrapping-right-then-down-from-cursor-over-full-screen</a> <span class="Constant">0</span>/screen, imgx, <span class="Constant">3</span>/fg <span class="Constant">0</span>/bg <span id="L1083" class="LineNr">1083 </span> <a href='501draw-text.mu.html#L449'>draw-int32-decimal-wrapping-right-then-down-from-cursor-over-full-screen</a> <span class="Constant">0</span>/screen, imgy, <span class="Constant">4</span>/fg <span class="Constant">0</span>/bg <span id="L1084" class="LineNr">1084 </span> <a href='501draw-text.mu.html#L449'>draw-int32-decimal-wrapping-right-then-down-from-cursor-over-full-screen</a> <span class="Constant">0</span>/screen, idx, <span class="Constant">5</span>/fg <span class="Constant">0</span>/bg @@ -1155,7 +1155,7 @@ if ('onhashchange' in window) { <span id="L1090" class="LineNr">1090 </span> screenx <span class="Special"><-</span> add xmin <span id="L1091" class="LineNr">1091 </span> <span class="PreProc">var</span> screeny/<span class="muRegEdx">edx</span>: int <span class="Special"><-</span> convert y <span id="L1092" class="LineNr">1092 </span> screeny <span class="Special"><-</span> add ymin -<span id="L1093" class="LineNr">1093 </span> <a href='500fake-screen.mu.html#L578'>pixel</a> <a href='500fake-screen.mu.html#L14'>screen</a>, screenx, screeny, color-int +<span id="L1093" class="LineNr">1093 </span> <a href='500fake-screen.mu.html#L580'>pixel</a> <a href='500fake-screen.mu.html#L16'>screen</a>, screenx, screeny, color-int <span id="L1094" class="LineNr">1094 </span> x <span class="Special"><-</span> add one-f <span id="L1095" class="LineNr">1095 </span> <span class="PreProc">loop</span> <span id="L1096" class="LineNr">1096 </span> <span class="Delimiter">}</span> |