2012-03-03 11:27:26 +02:00
|
|
|
#ifndef _lua__bitmap__hpp__included__
|
|
|
|
#define _lua__bitmap__hpp__included__
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
|
|
|
#include <cstdint>
|
2012-03-07 14:44:24 +02:00
|
|
|
#include "core/window.hpp"
|
2013-12-20 02:02:12 +02:00
|
|
|
#include "library/lua-base.hpp"
|
2012-06-20 17:40:27 +03:00
|
|
|
#include "library/framebuffer.hpp"
|
2013-01-21 09:24:46 +02:00
|
|
|
#include "library/threadtypes.hpp"
|
2013-09-27 10:36:19 +03:00
|
|
|
#include "library/string.hpp"
|
2012-03-03 11:27:26 +02:00
|
|
|
|
2013-10-28 21:15:08 +02:00
|
|
|
struct lua_palette
|
|
|
|
{
|
2013-12-19 06:57:22 +02:00
|
|
|
std::vector<framebuffer::color> colors;
|
2013-12-20 02:02:12 +02:00
|
|
|
lua_palette(lua::state& L);
|
2013-10-28 21:15:08 +02:00
|
|
|
~lua_palette();
|
|
|
|
mutex_class palette_mutex;
|
|
|
|
std::string print();
|
2013-12-23 16:32:11 +02:00
|
|
|
int set(lua::state& L, const std::string& fname);
|
|
|
|
int hash(lua::state& L, const std::string& fname);
|
|
|
|
int debug(lua::state& L, const std::string& fname);
|
|
|
|
int adjust_transparency(lua::state& L, const std::string& fname);
|
2013-10-28 21:15:08 +02:00
|
|
|
};
|
|
|
|
|
2012-03-03 11:27:26 +02:00
|
|
|
struct lua_bitmap
|
|
|
|
{
|
2013-12-20 02:02:12 +02:00
|
|
|
lua_bitmap(lua::state& L, uint32_t w, uint32_t h);
|
2013-02-28 04:03:01 +02:00
|
|
|
~lua_bitmap();
|
2012-03-03 11:27:26 +02:00
|
|
|
size_t width;
|
|
|
|
size_t height;
|
|
|
|
std::vector<uint16_t> pixels;
|
2013-10-28 21:15:08 +02:00
|
|
|
std::vector<char> save_png(const lua_palette& pal) const;
|
2013-09-27 10:36:19 +03:00
|
|
|
std::string print();
|
2013-12-23 16:32:11 +02:00
|
|
|
int draw(lua::state& L, const std::string& fname);
|
|
|
|
int _draw(lua::state& L, const std::string& fname, bool is_method);
|
|
|
|
int pset(lua::state& L, const std::string& fname);
|
|
|
|
int pget(lua::state& L, const std::string& fname);
|
|
|
|
int size(lua::state& L, const std::string& fname);
|
|
|
|
int hash(lua::state& L, const std::string& fname);
|
|
|
|
int blit(lua::state& L, const std::string& fname);
|
|
|
|
int save_png(lua::state& L, const std::string& fname);
|
|
|
|
int _save_png(lua::state& L, const std::string& fname, bool is_method);
|
2012-03-03 11:27:26 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct lua_dbitmap
|
|
|
|
{
|
2013-12-20 02:02:12 +02:00
|
|
|
lua_dbitmap(lua::state& L, uint32_t w, uint32_t h);
|
2013-02-28 04:03:01 +02:00
|
|
|
~lua_dbitmap();
|
2012-03-03 11:27:26 +02:00
|
|
|
size_t width;
|
|
|
|
size_t height;
|
2013-12-19 06:57:22 +02:00
|
|
|
std::vector<framebuffer::color> pixels;
|
2013-10-28 21:15:08 +02:00
|
|
|
std::vector<char> save_png() const;
|
2013-09-27 10:36:19 +03:00
|
|
|
std::string print();
|
2013-12-23 16:32:11 +02:00
|
|
|
int draw(lua::state& L, const std::string& fname);
|
|
|
|
int _draw(lua::state& L, const std::string& fname, bool is_method);
|
|
|
|
int pset(lua::state& L, const std::string& fname);
|
|
|
|
int pget(lua::state& L, const std::string& fname);
|
|
|
|
int size(lua::state& L, const std::string& fname);
|
|
|
|
int hash(lua::state& L, const std::string& fname);
|
|
|
|
int blit(lua::state& L, const std::string& fname);
|
|
|
|
int save_png(lua::state& L, const std::string& fname);
|
|
|
|
int adjust_transparency(lua::state& L, const std::string& fname);
|
|
|
|
int _save_png(lua::state& L, const std::string& fname, bool is_method);
|
2012-03-03 11:27:26 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct lua_loaded_bitmap
|
|
|
|
{
|
|
|
|
size_t w;
|
|
|
|
size_t h;
|
|
|
|
bool d;
|
|
|
|
std::vector<int64_t> bitmap;
|
|
|
|
std::vector<int64_t> palette;
|
2013-07-17 22:28:00 +03:00
|
|
|
static struct lua_loaded_bitmap load(std::istream& stream);
|
2012-03-03 11:27:26 +02:00
|
|
|
static struct lua_loaded_bitmap load(const std::string& name);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|