dcearth/bmp.lua

29 lines
672 B
Lua
Raw Normal View History

2023-04-28 17:35:52 +00:00
--Load and save the bmp formats used by DEFCON.
local t = {}
2023-07-28 23:23:08 +00:00
local love = assert( love )
local lfs = love.filesystem
2023-04-28 17:35:52 +00:00
--FFI bit-twiddling stuff.
local ffi = require 'ffi'
local bit = require 'bit'
2023-04-28 17:35:52 +00:00
function t.load( filename )
2023-07-28 23:23:08 +00:00
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
2024-04-28 01:38:23 +00:00
function t.save( data, filename, format )
2024-04-21 14:10:53 +00:00
local w, h = data:getDimensions()
2024-04-28 01:38:23 +00:00
local str = ""
for x = 0, w - 1 do
for y = 0, h - 1 do
end
end
return str
end
return t