Kartik K. Agaram
2777479a94
experiment: scaling pixels to 255 levels
...
This is strictly worse than before, both with barbara.pgm and more
subtly with t.pgm.
2021-07-13 05:19:00 -07:00
Kartik K. Agaram
23330d06c7
.
...
Undo commit 70a03be0d0
and reinline the helper extracted there.
I have a better sense now of the primitives to reuse between greyscale
and color dithering.
https://merveilles.town/@akkartik/106571585137582228
2021-07-12 22:53:27 -07:00
Kartik K. Agaram
a4f36d60ef
more precise error-diffusion
...
The Barbara test image has been looking right since commit 430dd67cb2
.
However, t.pgm has not. This doesn't fix it, but does seem like an
improvement.
The remaining error seems to be unrelated to rounding. Adding 8 more
bits of precision has no effect.
2021-07-12 00:59:36 -07:00
Kartik K. Agaram
4e5e887e01
.
2021-07-12 00:16:02 -07:00
Kartik K. Agaram
b646d24b06
.
2021-07-11 15:43:58 -07:00
Kartik K. Agaram
9c4a381770
.
2021-07-11 15:35:55 -07:00
Kartik K. Agaram
c76ac49f8f
forget HSL conversion for now, stick to RGB
...
It looks like seeking the nearest neighbor in HSL space leads to more
saturated colors.
2021-07-11 15:31:15 -07:00
Kartik K. Agaram
e8b8584796
.
...
Inline a helper.
2021-07-11 11:42:10 -07:00
Kartik K. Agaram
70a03be0d0
.
...
Extract a helper.
2021-07-11 09:25:24 -07:00
Kartik K. Agaram
7e21abe0c9
.
...
Inline an unnecessary block.
2021-07-11 09:18:47 -07:00
Kartik K. Agaram
5234ba60f5
.
2021-07-11 09:16:46 -07:00
Kartik K. Agaram
598fe88ebb
.
2021-07-11 03:47:15 -07:00
Kartik K. Agaram
430dd67cb2
dither 256-level greyscale to 8-level greyscale
2021-07-11 03:14:17 -07:00
Kartik K. Agaram
eb6cee6022
.
2021-07-10 21:15:51 -07:00
Kartik K. Agaram
e1dc0e8250
.
2021-07-10 20:37:21 -07:00
Kartik K. Agaram
a97a7cb8c4
.
2021-07-10 20:10:30 -07:00
Kartik K. Agaram
80023c3e54
.
2021-07-10 20:03:16 -07:00
Kartik K. Agaram
b28a31315e
increase precision for dithering computations
...
Now we get a perfect checkerboard pattern.
2021-07-10 19:56:32 -07:00
Kartik K. Agaram
3420f10f18
.
...
https://merveilles.town/@akkartik/106559551043772522
2021-07-10 19:47:32 -07:00
Kartik K. Agaram
e377991a9e
.
...
https://merveilles.town/@akkartik/106557664535993377
2021-07-10 11:18:47 -07:00
Kartik K. Agaram
5f8a8c11a2
dithering greyscale using black/white
...
Starting to look right.
2021-07-10 10:51:39 -07:00
Kartik K. Agaram
2a0f6cbb6f
reorder a few functions
2021-07-08 17:08:34 -07:00
Kartik K. Agaram
76f1fdc83e
.
2021-07-08 16:57:07 -07:00
Kartik K. Agaram
0539b961a0
scaling ppm images
2021-07-08 16:53:06 -07:00
Kartik K. Agaram
b8488c5223
scaling pgm images
2021-07-08 16:43:34 -07:00
Kartik K. Agaram
f07ebb9e5e
.
2021-07-08 16:33:49 -07:00
Kartik K. Agaram
b049cc1320
.
2021-07-08 16:23:48 -07:00
Kartik K. Agaram
13ef6b6202
.
2021-07-08 16:20:17 -07:00
Kartik K. Agaram
3ee70401e3
.
2021-07-08 16:12:27 -07:00
Kartik K. Agaram
019fb0babc
scaling pbm images
2021-07-08 11:00:51 -07:00
Kartik K. Agaram
b628bbd686
.
2021-07-08 09:26:55 -07:00
Kartik K. Agaram
afda7d59c0
better ppm colors
...
I had some logic to make hue distance cylindrical, but it wasn't right.
2021-07-08 01:13:38 -07:00
Kartik K. Agaram
0f29e61238
better greyscale
2021-07-08 00:26:58 -07:00
Kartik K. Agaram
9c70f7c643
.
2021-07-08 00:21:01 -07:00
Kartik K. Agaram
359f55d893
.
2021-07-08 00:13:12 -07:00
Kartik K. Agaram
d1482a9e89
ppm colors are weird, though
2021-07-08 00:12:31 -07:00
Kartik K. Agaram
91af9ccf2c
ppm support
...
Typo in commit fe3cbcd77: it only rendered pbm/pgm.
2021-07-07 19:43:56 -07:00
Kartik K. Agaram
d73c84e299
instructions for Universal Ctags
...
Thanks Sumeet Agarwal for raising this issue.
2021-07-07 19:34:54 -07:00
Kartik K. Agaram
d78a45340c
.
2021-07-07 19:24:12 -07:00
Kartik K. Agaram
fe3cbcd778
render ppm/pgm
...
Looks pretty bad compressing 256 shades of grey to 8.
2021-07-07 09:57:18 -07:00
Kartik K. Agaram
a9353ea327
load ppm/pgm/ppm on demand
2021-07-07 08:35:17 -07:00
Kartik K. Agaram
ef73cb78f1
initial image rendering
...
Supports just some ASCII formats: https://en.wikipedia.org/wiki/Netpbm
Colors are messed up. That's next.
2021-07-07 07:13:16 -07:00
Kartik K. Agaram
2d3fe4e940
.
2021-07-06 21:35:22 -07:00
Kartik K. Agaram
c31c02f0d1
.
2021-07-06 08:39:46 -07:00
Kartik K. Agaram
d84d17d6f5
nearest h/s/l color by a euclidean metric
2021-07-06 07:01:14 -07:00
Kartik K. Agaram
cbf22e7ab2
primitives for double-buffering
...
I thought I needed these for this bouncing-ball demo:
def (bounce screen)
with (w (width screen)
h (height screen)
cx 16
cy 16
dx 12
dy 19)
while 1
clear screen
ring screen cx cy 16 3 5
cx += dx
cy += dy
when (or (cx > w) (cx < 0))
set dx 0-dx
when (or (cy > h) (cy < 0))
set dy 0-dy
for _ 0 (< _ 100) ++_ # delay
No matter how I adjusted the delay I couldn't get rid of the jitter. So
I built a double-buffered version:
(bounce2 . [def (bounce2 screen)
with (w (width screen)
h (height screen)
cx 16
cy 16
dx 12
dy 19
screen2 (new_screen (columns screen)
(lines screen)))
while 1
clear screen2
ring screen2 cx cy 16 3 5
cx += dx
cy += dy
when (or (cx > w) (cx < 0))
set dx 0-dx
when (or (cy > h) (cy < 0))
set dy 0-dy
blit screen2 screen
for _ 0 (< _ 100) ++_]) # delay
But it didn't make a difference! Turns out nothing will help you when
successive frames are too far apart. This is the correct tweak to
`bounce`:
- dx 12
- dy 19)
+ dx 1
+ dy (/ 19 12))
Still, we'll keep double-buffering around for the future.
2021-07-05 23:18:30 -07:00
Kartik K. Agaram
468b0d979f
shell: fix clear on screens
...
Broken since commit c95648c96
on Jul 3.
Unclear what test to write for this. Should clear-stream check for NULL?
Should apply-clear?
2021-07-05 22:06:37 -07:00
Kartik K. Agaram
5d614af955
expose Mu implementation of 'bezier'
...
Still no support for acute-angled control points.
2021-07-05 18:31:07 -07:00
Kartik K. Agaram
493aabf79a
replace 'circle' with Mu implementation
2021-07-05 18:21:02 -07:00
Kartik K. Agaram
c7bedaf49b
replace 'vline' with Mu implementation
2021-07-05 18:12:07 -07:00