This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
HDeffo's profile picture

paintcan image API [early release]

Started by HDeffo, 13 February 2016 - 09:19 PM
HDeffo #1
Posted 13 February 2016 - 10:19 PM
I am still currently working on the actual paint program which will support this format as well as some additional improvements to the format itself but until then here is an early release so i can start getting some helpful criticism on it.

pastebin get Xk9DWpx9

paintcan images are somewhat compressed and contain text, foreground color, and background color.


os.loadAPI("paintcan") --#used to load the API

paintcan.encode(text,foreground,background,file)
--#the first three arguments are the same as using term.blit but accept multi line strings \n, the fourth argument determines what file the image is saved in

paintcan.decode(file) --#loads image file and returns text,foreground,background

paintcan.draw(x,y,text,foreground,background)--#draws a decoded can image at the coordinates x,y

unlike my other APIs because this is currently in early development for another program I am working on, If you wish to use this code in a program of your own you must ask permission first. I will more than likely grant it but I want to keep track of who is currently using it in case i make any major changes
Edited on 13 February 2016 - 09:20 PM
Bomb Bloke #2
Posted 14 February 2016 - 07:29 AM
You might find this thread worth a read - basically it's RLE (what you're using), but coupled with Huffman for better compression.

It's filed in oeed's CraftOS Standards thingy as a proposal. Personally I'm of the view that any attempts to get any CC coders to follow any "standards" other than their own is futile, but if there's any chance of success at all, odds are it'll be through that.
Lupus590 #3
Posted 14 February 2016 - 02:56 PM
Personally I'm of the view that any attempts to get any CC coders to follow any "standards" other than their own is futile…

For some reason this made my day.
Edited on 14 February 2016 - 01:57 PM