pxltrm
pxltrm copied to clipboard
Use half blocks to keep pixel ration squared
There is a trick to keep the pixel ratio squared. The idea is to split a rectangular char into 2 pixels. To do so, Unicode lower half blocks u'\u2584' is used to draw the bottom pixel and the background color to draw the top one (or vice versa).
It is used in these projects:
- pixterm (go) https://github.com/eliukblau/pixterm
- termpix (rust) https://github.com/hopey-dishwasher/termpix
- term-img (python) https://github.com/keithieopia/term-img
Pros
- Pixel squared
- Can still draw a blinky cursor
- Cool hacking solution 🐱💻
Cons
- Might loose mouse support since this require to get which one of the 2 pixels has been clicked
- Require Unicode 1.1.0 (June, 1993) support
I like the idea, I’ll work on this.
This will be difficult as we can't change the cursor shape, nor can we move the cursor in half blocks.
Yes it must be "faked" by drawing a blinky pixel. I was not sure if the idea could be implemented while keeping this project simple but I wanted to share the idea.
If you had the write characters for it (top half, bottom half blocks) could you do this by having one key for drawing the top half and a different key for drawing the bottom half?
If you had the right characters
Unicode has U+2580 UPPER HALF BLOCK ▀ (and U+2584 LOWER HALF BLOCK ▄, but we only need one)