cygx / p6-image-rgba-text

Superseded by https://github.com/cygx/p6-image-rgba
1 stars 2 forks source link

share a mapping/"palette" across images? #5

Open timo opened 5 years ago

timo commented 5 years ago

currently a =img directive will reset the mappings in a multi-image document. It is common to have shared palettes when doing pixel art, which Image::RGBA::Text is pretty good for.

I could imagine either a =gmap directive just like =map that adds mappings that will be re-applied for every new =img, or a =palette <name> <mappings...> that can be used even before the first =img, perhaps when there are no mappings it would apply the named palette to the current image, or perhaps =savepalette <name> and =usepalette <name> could be a thing?

cygx commented 5 years ago

Perhaps a tiny macro system could be added. This would allow reuse of palettes, meta- and even pixel-data in multiple images...

cygx commented 5 years ago

I'm working on a cleaned-up reimplementation at https://github.com/cygx/p6-image-rgba

The new codebase supports palettes, via =palette and =use, cf https://raw.githubusercontent.com/cygx/p6-image-rgba/master/examples/letters.txt

timo commented 5 years ago

oh, interesting!

btw Buf has a splice method, so you don't have to use nqp::splice in the new code either :)

And with the next release of rakudo, there'll be read-int* and write-int* methods with little and big endian and everything, they should be pretty performant, too!