Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --this program is used to draw Images from given files to the given cords
- --X, Y, File
- term.clear()
- local tArg = {...}
- local X = tArg[1]
- local Y = tArg[2]
- local TargetFile = tArg[3]
- local i = 2
- local Dimensions = {0,0}
- local Colors = {colors.white,colors.gray,colors.black,colors.green,colors.blue,colors.purple,colors.red,colors.orange,colors.yellow}
- local x = 1
- local y = 1
- local h = fs.open(TargetFile,"r")
- local DimensionLine = h.readLine(1)
- Dimensions[1] = string.sub(DimensionLine,1,1)
- Dimensions[2] = string.sub(DimensionLine,3,3)
- Dimensions[1] = tonumber(Dimensions[1])
- Dimensions[2] = tonumber(Dimensions[2])
- local PixLines = h.readLine(2)
- for i = 1, (Dimensions[1] * Dimensions[2]) do
- local Pix = string.sub(PixLines,x,x)
- paintutils.drawPixel(((X-1)+x),((Y-1)+y),Colors[tonumber(Pix)])
- if x < Dimensions[1] then
- x = x + 1
- else
- x = 1
- y = y + 1
- PixLines = h.readLine(y+1)
- end
- end
- h.close()
Add Comment
Please, Sign In to add comment