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

[SOLVED] Can't load background image

Started by Windows10User, 28 April 2018 - 06:05 PM
Windows10User #1
Posted 28 April 2018 - 08:05 PM
Background images (images as big as the terminal drawed at 1, 1) are also part of my GUI API, Graphics. The paintutils.drawImage() call doesn't seem to work, tho. It gives "graphics:232: bad argument #1 (expected table, got nil)".

Background image part of the API:

backgroundimg = {
   path = "",

   new = function(self)
	  local new = {}
	  setmetatable(new, {__index = self})
	  return new
   end,

   draw = function(self)
	  local image = paintutils.loadImage(self.path)
	  paintutils.drawImage(image, 1, 1) --line 232 AKA the error line
   end
}

Program used:

local fBCD = fs.open("Boot/bcd.ini", "r")
local bcd = textutils.unserialize(fBCD.readAll())
fBCD.close()

os.loadAPI("DoorOS/apis/graphics")

local splash = graphics.backgroundimg:new()
splash.path = "Boot/bootscreen.npf"
splash:draw()
read()
Edited on 01 May 2018 - 08:50 AM
Luca_S #2
Posted 28 April 2018 - 09:28 PM
At first glance I think this might be the same problem you had here
Windows10User #3
Posted 29 April 2018 - 09:43 AM
OK, I'll try with a more recent copy of CC 1.80.

EDIT: It doesn't do anything. Still the same error.

EDIT 2: Looks like I spelled the image's extension wrong. Sorry 4 wasting your time, everyone.
Edited on 29 April 2018 - 07:50 AM