1j01 / textual-paint

:art: MS Paint in your terminal.
https://pypi.org/project/textual-paint/
MIT License
941 stars 12 forks source link

Increase vertical resolution with block pixels #2

Open dmadisetti opened 1 year ago

dmadisetti commented 1 year ago

Such an interesting project. Obvious do what you want, but using half blocks (▀) looks great in terminal (set fg and bg independently).

Example:

image

from https://github.com/arraypad/tui-image/issues/3

dmadisetti commented 1 year ago

Oh, quick look in the source and you are using blocks. Why is the pencil a full cursor position then?

1j01 commented 1 year ago

The reason is simple; I would need a sub-cell mouse position in order to make it work sensibly. It would be strange and I imagine frustrating to be able to directly target only half of the pixels of an image, even if you could affect them indirectly with line/fill/brush tools. Pixel level mouse precision may be possible, however, as pointed out in issue https://github.com/1j01/textual-paint/issues/1#issuecomment-1659432070 I don't know how many terminals support this, or how it works with terminal zooming (changing pixels per cell).

For now, anyway, it keeps the project simpler just to treat character cells as character cells, and embrace aspect ratios as part of the terminal aesthetic.

You can add half blocks from the character palette, by double clicking the current color area, or paste in any Unicode characters you want (with varied results across terminals):