lsnes/include/lua/bitmap.hpp

81 lines
2.6 KiB
C++
Raw Normal View History

2012-03-03 11:27:26 +02:00
#ifndef _lua__bitmap__hpp__included__
#define _lua__bitmap__hpp__included__
#include <vector>
#include <string>
#include <cstdint>
#include "core/window.hpp"
#include "library/lua-base.hpp"
2012-06-20 17:40:27 +03:00
#include "library/framebuffer.hpp"
#include "library/threadtypes.hpp"
2013-09-27 10:36:19 +03:00
#include "library/string.hpp"
2012-03-03 11:27:26 +02:00
struct lua_palette
{
std::vector<framebuffer::color> colors;
lua_palette(lua::state& L);
~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);
};
2012-03-03 11:27:26 +02:00
struct lua_bitmap
{
lua_bitmap(lua::state& L, uint32_t w, uint32_t h);
~lua_bitmap();
2012-03-03 11:27:26 +02:00
size_t width;
size_t height;
std::vector<uint16_t> pixels;
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);
template<bool scaled, bool porterduff> int blit(lua::state& L, const std::string& fname);
template<bool scaled> int blit_priority(lua::state& L, const std::string& fname);
2013-12-23 16:32:11 +02:00
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
{
lua_dbitmap(lua::state& L, uint32_t w, uint32_t h);
~lua_dbitmap();
2012-03-03 11:27:26 +02:00
size_t width;
size_t height;
std::vector<framebuffer::color> pixels;
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);
template<bool scaled, bool porterduff> int blit(lua::state& L, const std::string& fname);
2013-12-23 16:32:11 +02:00
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;
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