[DEV] continue removing stl

This commit is contained in:
Edouard DUPIN 2017-08-28 00:03:21 +02:00
parent e790937d29
commit 55c71b8ed9
25 changed files with 101 additions and 101 deletions

View File

@ -9,12 +9,12 @@
#include <egami/ImagePrivate.hpp>
#include <ememory/memory.hpp>
std::ostream& egami::operator <<(std::ostream& _os, const egami::Image& _obj) {
etk::Stream& egami::operator <<(etk::Stream& _os, const egami::Image& _obj) {
_os << "egami::Image{" << _obj.getSize() << " on GPU: " << _obj.getGPUSize() << " color=" << _obj.getType();
return _os;
}
std::ostream& egami::operator <<(std::ostream& _os, const enum egami::colorType _type) {
etk::Stream& egami::operator <<(etk::Stream& _os, const enum egami::colorType _type) {
switch (_type) {
case egami::colorType::undefined:
_os << "egami::colorType::undefined";
@ -117,13 +117,13 @@ void egami::Image::configure(const ivec2& _size, enum colorType _type) {
break;
case egami::colorType::RGBA8:
//m_data = ememory::makeShared<egami::ImagePrivate>(new egami::ImageTemplate<etk::Color<uint8_t>>(_size));
m_data = ememory::makeShared<egami::ImageTemplate<etk::Color<uint8_t>>>(_size);
m_data = ememory::makeShared<egami::ImageTemplate<etk::Color<uint8_t, 4>>>(_size);
break;
case egami::colorType::RGB8:
m_data = ememory::makeShared<egami::ImageTemplate<etk::Color<uint8_t, 3>>>(_size);
break;
case egami::colorType::RGBAf:
m_data = ememory::makeShared<egami::ImageTemplate<etk::Color<float>>>(_size);
m_data = ememory::makeShared<egami::ImageTemplate<etk::Color<float, 4>>>(_size);
break;
case egami::colorType::RGBf:
m_data = ememory::makeShared<egami::ImageTemplate<etk::Color<float, 3>>>(_size);
@ -400,7 +400,7 @@ void egami::Image::set(const ivec2& _pos, const etk::Color<double, 1>& _newColor
m_data->set(_pos, _newColor);
}
void egami::Image::set(const std::vector<etk::Color<float,4>>& _data, const ivec2& _size) {
void egami::Image::set(const etk::Vector<etk::Color<float,4>>& _data, const ivec2& _size) {
if (m_data == nullptr) {
EGAMI_DEBUG("No internal data for image (nullptr)");
return;
@ -408,7 +408,7 @@ void egami::Image::set(const std::vector<etk::Color<float,4>>& _data, const ivec
m_data->set(_data, _size);
}
void egami::Image::set(const std::vector<etk::Color<uint8_t,4>>& _data, const ivec2& _size) {
void egami::Image::set(const etk::Vector<etk::Color<uint8_t,4>>& _data, const ivec2& _size) {
if (m_data == nullptr) {
EGAMI_DEBUG("No internal data for image (nullptr)");
return;

View File

@ -6,7 +6,7 @@
#pragma once
#include <etk/types.hpp>
#include <vector>
#include <etk/Vector.hpp>
#include <etk/math/Vector2D.hpp>
#include <etk/Color.hpp>
#include <etk/stdTools.hpp>
@ -25,7 +25,7 @@ namespace egami {
float32,
float64,
};
std::ostream& operator <<(std::ostream& _os, const enum egami::colorType _obj);
etk::Stream& operator <<(etk::Stream& _os, const enum egami::colorType _obj);
/**
* @brief Get the Color size use in octet
* @param[in] type of the color
@ -65,8 +65,8 @@ namespace egami {
virtual void set(const ivec2& _pos, const etk::Color<float, 1>& _newColor) = 0;
virtual void set(const ivec2& _pos, const etk::Color<double, 1>& _newColor) = 0;
virtual etk::Color<> get(const ivec2& _pos) const = 0;
virtual void set(const std::vector<etk::Color<float,4>>& _data, const ivec2& _size) = 0;
virtual void set(const std::vector<etk::Color<uint8_t,4>>& _data, const ivec2& _size) = 0;
virtual void set(const etk::Vector<etk::Color<float,4>>& _data, const ivec2& _size) = 0;
virtual void set(const etk::Vector<etk::Color<uint8_t,4>>& _data, const ivec2& _size) = 0;
};
class Image {
@ -141,9 +141,9 @@ namespace egami {
*/
void scale(const ivec2& _size);
void set(const std::vector<etk::Color<float,4>>& _data, const ivec2& _size);
void set(const std::vector<etk::Color<uint8_t,4>>& _data, const ivec2& _size);
void set(const etk::Vector<etk::Color<float,4>>& _data, const ivec2& _size);
void set(const etk::Vector<etk::Color<uint8_t,4>>& _data, const ivec2& _size);
};
std::ostream& operator <<(std::ostream& _os, const egami::Image& _obj);
etk::Stream& operator <<(etk::Stream& _os, const egami::Image& _obj);
}

View File

@ -9,13 +9,13 @@
#include <etk/math/Vector2D.hpp>
#include <etk/Color.hpp>
#include <vector>
#include <etk/Vector.hpp>
namespace egami {
class ImageMono {
private:
ivec2 m_size;
std::vector<uint8_t> m_data;
etk::Vector<uint8_t> m_data;
public:
// constructor :
ImageMono(const ivec2& _size=ivec2(32,32));

View File

@ -10,7 +10,7 @@
#include <etk/Color.hpp>
#include <egami/debug.hpp>
#include <vector>
#include <etk/Vector.hpp>
namespace egami {
@ -18,7 +18,7 @@ namespace egami {
class ImageTemplate : public ImagePrivate {
private:
ivec2 m_size;
std::vector<EGAMI_TYPE_COLOR> m_data;
etk::Vector<EGAMI_TYPE_COLOR> m_data;
public:
// constructor :
ImageTemplate(const ivec2& _size=ivec2(32,32)) :
@ -223,8 +223,8 @@ namespace egami {
// TODO : Add capabilities ...
int32_t stepX = m_size.x() / _size.x();
int32_t stepY = m_size.y() / _size.y();
stepX = std::max(1, stepX);
stepY = std::max(1, stepY);
stepX = etk::max(1, stepX);
stepY = etk::max(1, stepY);
EGAMI_VERBOSE("move : " << stepX << " , " << stepY << " from : " << m_size << " ==> " << _size);
for (int32_t yyy = 0; yyy < _size.y(); ++yyy) {
for (int32_t xxx = 0; xxx < _size.x(); ++xxx) {
@ -233,7 +233,7 @@ namespace egami {
}
resize(_size);
}
void set(const std::vector<etk::Color<float,4>>& _data, const ivec2& _size) {
void set(const etk::Vector<etk::Color<float,4>>& _data, const ivec2& _size) {
m_data.clear();
m_size = _size;
m_data.resize(_data.size());
@ -241,7 +241,7 @@ namespace egami {
m_data[iii] = _data[iii];
}
}
void set(const std::vector<etk::Color<uint8_t,4>>& _data, const ivec2& _size) {
void set(const etk::Vector<etk::Color<uint8_t,4>>& _data, const ivec2& _size) {
m_data.clear();
m_size = _size;
m_data.resize(_data.size());

View File

@ -27,15 +27,15 @@
#endif
#include <edtaa3/edtaa3func.h>
bool egami::scalable(const std::string& _fileName) {
bool egami::scalable(const etk::String& _fileName) {
if (true == etk::end_with(_fileName, ".svg") ) {
return true;
}
return false;
}
egami::Image egami::load(const std::string& _fileName, const ivec2& _size) {
std::string tmpName = etk::tolower(_fileName);
egami::Image egami::load(const etk::String& _fileName, const ivec2& _size) {
etk::String tmpName = etk::tolower(_fileName);
egami::Image out;
// select the corect Loader :
if (etk::end_with(tmpName, ".edf") == true) {
@ -101,7 +101,7 @@ egami::Image egami::load(const std::string& _fileName, const ivec2& _size) {
}
egami::Image egami::load(const std::string& _mineType, const std::vector<uint8_t>& _buffer, const ivec2& _size) {
egami::Image egami::load(const etk::String& _mineType, const etk::Vector<uint8_t>& _buffer, const ivec2& _size) {
egami::Image out;
// select the corect Loader :
if (_mineType == "image/bmp") {
@ -133,8 +133,8 @@ egami::Image egami::load(const std::string& _mineType, const std::vector<uint8_t
return out;
}
bool egami::store(const egami::Image& _input, const std::string& _fileName) {
std::string tmpName = etk::tolower(_fileName);
bool egami::store(const egami::Image& _input, const etk::String& _fileName) {
etk::String tmpName = etk::tolower(_fileName);
EGAMI_DEBUG("Store file : " << _fileName);
// select the corect Loader :
if (etk::end_with(tmpName, ".edf") == true) {
@ -173,13 +173,13 @@ bool egami::store(const egami::Image& _input, const std::string& _fileName) {
static void generateDistanceField(const egami::ImageMono& _input, egami::Image& _output) {
int32_t size = _input.getSize().x() * _input.getSize().y();
std::vector<short> xdist(size);
std::vector<short> ydist(size);
std::vector<double> gx(size);
std::vector<double> gy(size);
std::vector<double> data(size);
std::vector<double> outside(size);
std::vector<double> inside(size);
etk::Vector<short> xdist(size);
etk::Vector<short> ydist(size);
etk::Vector<double> gx(size);
etk::Vector<double> gy(size);
etk::Vector<double> data(size);
etk::Vector<double> outside(size);
etk::Vector<double> inside(size);
/*
// Convert img into double (data)
double img_min = 255, img_max = -255;
@ -253,7 +253,7 @@ static void generateDistanceField(const egami::ImageMono& _input, egami::Image&
}
bool egami::generateDistanceFieldFile(const std::string& _input, const std::string& _output) {
bool egami::generateDistanceFieldFile(const etk::String& _input, const etk::String& _output) {
egami::Image data;
if (etk::end_with(_input, ".edf") == true) {
return false;

View File

@ -6,7 +6,7 @@
#pragma once
#include <etk/types.hpp>
#include <vector>
#include <etk/Vector.hpp>
#include <etk/math/Vector2D.hpp>
#include <etk/Color.hpp>
#include <egami/Image.hpp>
@ -18,34 +18,34 @@ namespace egami {
* @param[in] _fileName Name of the file (SVG, BMP, PNG).
* @param[in] _size Dimention of the file when resizable (SVG).
*/
egami::Image load(const std::string& _fileName, const ivec2& _size=ivec2(-1,-1) );
egami::Image load(const etk::String& _fileName, const ivec2& _size=ivec2(-1,-1) );
/**
* @brief Load a specific ilage file in the requested image data.
* @param[in] _mineType mineType of the buffer.
* @param[in] _buffer memory file.
* @param[in] _size Dimention of the file when resizable (SVG).
*/
egami::Image load(const std::string& _mineType, const std::vector<uint8_t>& _buffer, const ivec2& _size=ivec2(-1,-1) );
egami::Image load(const etk::String& _mineType, const etk::Vector<uint8_t>& _buffer, const ivec2& _size=ivec2(-1,-1) );
/**
* @brief Save an image in a file.
* @param[in] _input Data of the image.
* @param[in] _fileName Name of the file.
* @return true if the file is corectly Stored, false otherwise
*/
bool store(const egami::Image& _input, const std::string& _fileName);
bool store(const egami::Image& _input, const etk::String& _fileName);
/**
* @brief Save an image in a memory buffer.
* @param[in] _input Data of the image.
* @param[out] _buffer Store file in this buffer.
* @return true if the file is corectly Stored, false otherwise
*/
bool store(const egami::Image& _input, std::vector<uint8_t>& _buffer);
bool store(const egami::Image& _input, etk::Vector<uint8_t>& _buffer);
/**
* @brief know if a file can have multiple size definition.
* @param[in] _fileName Name of the file.
* @return true if the format is scalable.
*/
bool scalable(const std::string& _fileName);
bool scalable(const etk::String& _fileName);
/**
* @brief Generate a distance field output file from an input file;
* @param[in] _input Input file name
@ -53,7 +53,7 @@ namespace egami {
* @return true All done corectly.
* @return false An error occured.
*/
bool generateDistanceFieldFile(const std::string& _input, const std::string& _output);
bool generateDistanceFieldFile(const etk::String& _input, const etk::String& _output);
}

View File

@ -106,7 +106,7 @@ static void display(struct bitmapFileHeader _header, struct bitmapInfoHeader _in
}*/
}
egami::Image egami::loadBMP(const std::string& _inputFile) {
egami::Image egami::loadBMP(const etk::String& _inputFile) {
etk::FSNode fileName(_inputFile);
if (fileName.exist() == false) {
EGAMI_ERROR("File does not existed='" << fileName << "'");
@ -116,12 +116,12 @@ egami::Image egami::loadBMP(const std::string& _inputFile) {
EGAMI_ERROR("Can not find the file name='" << fileName << "'");
return egami::Image();
}
std::vector<uint8_t> allData = fileName.fileReadAll<uint8_t>();
etk::Vector<uint8_t> allData = fileName.fileReadAll<uint8_t>();
fileName.fileClose();
return egami::loadBMP(allData);
}
egami::Image egami::loadBMP(const std::vector<uint8_t>& _buffer) {
egami::Image egami::loadBMP(const etk::Vector<uint8_t>& _buffer) {
egami::Image out;
enum modeBitmap m_dataMode = BITS_16_R5G6B5;
int32_t m_width = 0;
@ -297,7 +297,7 @@ egami::Image egami::loadBMP(const std::vector<uint8_t>& _buffer) {
return out;
}
bool egami::storeBMP(const std::string& _fileName, const egami::Image& _inputImage) {
bool egami::storeBMP(const etk::String& _fileName, const egami::Image& _inputImage) {
struct bitmapFileHeader m_FileHeader;
struct bitmapInfoHeaderExtended m_InfoHeader;
memset(&m_InfoHeader, 0, sizeof(bitmapInfoHeaderExtended));

View File

@ -13,20 +13,20 @@ namespace egami {
* @param[in] _fileName Name of the file.
* @return Generate image or empty image
*/
egami::Image loadBMP(const std::string& _fileName);
egami::Image loadBMP(const etk::String& _fileName);
/**
* @breif Load a bmp file in the image.
* @param[in] _buffer file buffer
* @return Generate image or empty image
*/
egami::Image loadBMP(const std::vector<uint8_t>& _buffer);
egami::Image loadBMP(const etk::Vector<uint8_t>& _buffer);
/**
* @breif Store a bmp file in the image.
* @param[in] _fileName Name of the file.
* @param[in] _inputImage write data.
* @return true if all is done correctly, false otherwise.
*/
bool storeBMP(const std::string& _fileName, const egami::Image& _inputImage);
bool storeBMP(const etk::String& _fileName, const egami::Image& _inputImage);
}

View File

@ -13,7 +13,7 @@
//EDF format is a simple format for image in text for distance field image (special case)
// it is composed of the fist line : description of type (starting with #EDF and some other information, the data start just after the first \n
egami::Image egami::loadEDF(const std::string& _inputFile) {
egami::Image egami::loadEDF(const etk::String& _inputFile) {
egami::Image out;
etk::FSNode file(_inputFile);
if (false == file.exist()) {
@ -24,7 +24,7 @@ egami::Image egami::loadEDF(const std::string& _inputFile) {
EGAMI_ERROR("Can not find the file name='" << file << "'");
return out;
}
std::string line;
etk::String line;
file.fileGets(line);
if (etk::start_with(line, "#edf", false) == false) {
EGAMI_ERROR("This file seams not to be a EDF file ...");
@ -83,17 +83,17 @@ egami::Image egami::loadEDF(const std::string& _inputFile) {
return out;
}
bool egami::storeEDF(const std::string& _fileName, const egami::Image& _inputImage) {
bool egami::storeEDF(const etk::String& _fileName, const egami::Image& _inputImage) {
bool anErrorEccured = false;
etk::FSNode file(_fileName);
if (file.fileOpenWrite() == false) {
EGAMI_ERROR("Can not find the file name=\"" << file << "\"");
return false;
}
anErrorEccured = file.filePuts( std::string("#EDF // Generate with EGAMI (")
+ etk::to_string(_inputImage.getSize().x())
anErrorEccured = file.filePuts( etk::String("#EDF // Generate with EGAMI (")
+ etk::toString(_inputImage.getSize().x())
+ ","
+ etk::to_string(_inputImage.getSize().y()) + ")\n");
+ etk::toString(_inputImage.getSize().y()) + ")\n");
char tmp[256];
for (int32_t yyy = 0; yyy < _inputImage.getSize().y(); ++yyy) {

View File

@ -22,13 +22,13 @@ namespace egami {
* @param[in] _fileName Name of the file.
* @return Read Image
*/
egami::Image loadEDF(const std::string& _fileName);
egami::Image loadEDF(const etk::String& _fileName);
/**
* @breif Store a edf file in the image.
* @param[in] _fileName Name of the file.
* @param[in] _inputImage write data.
* @return true if all is done correctly, false otherwise.
*/
bool storeEDF(const std::string& _fileName, const egami::Image& _inputImage);
bool storeEDF(const etk::String& _fileName, const egami::Image& _inputImage);
}

View File

@ -39,7 +39,7 @@ void put_scanline_someplace(const uint8_t* _buffer, int32_t _row_stride) {
}
egami::Image egami::loadJPG(const std::string& _inputFile) {
egami::Image egami::loadJPG(const etk::String& _inputFile) {
etk::FSNode fileName(_inputFile);
if (fileName.exist() == false) {
EGAMI_ERROR("File does not existed='" << fileName << "'");
@ -49,12 +49,12 @@ egami::Image egami::loadJPG(const std::string& _inputFile) {
EGAMI_ERROR("Can not find the file name='" << fileName << "'");
return egami::Image();
}
std::vector<uint8_t> allData = fileName.fileReadAll<uint8_t>();
etk::Vector<uint8_t> allData = fileName.fileReadAll<uint8_t>();
fileName.fileClose();
return egami::loadJPG(allData);
}
egami::Image egami::loadJPG(const std::vector<uint8_t>& _buffer) {
egami::Image egami::loadJPG(const etk::Vector<uint8_t>& _buffer) {
egami::Image out;
// This struct contains the JPEG decompression parameters and pointers to working space (which is allocated as needed by the JPEG library).
struct jpeg_decompress_struct cinfo;

View File

@ -13,12 +13,12 @@ namespace egami {
* @param[in] _fileName Name of the file.
* @return Read Image.
*/
egami::Image loadJPG(const std::string& _fileName);
egami::Image loadJPG(const etk::String& _fileName);
/**
* @breif Load a jpeg file in the image.
* @param[in] _buffer file Buffer
* @return Read Image.
*/
egami::Image loadJPG(const std::vector<uint8_t>& _buffer);
egami::Image loadJPG(const etk::Vector<uint8_t>& _buffer);
}

View File

@ -10,7 +10,7 @@
#include <egami/wrapperJPG2000.hpp>
#include <etk/os/FSNode.hpp>
egami::Image egami::loadJPG2000(const std::string& _inputFile) {
egami::Image egami::loadJPG2000(const etk::String& _inputFile) {
egami::Image out;
etk::FSNode fileName(_inputFile);
if (fileName.exist() == false) {

View File

@ -13,6 +13,6 @@ namespace egami {
* @param[in] _fileName Name of the file.
* @return Read Image.
*/
egami::Image loadJPG2000(const std::string& _fileName);
egami::Image loadJPG2000(const etk::String& _fileName);
}

View File

@ -32,10 +32,10 @@ namespace egami {
class ReaderInstanceBuffer : public egami::ReaderInstance {
private:
const std::vector<uint8_t>& m_data;
const etk::Vector<uint8_t>& m_data;
int32_t m_offset;
public:
ReaderInstanceBuffer(const std::vector<uint8_t>& _data, int32_t _offset):
ReaderInstanceBuffer(const etk::Vector<uint8_t>& _data, int32_t _offset):
m_data(_data),
m_offset(_offset) {
@ -247,7 +247,7 @@ static egami::Image genericLoader(png_structp _pngPtr, png_infop _infoPtr) {
}
egami::Image egami::loadPNG(const std::string& _inputFile) {
egami::Image egami::loadPNG(const etk::String& _inputFile) {
egami::Image out;
etk::FSNode fileName(_inputFile);
if (fileName.exist() == false) {
@ -312,7 +312,7 @@ egami::Image egami::loadPNG(const std::string& _inputFile) {
return out;
}
egami::Image egami::loadPNG(const std::vector<uint8_t>& _buffer) {
egami::Image egami::loadPNG(const etk::Vector<uint8_t>& _buffer) {
egami::Image out;
unsigned char header[8];
if (png_sig_cmp(&_buffer[0], 0, 8)) {

View File

@ -13,12 +13,12 @@ namespace egami {
* @param[in] _fileName Name of the file.
* @return Read Image.
*/
egami::Image loadPNG(const std::string& _fileName);
egami::Image loadPNG(const etk::String& _fileName);
/**
* @breif Load a png file in the image.
* @param[in] _buffer File buffer.
* @return Read Image.
*/
egami::Image loadPNG(const std::vector<uint8_t>& _buffer);
egami::Image loadPNG(const etk::Vector<uint8_t>& _buffer);
}

View File

@ -12,7 +12,7 @@
#include <esvg/esvg.hpp>
egami::Image egami::loadSVG(const std::string& _fileName, const ivec2& _size) {
egami::Image egami::loadSVG(const etk::String& _fileName, const ivec2& _size) {
egami::Image out;
esvg::Document svgDocument;
if (svgDocument.load(_fileName) == false) {
@ -21,11 +21,11 @@ egami::Image egami::loadSVG(const std::string& _fileName, const ivec2& _size) {
}
ivec2 imageSize = _size;
#if 0
std::vector<etk::Color<float,4>> svgImage = svgDocument.renderImageFloatRGBA(imageSize);
etk::Vector<etk::Color<float,4>> svgImage = svgDocument.renderImageFloatRGBA(imageSize);
out.configure(imageSize, egami::colorType::RGBAf);
out.set(svgImage, imageSize);
#else
std::vector<etk::Color<uint8_t,4>> svgImage = svgDocument.renderImageU8RGBA(imageSize);
etk::Vector<etk::Color<uint8_t,4>> svgImage = svgDocument.renderImageU8RGBA(imageSize);
out.configure(imageSize, egami::colorType::RGBA8);
out.set(svgImage, imageSize);
#endif

View File

@ -14,6 +14,6 @@ namespace egami {
* @param[in] _size size of the output image.
* @return Generated image
*/
egami::Image loadSVG(const std::string& _fileName, const ivec2& _size=ivec2(-1,-1));
egami::Image loadSVG(const etk::String& _fileName, const ivec2& _size=ivec2(-1,-1));
}

View File

@ -11,7 +11,7 @@
#include <etk/os/FSNode.hpp>
egami::Image egami::loadTIFF(const std::string& _inputFile) {
egami::Image egami::loadTIFF(const etk::String& _inputFile) {
egami::Image out;
etk::FSNode fileName(_inputFile);
if (fileName.exist() == false) {

View File

@ -13,6 +13,6 @@ namespace egami {
* @param[in] _fileName Name of the file.
* @return Read Image.
*/
egami::Image loadTIFF(const std::string& _fileName);
egami::Image loadTIFF(const etk::String& _fileName);
}

View File

@ -13,7 +13,7 @@ int main(int argc, const char *argv[]) {
// the only one init for etk:
etk::init(argc, argv);
for (int32_t iii=0; iii<argc ; ++iii) {
std::string data = argv[iii];
etk::String data = argv[iii];
if ( data == "-h"
|| data == "--help") {
TEST_PRINT("Help : ");

View File

@ -30,7 +30,7 @@ TEST(TestBMP, read_227x149) {
// check image correct type
EXPECT_EQ(egami::colorType::RGB8, image.getType());
// check integrity
std::string sha512 = algue::stringConvert(algue::sha512::encode((const uint8_t *)image.getTextureDataPointer(), egami::getFormatColorSize(image.getType()) * image.getSize().x() * image.getSize().y()));
etk::String sha512 = algue::stringConvert(algue::sha512::encode((const uint8_t *)image.getTextureDataPointer(), egami::getFormatColorSize(image.getType()) * image.getSize().x() * image.getSize().y()));
EXPECT_EQ("42dbad7abf1e651da58c9df06521d63a878b5bd0db6e1cbe129db3c9782ce640a6709583ba9e6571d314f39b259321dcc392f98bf4412deb5ce8392566d2bc0f", sha512);
}
@ -44,7 +44,7 @@ TEST(TestBMP, read_128x128) {
// check image correct type
EXPECT_EQ(egami::colorType::RGB8, image.getType());
// check integrity
std::string sha512 = algue::stringConvert(algue::sha512::encode((const uint8_t *)image.getTextureDataPointer(), egami::getFormatColorSize(image.getType()) * image.getSize().x() * image.getSize().y()));
etk::String sha512 = algue::stringConvert(algue::sha512::encode((const uint8_t *)image.getTextureDataPointer(), egami::getFormatColorSize(image.getType()) * image.getSize().x() * image.getSize().y()));
EXPECT_EQ("ad09f5e165b4acf576e95e27ccd5fcd4003bcdd66c74b3a543807e5fd85db7a6c11a3bbb811950ba19421b2a71815caa14ea9e6575669114766c3483dcc523f3", sha512);
}
@ -59,7 +59,7 @@ TEST(TestPNG, read_227x149) {
// check image correct type
EXPECT_EQ(egami::colorType::RGB8, image.getType());
// check integrity
std::string sha512 = algue::stringConvert(algue::sha512::encode((const uint8_t *)image.getTextureDataPointer(), egami::getFormatColorSize(image.getType()) * image.getSize().x() * image.getSize().y()));
etk::String sha512 = algue::stringConvert(algue::sha512::encode((const uint8_t *)image.getTextureDataPointer(), egami::getFormatColorSize(image.getType()) * image.getSize().x() * image.getSize().y()));
EXPECT_EQ("42dbad7abf1e651da58c9df06521d63a878b5bd0db6e1cbe129db3c9782ce640a6709583ba9e6571d314f39b259321dcc392f98bf4412deb5ce8392566d2bc0f", sha512);
}
@ -73,7 +73,7 @@ TEST(TestPNG, read_128x128) {
// check image correct type
EXPECT_EQ(egami::colorType::RGB8, image.getType());
// check integrity
std::string sha512 = algue::stringConvert(algue::sha512::encode((const uint8_t *)image.getTextureDataPointer(), egami::getFormatColorSize(image.getType()) * image.getSize().x() * image.getSize().y()));
etk::String sha512 = algue::stringConvert(algue::sha512::encode((const uint8_t *)image.getTextureDataPointer(), egami::getFormatColorSize(image.getType()) * image.getSize().x() * image.getSize().y()));
EXPECT_EQ("ad09f5e165b4acf576e95e27ccd5fcd4003bcdd66c74b3a543807e5fd85db7a6c11a3bbb811950ba19421b2a71815caa14ea9e6575669114766c3483dcc523f3", sha512);
}
@ -87,7 +87,7 @@ TEST(TestSVG, read) {
// check image correct type
EXPECT_EQ(egami::colorType::RGBA8, image.getType());
// check integrity
std::string sha512 = algue::stringConvert(algue::sha512::encode((const uint8_t *)image.getTextureDataPointer(), egami::getFormatColorSize(image.getType()) * image.getSize().x() * image.getSize().y()));
etk::String sha512 = algue::stringConvert(algue::sha512::encode((const uint8_t *)image.getTextureDataPointer(), egami::getFormatColorSize(image.getType()) * image.getSize().x() * image.getSize().y()));
EXPECT_EQ("7975d12caae94e67e85909f26b6dc0672d7e4686808d851b3207be6272b6d0153572cd643eea819c2f4dae9f7837165b4d5b34353da9f847d77afc2701945284", sha512);
}
@ -102,7 +102,7 @@ TEST(TestJPG, read_227x149) {
// check image correct type
EXPECT_EQ(egami::colorType::RGB8, image.getType());
// check integrity
std::string sha512 = algue::stringConvert(algue::sha512::encode((const uint8_t *)image.getTextureDataPointer(), egami::getFormatColorSize(image.getType()) * image.getSize().x() * image.getSize().y()));
etk::String sha512 = algue::stringConvert(algue::sha512::encode((const uint8_t *)image.getTextureDataPointer(), egami::getFormatColorSize(image.getType()) * image.getSize().x() * image.getSize().y()));
EXPECT_EQ("ac18fe31c86a18566199829bcea0ede3fc8bcac2c62fb5e8b04259719031605450cc53e3dce5fb197e7c3f13c484d015bdbef94f640b7da40f7c32c2d0f803b8", sha512);
}
@ -117,6 +117,6 @@ TEST(TestJPG, read_128x128) {
// check image correct type
EXPECT_EQ(egami::colorType::RGB8, image.getType());
// check integrity
std::string sha512 = algue::stringConvert(algue::sha512::encode((const uint8_t *)image.getTextureDataPointer(), egami::getFormatColorSize(image.getType()) * image.getSize().x() * image.getSize().y()));
etk::String sha512 = algue::stringConvert(algue::sha512::encode((const uint8_t *)image.getTextureDataPointer(), egami::getFormatColorSize(image.getType()) * image.getSize().x() * image.getSize().y()));
EXPECT_EQ("dd521e6b75239ee2492c9b3ae81ef1a5061c5d05588ec04a98db65cc210ec4496ca4bb4c18aa45c591a7283e3ce82c8ec4d2554f36a0ed119918a4be89f2e3e0", sha512);
}

View File

@ -21,7 +21,7 @@ appl::MainWindows::MainWindows() :
void appl::MainWindows::init() {
ewol::widget::Windows::init();
m_image = ewol::widget::Image::create("src", std::string("DATA:icon.png"),
m_image = ewol::widget::Image::create("src", etk::String("DATA:icon.png"),
"expand", bvec2(true,true),
"fill", bvec2(true,true));
propertyTitle.set("EVI");
@ -32,7 +32,7 @@ void appl::MainWindows::init() {
signalShortcut.connect(sharedFromThis(), &appl::MainWindows::onCallbackShortCut);
}
void appl::MainWindows::onCallbackShortCut(const std::string& _value) {
void appl::MainWindows::onCallbackShortCut(const etk::String& _value) {
APPL_WARNING("Event from ShortCut : " << _value);
if (_value == "menu:reloade-shader") {
ewol::getContext().getResourcesManager().reLoadResources();
@ -42,7 +42,7 @@ void appl::MainWindows::onCallbackShortCut(const std::string& _value) {
}
}
void appl::MainWindows::setListOfFiles(std::vector<std::string> _listImages) {
void appl::MainWindows::setListOfFiles(etk::Vector<etk::String> _listImages) {
m_listImages = _listImages;
if (m_listImages.size() == 0) {
m_idDisplayed = -1;
@ -74,7 +74,7 @@ bool appl::MainWindows::onEventEntry(const ewol::event::Entry& _event) {
return true;
}
m_image->propertySource.set(m_listImages[m_idDisplayed]);
propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::to_string(m_idDisplayed+1) + "/" + etk::to_string(m_listImages.size()));
propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::toString(m_idDisplayed+1) + "/" + etk::to_string(m_listImages.size()));
return true;
}
if (_event.getType() == gale::key::keyboard::left) {
@ -84,7 +84,7 @@ bool appl::MainWindows::onEventEntry(const ewol::event::Entry& _event) {
return true;
}
m_image->propertySource.set(m_listImages[m_idDisplayed]);
propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::to_string(m_idDisplayed+1) + "/" + etk::to_string(m_listImages.size()));
propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::toString(m_idDisplayed+1) + "/" + etk::to_string(m_listImages.size()));
return true;
}
if (_event.getType() == gale::key::keyboard::down) {
@ -93,7 +93,7 @@ bool appl::MainWindows::onEventEntry(const ewol::event::Entry& _event) {
m_idDisplayed = m_listImages.size()-1;
}
m_image->propertySource.set(m_listImages[m_idDisplayed]);
propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::to_string(m_idDisplayed+1) + "/" + etk::to_string(m_listImages.size()));
propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::toString(m_idDisplayed+1) + "/" + etk::to_string(m_listImages.size()));
return true;
}
if (_event.getType() == gale::key::keyboard::up) {
@ -102,19 +102,19 @@ bool appl::MainWindows::onEventEntry(const ewol::event::Entry& _event) {
m_idDisplayed = 0;
}
m_image->propertySource.set(m_listImages[m_idDisplayed]);
propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::to_string(m_idDisplayed+1) + "/" + etk::to_string(m_listImages.size()));
propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::toString(m_idDisplayed+1) + "/" + etk::to_string(m_listImages.size()));
return true;
}
if (_event.getType() == gale::key::keyboard::pageDown) {
m_idDisplayed = m_listImages.size()-1;
m_image->propertySource.set(m_listImages[m_idDisplayed]);
propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::to_string(m_idDisplayed+1) + "/" + etk::to_string(m_listImages.size()));
propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::toString(m_idDisplayed+1) + "/" + etk::to_string(m_listImages.size()));
return true;
}
if (_event.getType() == gale::key::keyboard::pageUp) {
m_idDisplayed = 0;
m_image->propertySource.set(m_listImages[m_idDisplayed]);
propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::to_string(m_idDisplayed+1) + "/" + etk::to_string(m_listImages.size()));
propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::toString(m_idDisplayed+1) + "/" + etk::to_string(m_listImages.size()));
return true;
}
}

View File

@ -13,7 +13,7 @@ namespace appl {
class MainWindows : public ewol::widget::Windows {
private:
ewol::widget::ImageShared m_image;
std::vector<std::string> m_listImages;
etk::Vector<etk::String> m_listImages;
int64_t m_idDisplayed;
public:
// Constructeur
@ -22,9 +22,9 @@ namespace appl {
public:
DECLARE_FACTORY(MainWindows);
~MainWindows() {};
void setListOfFiles(std::vector<std::string> _listImages);
void setListOfFiles(etk::Vector<etk::String> _listImages);
protected:
void onCallbackShortCut(const std::string& _value);
void onCallbackShortCut(const etk::String& _value);
bool onEventInput(const ewol::event::Input& _event) override;
bool onEventEntry(const ewol::event::Entry& _event) override;
};

View File

@ -17,12 +17,12 @@
class MainApplication : public ewol::context::Application {
private:
std::vector<std::string> m_listFiles;
etk::Vector<etk::String> m_listFiles;
public:
virtual void onCreate(ewol::Context& _context) {
APPL_INFO(" == > CREATE ... (START) [" << gale::getBoardType() << "] (" << gale::getCompilationMode() << ") (BEGIN)");
for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) {
std::string tmpppp = _context.getCmd().get(iii);
etk::String tmpppp = _context.getCmd().get(iii);
if ( tmpppp == "-h"
|| tmpppp == "--help") {
APPL_INFO(" -t c-flags-file-name" );
@ -40,14 +40,14 @@ class MainApplication : public ewol::context::Application {
} else {
etk::FSNode elem(tmpppp);
if (elem.getNodeType() == etk::typeNode_folder) {
std::vector<std::string> tmp = elem.folderGetSub(false, true, ".*");
etk::Vector<etk::String> tmp = elem.folderGetSub(false, true, ".*");
std::sort(tmp.begin(), tmp.end());
for (auto &it : tmp) {
m_listFiles.push_back(it);
m_listFiles.pushBack(it);
}
} else {
// simple file:
m_listFiles.push_back(tmpppp);
m_listFiles.pushBack(tmpppp);
}
}
}