Any suggestions?
This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
Displaying images without a file?
Started by Fetchetch, 08 July 2015 - 10:36 PMPosted 09 July 2015 - 12:36 AM
So recently I started developing Project Arch (a os in one file) and was wondering how to achieve displaying a image from a table (what paintutils.loadImage("img") puts in a var/table). I had tried it in the past using good ol' [[ and ]] (and it didnt work xD) but still errors out when paintutils.drawImage() tries to draw.
Any suggestions?
Any suggestions?
Edited on 08 July 2015 - 10:37 PM
Posted 09 July 2015 - 01:06 AM
Load a paintutils image, then serialise the resulting table to a file. This'll show you the format you're after.
local myImage = paintutils.loadImage("someImage")
local myFile = fs.open("imageTableExample.txt", "w")
myFile.writeLine(textutils.serialize(myImage))
myFile.close()
Posted 09 July 2015 - 01:10 AM
Load a paintutils image, then serialise the resulting table to a file. This'll show you the format you're after.local myImage = paintutils.loadImage("someImage") local myFile = fs.open("imageTableExample.txt", "w") myFile.writeLine(textutils.serialize(myImage)) myFile.close()
Kinda what im looking for, but at the same time, not.
What I was looking for, was it to load a table,
(e.g:)
local img = [[22222
]]
(that makes: █████) //offtopic: If your wondering how i did it, use this █ and play with the colors and size.then put it into a code that paintutils can understand, then draw it to the screen.
Edited on 09 July 2015 - 12:37 AM
Posted 09 July 2015 - 08:40 AM
With the code Bomb Bloke provided you'd be able to simply copy-paste the table into your code and use paintutils.drawImage directly with it.
Posted 09 July 2015 - 10:04 AM
If you specifically want to format your data like that, then term.blit() may be of interest to you.
Posted 09 July 2015 - 06:10 PM
…
term.blit("t","b","b")
boot:42: Arguments must be the same lengthPosted 09 July 2015 - 06:54 PM
boot:42: Arguments must be the same lengthterm.blit("t","b","b")
That works for me (In CCEmuRedux)
Are you sure that's the 42nd line in 'boot'?
Posted 09 July 2015 - 07:02 PM
boot:42: Arguments must be the same lengthterm.blit("t","b","b")
That works for me (In CCEmuRedux)
Are you sure that's the 42nd line in 'boot'?
______________________^^ = my stupidity. Never noticed that.
Edited on 09 July 2015 - 05:04 PM