dcearth/bmp.lua

29 lines
672 B
Lua

--Load and save the bmp formats used by DEFCON.
local t = {}
local love = assert( love )
local lfs = love.filesystem
--FFI bit-twiddling stuff.
local ffi = require 'ffi'
local bit = require 'bit'
function t.load( filename )
local imgd = love.image.newImageData( filename )
print( "LOADING BITMAP: ", filename, imgd:getSize(), imgd:getFormat(), imgd:getDimensions() )
local img = love.graphics.newImage( imgd )
img:setFilter( "nearest", "nearest" )
return img, imgd
end
function t.save( data, filename, format )
local w, h = data:getDimensions()
local str = ""
for x = 0, w - 1 do
for y = 0, h - 1 do
end
end
return str
end
return t