2014-05-02 06:30:32 +00:00
|
|
|
#include "stdafx.h"
|
2014-09-07 07:49:25 +00:00
|
|
|
#include "restore_new.h"
|
2015-10-17 17:47:18 +00:00
|
|
|
#include "Utilities/Log.h"
|
2015-04-23 16:58:37 +00:00
|
|
|
#pragma warning(push)
|
|
|
|
#pragma message("TODO: remove wx dependency: <wx/image.h>")
|
2015-01-25 16:23:24 +00:00
|
|
|
#pragma warning(disable : 4996)
|
2014-08-28 22:49:26 +00:00
|
|
|
#include <wx/image.h>
|
2015-04-23 16:58:37 +00:00
|
|
|
#pragma warning(pop)
|
2014-09-07 07:49:25 +00:00
|
|
|
#include "define_new_memleakdetect.h"
|
2014-05-02 06:30:32 +00:00
|
|
|
|
2014-07-10 19:45:07 +00:00
|
|
|
#ifndef _WIN32
|
|
|
|
#include <dirent.h>
|
2015-11-08 11:42:41 +00:00
|
|
|
#include <errno.h>
|
2014-07-10 19:45:07 +00:00
|
|
|
#endif
|
|
|
|
|
2014-08-24 17:42:19 +00:00
|
|
|
#include "rPlatform.h"
|
2014-05-02 06:30:32 +00:00
|
|
|
|
|
|
|
rImage::rImage()
|
|
|
|
{
|
|
|
|
handle = static_cast<void*>(new wxImage());
|
|
|
|
}
|
|
|
|
|
|
|
|
rImage::~rImage()
|
|
|
|
{
|
|
|
|
delete static_cast<wxImage*>(handle);
|
|
|
|
}
|
|
|
|
|
|
|
|
void rImage::Create(int width, int height, void *data, void *alpha)
|
|
|
|
{
|
|
|
|
static_cast<wxImage*>(handle)->Create(width, height, static_cast<unsigned char*>(data), static_cast<unsigned char*>(alpha));
|
|
|
|
}
|
|
|
|
void rImage::SaveFile(const std::string& name, rImageType type)
|
|
|
|
{
|
|
|
|
if (type == rBITMAP_TYPE_PNG)
|
|
|
|
{
|
|
|
|
static_cast<wxImage*>(handle)->SaveFile(fmt::FromUTF8(name),wxBITMAP_TYPE_PNG);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-07-02 01:54:36 +00:00
|
|
|
throw EXCEPTION("unsupported type");
|
2014-05-02 06:30:32 +00:00
|
|
|
}
|
|
|
|
}
|