working version for linux with usable scripting

This commit is contained in:
Hartmut Seichter 2019-01-16 15:40:37 +01:00
parent 28905d301e
commit 9d0c60c5f4
401 changed files with 90281 additions and 11 deletions

View file

@ -17,6 +17,8 @@ target_include_directories(
pwio
PUBLIC
include
PRIVATE
${CMAKE_SOURCE_DIR}/src/deps/stb
)
target_link_libraries(pwio pwcore)

View file

@ -35,6 +35,8 @@ public:
image read(std::string const& uri,uint32_t flags = 0);
bool write(const std::string& uri,uint32_t flags = 0);
protected:
struct impl;

View file

@ -1,11 +1,31 @@
#include "pw/io/image_io.hpp"
#include "stb_image.h"
#include "stb_image_write.h"
namespace pw {
struct image_io::impl
{
image read_impl(const std::string& uri,uint32_t flags)
{
int x,y,n;
unsigned char *data = stbi_load(uri.c_str(), &x, &y, &n, 4);
if (data) {
image r;
r.create(sizei(x,y),image::pixel_layout::RGBA8,data);
return r;
}
return image();
}
};
@ -15,4 +35,9 @@ image_io &image_io::get()
return instance;
}
image image_io::read(const std::string &uri, uint32_t flags)
{
return _impl->read_impl(uri,flags);
}
}