On Fri, Feb 24, 2012 at 07:19:33PM +0100, Adam D. Ruppe wrote:
> On Friday, 24 February 2012 at 17:54:47 UTC, H. S. Teoh wrote:
> >You could just pad the unused space with blank pixels.
>> whoa, make a tile based system, like the NES.
>> There's a private use area in unicode, 16 bits of space I think.
Heh, I was thinking of exactly the same thing, the unicode PUA. Great
minds think alike. :)
The PUA is actually 17 bits of space, U+F0000 -> U+10FFFF. There's also
a smaller stretch in the BMP, from U+E000 -> U+F8FF, which might be
useful if you want to stick with 16-bit characters.
> You could define a tile set to use that, or a simple bitmap format,
> but it isn't enough room to do on demand tiles I think.
>> Imagine this though, your terminal lets the app define new characters,
> in color. The protocol might be an escape sequence then you go ahead
> and write out an image using whatever format (xpm or base64 png -
> something you can easily enough represent as text.)
>> Then, you overwrite a private use character. You can then write
> that character to display the custom glyph.
>> Now, you treat it just like any other character for writing,
> scrolling, read back, etc. Mixes right in with text.
I like it. Reminds me of those old DOS games that used to do that,
except they have only 8 bits of space, so only trivial things could be
done. :)
> Now, you won't be able to just "cat image.png", but you could
> write a cat that does it. Define a tileset for a line, write
> it out, repeat and let it scroll to show the whole image.
[...]
But why constrict yourself needlessly? Unicode already has double-width
characters, like pretty much the entire CJK block. Some terminals/apps
already handle that (e.g. rxvt/vim on a CJK file).
Nothing stops you from assigning an entire bitmap to a private use
character. Call it multiwidth-multiheight. Now you have lots more room
in the character encoding for reusable bitmaps. :P
Or if multiheight is too messy to implement, at least multiwidth will
allow you to represent an entire bitmap row as a single PUA character.
So a large PNG will just be a linear sequence of PUA characters
representing rows in the image.
T
--
No! I'm not in denial!