Type
ImageData
Raw (decoded) image data. You can't draw ImageData directly to screen. See Image for that.
See Also
Image  
Examples
Images that have dimensions that are not a 2^n will display incorrectly as a white rectangle on some graphics chipsets. This function pads images so they will display correctly.
  1. function newPaddedImage(filename)
  2.     local source = love.image.newImageData(filename)
  3.     local w, h = source:getWidth(), source:getHeight()
  4.    
  5.     -- Find closest power-of-two.
  6.     local wp = math.pow(2, math.ceil(math.log(w)/math.log(2)))
  7.     local hp = math.pow(2, math.ceil(math.log(h)/math.log(2)))
  8.    
  9.     -- Only pad if needed:
  10.     if wp ~= w or hp ~= h then
  11.         local padded = love.image.newImageData(wp, hp)
  12.         padded:paste(source, 0, 0)
  13.         return love.graphics.newImage(padded)
  14.     end
  15.    
  16.     return love.graphics.newImage(source)
  17. end
Copyright © 2006-2010 LÖVE Development Team.