Compare commits

..

1 Commits

Author SHA1 Message Date
4e50a21fa5 [DEV] add egami-cutter 2018-11-08 07:40:19 +01:00
27 changed files with 272 additions and 256 deletions

View File

@ -27,76 +27,75 @@
#endif
#include <edtaa3/edtaa3func.h>
bool egami::scalable(const etk::Uri& _uri) {
if (etk::toLower(_uri.getPath().getExtention()) == "svg") {
bool egami::scalable(const etk::String& _fileName) {
if (true == etk::end_with(_fileName, ".svg") ) {
return true;
}
return false;
}
egami::Image egami::load(const etk::Uri& _uri, const ivec2& _size) {
etk::String extention = etk::toLower(_uri.getPath().getExtention());
egami::Image egami::load(const etk::String& _fileName, const ivec2& _size) {
etk::String tmpName = etk::toLower(_fileName);
egami::Image out;
// select the corect Loader :
EGAMI_ERROR("parse file '" << _uri << "' extention=" << extention);
if (extention == "edf") {
if (etk::end_with(tmpName, ".edf") == true) {
// internal format for ewol distance field ==> simple sistance field image
out = egami::loadEDF(_uri);
out = egami::loadEDF(_fileName);
if (out.exist() == false) {
EGAMI_ERROR("Error to load EDF file '" << _uri << "'");
EGAMI_ERROR("Error to load EDF file '" << _fileName << "'");
}
} else if (extention == "bmp") {
out = egami::loadBMP(_uri);
} else if (etk::end_with(tmpName, ".bmp") == true) {
out = egami::loadBMP(_fileName);
if (out.exist() == false) {
EGAMI_ERROR("Error to load BMP file '" << _uri << "'");
EGAMI_ERROR("Error to load BMP file '" << _fileName << "'");
}
} else if (extention == "svg") {
} else if (etk::end_with(tmpName, ".svg") == true) {
#ifdef EGAMI_BUILD_ESVG
out = egami::loadSVG(_uri, _size);
out = egami::loadSVG(_fileName, _size);
if (out.exist() == false) {
EGAMI_ERROR("Error to load SVG file '" << _uri << "'");
EGAMI_ERROR("Error to load SVG file '" << _fileName << "'");
}
#else
EGAMI_WARNING("egami not compile with the ESVG dependency for file '" << _uri << "'");
EGAMI_WARNING("egami not compile with the ESVG dependency for file '" << _fileName << "'");
#endif
} else if (extention == "png") {
} else if (etk::end_with(tmpName, ".png") == true) {
#ifdef EGAMI_BUILD_PNG
out = egami::loadPNG(_uri);
out = egami::loadPNG(_fileName);
if (out.exist() == false) {
EGAMI_ERROR("Error to load PNG file '" << _uri << "'");
EGAMI_ERROR("Error to load PNG file '" << _fileName << "'");
}
#else
EGAMI_WARNING("egami not compile with the PNG dependency for file '" << _uri << "'");
EGAMI_WARNING("egami not compile with the PNG dependency for file '" << _fileName << "'");
#endif
} else if (extention == "jpg") {
} else if (etk::end_with(tmpName, ".jpg") == true) {
#ifdef EGAMI_BUILD_JPEG
out = egami::loadJPG(_uri);
out = egami::loadJPG(_fileName);
if (out.exist() == false) {
EGAMI_ERROR("Error to load JPG file '" << _uri << "'");
EGAMI_ERROR("Error to load JPG file '" << _fileName << "'");
}
#else
EGAMI_WARNING("egami not compile with the JPEG dependency for file '" << _uri << "'");
EGAMI_WARNING("egami not compile with the JPEG dependency for file '" << _fileName << "'");
#endif
} else if (extention == "j2k") {
} else if (etk::end_with(tmpName, ".j2k") == true) {
#ifdef EGAMI_BUILD_JPEG2000
out = egami::loadJPG2000(_uri);
out = egami::loadJPG2000(_fileName);
if (out.exist() == false) {
EGAMI_ERROR("Error to load JPEG2000 file '" << _uri << "'");
EGAMI_ERROR("Error to load JPEG2000 file '" << _fileName << "'");
}
#else
EGAMI_WARNING("egami not compile with the JPEG 2000 (openjpeg) dependency for file '" << _uri << "'");
EGAMI_WARNING("egami not compile with the JPEG 2000 (openjpeg) dependency for file '" << _fileName << "'");
#endif
} else if (extention == "tif") {
} else if (etk::end_with(tmpName, ".tif") == true) {
#ifdef EGAMI_BUILD_TIFF
out = egami::loadTIFF(_uri);
out = egami::loadTIFF(_fileName);
if (out.exist() == false) {
EGAMI_ERROR("Error to load TIFF file '" << _uri << "'");
EGAMI_ERROR("Error to load TIFF file '" << _fileName << "'");
}
#else
EGAMI_WARNING("egami not compile with the TIFF dependency for file '" << _uri << "'");
EGAMI_WARNING("egami not compile with the TIFF dependency for file '" << _fileName << "'");
#endif
} else {
EGAMI_ERROR("Extention not managed '" << _uri << "' Sopported extention : .edf / .bmp / .svg / .png / .jpg / .j2k / .tif");
EGAMI_ERROR("Extention not managed '" << _fileName << "' Sopported extention : .edf / .bmp / .svg / .png / .jpg / .j2k / .tif");
}
return out;
}
@ -134,51 +133,51 @@ egami::Image egami::load(const etk::String& _mineType, const etk::Vector<uint8_t
return out;
}
bool egami::store(const egami::Image& _input, const etk::Uri& _uri) {
etk::String extention = etk::toLower(_uri.getPath().getExtention());
EGAMI_DEBUG("Store file : " << _uri);
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 (extention == "edf") {
if (egami::storeEDF(_uri, _input) == false) {
EGAMI_ERROR("Error to store EDF file '" << _uri << "'");
if (etk::end_with(tmpName, ".edf") == true) {
if (egami::storeEDF(_fileName, _input) == false) {
EGAMI_ERROR("Error to store EDF file '" << _fileName << "'");
return false;
}
} else if (extention == "bmp") {
if (egami::storeBMP(_uri, _input) == false) {
EGAMI_ERROR("Error to store BMP file '" << _uri << "'");
} else if (etk::end_with(tmpName, ".bmp") == true) {
if (egami::storeBMP(_fileName, _input) == false) {
EGAMI_ERROR("Error to store BMP file '" << _fileName << "'");
return false;
}
} else if (extention == "svg") {
EGAMI_ERROR("Can not store in SVG file '" << _uri << "'");
} else if (etk::end_with(tmpName, ".svg") == true) {
EGAMI_ERROR("Can not store in SVG file '" << _fileName << "'");
return false;
} else if (extention == "png") {
} else if (etk::end_with(tmpName, ".png") == true) {
#ifdef EGAMI_BUILD_PNG
if (egami::storePNG(_uri, _input) == false) {
EGAMI_ERROR("Error to store PNG file '" << _uri << "'");
if (egami::storePNG(_fileName, _input) == false) {
EGAMI_ERROR("Error to store PNG file '" << _fileName << "'");
return false;
}
#else
EGAMI_WARNING("egami not compile with the PNG dependency for file '" << _uri << "'");
EGAMI_WARNING("egami not compile with the PNG dependency for file '" << _fileName << "'");
return false;
#endif
} else if (extention == "jpg") {
} else if (etk::end_with(tmpName, ".jpg") == true) {
#ifdef EGAMI_BUILD_JPEG
if (egami::storeJPG(_uri, _input) == false) {
EGAMI_ERROR("Error to store JPEG file '" << _uri << "'");
if (egami::storeJPG(_fileName, _input) == false) {
EGAMI_ERROR("Error to store JPEG file '" << _fileName << "'");
return false;
}
#else
EGAMI_WARNING("egami not compile with the JPEG dependency for file '" << _uri << "'");
EGAMI_WARNING("egami not compile with the JPEG dependency for file '" << _fileName << "'");
return false;
#endif
} else if (extention == "j2k") {
EGAMI_ERROR("Can not store in JPEG 2000 file '" << _uri << "'");
} else if (etk::end_with(tmpName, ".j2k") == true) {
EGAMI_ERROR("Can not store in JPEG 2000 file '" << _fileName << "'");
return false;
} else if (extention == "tif") {
EGAMI_ERROR("Can not store in TIFF file '" << _uri << "'");
} else if (etk::end_with(tmpName, ".tif") == true) {
EGAMI_ERROR("Can not store in TIFF file '" << _fileName << "'");
return false;
} else {
EGAMI_ERROR("Extention not managed '" << _uri << "' Sopported extention: .edf / .bmp / .svg / .png / .jpg / .j2k / .tif");
EGAMI_ERROR("Extention not managed '" << _fileName << "' Sopported extention: .edf / .bmp / .svg / .png / .jpg / .j2k / .tif");
return false;
}
return true;
@ -303,10 +302,9 @@ static void generateDistanceField(const egami::ImageMono& _input, egami::Image&
}
bool egami::generateDistanceFieldFile(const etk::Uri& _input, const etk::Uri& _output) {
bool egami::generateDistanceFieldFile(const etk::String& _input, const etk::String& _output) {
egami::Image data;
etk::String extention = etk::toLower(_input.getPath().getExtention());
if (extention == "edf") {
if (etk::end_with(_input, ".edf") == true) {
return false;
}
EGAMI_ERROR("Generate distance field : '" << _input << "' ==> '" << _output << "'");

View File

@ -11,15 +11,14 @@
#include <etk/Color.hpp>
#include <egami/Image.hpp>
#include <egami/ImageMono.hpp>
#include <etk/uri/Uri.hpp>
namespace egami {
/**
* @brief Load a specific ilage file in the requested image data.
* @param[in] _uri Uri of the file (SVG, BMP, PNG).
* @param[in] _fileName Name of the file (SVG, BMP, PNG).
* @param[in] _size Dimention of the file when resizable (SVG).
*/
egami::Image load(const etk::Uri& _uri, 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.
@ -30,10 +29,10 @@ namespace egami {
/**
* @brief Save an image in a file.
* @param[in] _input Data of the image.
* @param[in] _uri Uri of the file.
* @param[in] _fileName Name of the file.
* @return true if the file is corectly Stored, false otherwise
*/
bool store(const egami::Image& _input, const etk::Uri& _uri);
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.
@ -44,10 +43,10 @@ namespace egami {
bool store(const egami::Image& _input, etk::Vector<uint8_t>& _buffer, const etk::String& _mineType);
/**
* @brief know if a file can have multiple size definition.
* @param[in] _uri Uri of the file.
* @param[in] _fileName Name of the file.
* @return true if the format is scalable.
*/
bool scalable(const etk::Uri& _uri);
bool scalable(const etk::String& _fileName);
/**
* @brief Generate a distance field output file from an input file;
* @param[in] _input Input file name
@ -55,7 +54,7 @@ namespace egami {
* @return true All done corectly.
* @return false An error occured.
*/
bool generateDistanceFieldFile(const etk::Uri& _input, const etk::Uri& _output);
bool generateDistanceFieldFile(const etk::String& _input, const etk::String& _output);
}

View File

@ -8,7 +8,7 @@
#include <egami/debug.hpp>
#include <egami/Image.hpp>
#include <egami/wrapperBMP.hpp>
#include <etk/uri/uri.hpp>
#include <etk/os/FSNode.hpp>
extern "C" {
#pragma pack(push,1)
struct bitmapFileHeader {
@ -106,18 +106,19 @@ static void display(struct bitmapFileHeader _header, struct bitmapInfoHeader _in
}*/
}
egami::Image egami::loadBMP(const etk::Uri& _uri) {
auto fileIo = etk::uri::get(_uri);
if (fileIo == null) {
EGAMI_ERROR("Can not create the uri: " << _uri);
egami::Image egami::loadBMP(const etk::String& _inputFile) {
etk::FSNode fileName(_inputFile);
EGAMI_VERBOSE("File='" << _inputFile << "' ==> " << fileName << " ==> " << fileName.getFileSystemName());
if (fileName.exist() == false) {
EGAMI_ERROR("File does not existed='" << fileName << "'");
return egami::Image();
}
if (fileIo->open(etk::io::OpenMode::Read) == false) {
EGAMI_ERROR("Can not open (r) the file : " << _uri);
if(fileName.fileOpenRead() == false) {
EGAMI_ERROR("Can not find the file name='" << fileName << "'");
return egami::Image();
}
etk::Vector<uint8_t> allData = fileIo->readAll<uint8_t>();
fileIo->close();
etk::Vector<uint8_t> allData = fileName.fileReadAll<uint8_t>();
fileName.fileClose();
return egami::loadBMP(allData);
}
@ -304,20 +305,17 @@ egami::Image egami::loadBMP(const etk::Vector<uint8_t>& _buffer) {
#if 1
// Extended mode
bool egami::storeBMP(const etk::Uri& _uri, const egami::Image& _inputImage) {
auto fileIo = etk::uri::get(_uri);
if (fileIo == null) {
EGAMI_ERROR("Can not create the uri: " << _uri);
return false;
}
if (fileIo->open(etk::io::OpenMode::Write) == false) {
EGAMI_ERROR("Can not open (w) the file : " << _uri);
bool egami::storeBMP(const etk::String& _fileName, const egami::Image& _inputImage) {
etk::FSNode fileName(_fileName);
EGAMI_VERBOSE("File='" << _fileName << "' ==> " << fileName << " ==> " << fileName.getFileSystemName());
if(fileName.fileOpenWrite() == false) {
EGAMI_ERROR("Can not crete the output file name='" << fileName << "'");
return false;
}
etk::Vector<uint8_t> allData;
bool ret = storeBMP(allData, _inputImage);
fileIo->writeAll(allData);
fileIo->close();
fileName.fileWriteAll(allData);
fileName.fileClose();
return ret;
}
@ -420,7 +418,7 @@ bool egami::storeBMP(etk::Vector<uint8_t>& _buffer, const egami::Image& _inputIm
}
#else
// old mode:
bool egami::storeBMP(const etk::Uri& _uri, const egami::Image& _inputImage) {
bool egami::storeBMP(const etk::String& _fileName, const egami::Image& _inputImage) {
struct bitmapFileHeader m_FileHeader;
struct bitmapInfoHeader m_InfoHeader;
memset(&m_InfoHeader, 0, sizeof(bitmapInfoHeader));
@ -458,24 +456,20 @@ bool egami::storeBMP(const etk::Uri& _uri, const egami::Image& _inputImage) {
//m_InfoHeader.biClrImportant = 0;
auto fileIo = etk::uri::get(_uri);
if (fileIo == null) {
EGAMI_ERROR("Can not create the uri: " << _uri);
return false;
}
if (fileIo->open(etk::io::OpenMode::Write) == false) {
EGAMI_ERROR("Can not open (w) the file : " << _uri);
etk::FSNode fileName(_fileName);
if(false == fileName.fileOpenWrite() ) {
EGAMI_ERROR("Can not find the file name=\"" << fileName << "\"");
return false;
}
// Write header:
if (fileIo->write(&m_FileHeader,sizeof(struct bitmapFileHeader),1) != 1) {
if (fileName.fileWrite(&m_FileHeader,sizeof(struct bitmapFileHeader),1) != 1) {
EGAMI_ERROR("error loading file header");
fileIo->close();
fileName.fileClose();
return false;
}
if (fileIo->write(&m_InfoHeader,sizeof(struct bitmapInfoHeader),1) != 1) {
if (fileName.fileWrite(&m_InfoHeader,sizeof(struct bitmapInfoHeader),1) != 1) {
EGAMI_ERROR("error loading file header");
fileIo->close();
fileName.fileClose();
return false;
}
EGAMI_ERROR("header size = " << sizeof(struct bitmapFileHeader) << " + " << sizeof(struct bitmapInfoHeader) << " = " << (sizeof(struct bitmapFileHeader)+sizeof(struct bitmapInfoHeader)) );
@ -497,7 +491,7 @@ bool egami::storeBMP(const etk::Uri& _uri, const egami::Image& _inputImage) {
*pointer++ = tmpColor.g();
*pointer++ = tmpColor.b();
*pointer++ = tmpColor.a();
fileIo->write(data,4,1);
fileName.fileWrite(data,4,1);
}
}
} else {
@ -509,7 +503,7 @@ bool egami::storeBMP(const etk::Uri& _uri, const egami::Image& _inputImage) {
*pointer++ = tmpColor.b();
*pointer++ = tmpColor.g();
*pointer++ = tmpColor.r();
fileIo->write(data,3,1);
fileName.fileWrite(data,3,1);
}
if (offset != 0) {
uint8_t pointer[4];
@ -517,11 +511,11 @@ bool egami::storeBMP(const etk::Uri& _uri, const egami::Image& _inputImage) {
pointer[1] = 0;
pointer[2] = 0;
pointer[3] = 0;
fileIo->write(pointer,1,offset);
fileName.fileWrite(pointer,1,offset);
}
}
}
fileIo->close();
fileName.fileClose();
return true;
}
#endif

View File

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

View File

@ -8,32 +8,32 @@
#include <egami/debug.hpp>
#include <egami/Image.hpp>
#include <egami/wrapperEDF.hpp>
#include <etk/uri/uri.hpp>
#include <etk/os/FSNode.hpp>
//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 etk::Uri& _uri) {
egami::Image egami::loadEDF(const etk::String& _inputFile) {
egami::Image out;
auto fileIo = etk::uri::get(_uri);
if (fileIo == null) {
EGAMI_ERROR("Can not create the uri: " << _uri);
etk::FSNode file(_inputFile);
if (false == file.exist()) {
EGAMI_ERROR("File does not existed='" << file << "'");
return out;
}
if (fileIo->open(etk::io::OpenMode::Read) == false) {
EGAMI_ERROR("Can not open (r) the file : " << _uri);
if(false == file.fileOpenRead() ) {
EGAMI_ERROR("Can not find the file name='" << file << "'");
return out;
}
etk::String line;
fileIo->gets(line);
file.fileGets(line);
if (etk::start_with(line, "#edf", false) == false) {
EGAMI_ERROR("This file seams not to be a EDF file ...");
fileIo->close();
file.fileClose();
return out;
}
// count number of colomn max an number of line max:
ivec2 size(0,0);
while (fileIo->gets(line) == true) {
while (file.fileGets(line) == true) {
if (line.size()/2 > (size_t)size.x()) {
size.setValue(line.size()/2, size.y()+1);
} else {
@ -45,17 +45,19 @@ egami::Image egami::loadEDF(const etk::Uri& _uri) {
} else {
size += ivec2(0,1);
}
EGAMI_DEBUG("'" << _uri << "' ==> size=" << size);
EGAMI_DEBUG("'" << file << "' ==> size=" << size);
// jup to the start of the file
fileIo->seek(0, etk::io::SeekMode::Start);
file.fileSeek(0, etk::seekNode_start);
// drop the first line
fileIo->gets(line);
file.fileGets(line);
// resize output:
out.configure(size, egami::colorType::RGB8); // TODO : Do it better
int32_t currentLineId = 0;
char tmp[3];
tmp[2] = '\0';
while (fileIo->gets(line) == true) {
while (file.fileGets(line) == true) {
if (line.size() <= 0) {
continue;
}
@ -77,30 +79,26 @@ egami::Image egami::loadEDF(const etk::Uri& _uri) {
out.set(ivec2(xxx/2, currentLineId), etk::Color<>((uint8_t)val, (uint8_t)val, (uint8_t)val, (uint8_t)val));
}
}
fileIo->close();
file.fileClose();
return out;
}
bool egami::storeEDF(const etk::Uri& _uri, const egami::Image& _inputImage) {
bool egami::storeEDF(const etk::String& _fileName, const egami::Image& _inputImage) {
bool anErrorEccured = false;
auto fileIo = etk::uri::get(_uri);
if (fileIo == null) {
EGAMI_ERROR("Can not create the uri: " << _uri);
etk::FSNode file(_fileName);
if (file.fileOpenWrite() == false) {
EGAMI_ERROR("Can not find the file name=\"" << file << "\"");
return false;
}
if (fileIo->open(etk::io::OpenMode::Write) == false) {
EGAMI_ERROR("Can not open (w) the file : " << _uri);
return false;
}
anErrorEccured = fileIo->puts( etk::String("#EDF // Generate with EGAMI (")
+ etk::toString(_inputImage.getSize().x())
+ ","
+ etk::toString(_inputImage.getSize().y()) + ")\n");
anErrorEccured = file.filePuts( etk::String("#EDF // Generate with EGAMI (")
+ etk::toString(_inputImage.getSize().x())
+ ","
+ etk::toString(_inputImage.getSize().y()) + ")\n");
char tmp[256];
for (int32_t yyy = 0; yyy < _inputImage.getSize().y(); ++yyy) {
if (yyy != 0) {
if (fileIo->put('\n') == false) {
if (file.filePut('\n') == false) {
anErrorEccured = false;
}
}
@ -111,11 +109,12 @@ bool egami::storeEDF(const etk::Uri& _uri, const egami::Image& _inputImage) {
EGAMI_DEBUG(" set : " << _inputImage.get(ivec2(xxx, yyy)) << " : '" << tmp << "'");
}
*/
if (fileIo->puts(tmp) == false) {
if (file.filePuts(tmp) == false) {
anErrorEccured = false;
}
}
}
fileIo->close();
file.fileClose();
return anErrorEccured;
}

View File

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

View File

@ -8,7 +8,7 @@
#include <egami/debug.hpp>
#include <egami/Image.hpp>
#include <egami/wrapperJPG.hpp>
#include <etk/uri/uri.hpp>
#include <etk/os/FSNode.hpp>
extern "C" {
#include "jpeglib.h"
}
@ -39,18 +39,18 @@ void put_scanline_someplace(const uint8_t* _buffer, int32_t _row_stride) {
}
egami::Image egami::loadJPG(const etk::Uri& _uri) {
auto fileIo = etk::uri::get(_uri);
if (fileIo == null) {
EGAMI_ERROR("Can not create the uri: " << _uri);
egami::Image egami::loadJPG(const etk::String& _inputFile) {
etk::FSNode fileName(_inputFile);
if (fileName.exist() == false) {
EGAMI_ERROR("File does not existed='" << fileName << "'");
return egami::Image();
}
if (fileIo->open(etk::io::OpenMode::Read) == false) {
EGAMI_ERROR("Can not open (r) the file : " << _uri);
if(fileName.fileOpenRead() == false) {
EGAMI_ERROR("Can not find the file name='" << fileName << "'");
return egami::Image();
}
etk::Vector<uint8_t> allData = fileIo->readAll<uint8_t>();
fileIo->close();
etk::Vector<uint8_t> allData = fileName.fileReadAll<uint8_t>();
fileName.fileClose();
return egami::loadJPG(allData);
}
@ -153,20 +153,17 @@ void myTermDestination(j_compress_ptr _cinfo) {
myBuffer.resize(myBuffer.size() - _cinfo->dest->free_in_buffer);
}
bool egami::storeJPG(const etk::Uri& _uri, const egami::Image& _inputImage) {
auto fileIo = etk::uri::get(_uri);
if (fileIo == null) {
EGAMI_ERROR("Can not create the uri: " << _uri);
return false;
}
if (fileIo->open(etk::io::OpenMode::Write) == false) {
EGAMI_ERROR("Can not open (w) the file : " << _uri);
bool egami::storeJPG(const etk::String& _fileName, const egami::Image& _inputImage) {
etk::FSNode fileName(_fileName);
EGAMI_VERBOSE("File='" << _fileName << "' ==> " << fileName << " ==> " << fileName.getFileSystemName());
if(fileName.fileOpenWrite() == false) {
EGAMI_ERROR("Can not crete the output file name='" << fileName << "'");
return false;
}
etk::Vector<uint8_t> allData;
bool ret = storeJPG(allData, _inputImage);
fileIo->writeAll(allData);
fileIo->close();
fileName.fileWriteAll(allData);
fileName.fileClose();
return ret;
}

View File

@ -10,10 +10,10 @@
namespace egami {
/**
* @breif Load a jpeg file in the image.
* @param[in] _uri Uri of the file.
* @param[in] _fileName Name of the file.
* @return Read Image.
*/
egami::Image loadJPG(const etk::Uri& _uri);
egami::Image loadJPG(const etk::String& _fileName);
/**
* @breif Load a jpeg file in the image.
* @param[in] _buffer file Buffer
@ -22,11 +22,11 @@ namespace egami {
egami::Image loadJPG(const etk::Vector<uint8_t>& _buffer);
/**
* @breif Store a jpg file in the image.
* @param[in] _uri Uri of the file.
* @param[in] _fileName Name of the file.
* @param[in] _inputImage write data.
* @return true if all is done correctly, false otherwise.
*/
bool storeJPG(const etk::Uri& _uri, const egami::Image& _inputImage);
bool storeJPG(const etk::String& _fileName, const egami::Image& _inputImage);
/**
* @breif Store a jpg file in the image.
* @param[out] _buffer output file buffer.

View File

@ -8,10 +8,25 @@
#include <egami/debug.hpp>
#include <egami/Image.hpp>
#include <egami/wrapperJPG2000.hpp>
#include <etk/os/FSNode.hpp>
egami::Image egami::loadJPG2000(const etk::Uri& _uri) {
egami::Image egami::loadJPG2000(const etk::String& _inputFile) {
egami::Image out;
EGAMI_TODO("Read JPEG2000 file");
etk::FSNode fileName(_inputFile);
if (fileName.exist() == false) {
EGAMI_ERROR("File does not existed='" << fileName << "'");
return out;
}
if(fileName.fileOpenRead() == false) {
EGAMI_ERROR("Can not find the file name='" << fileName << "'");
return out;
}
return out;
}

View File

@ -10,9 +10,9 @@
namespace egami {
/**
* @breif Load a jpeg 2000 file in the image.
* @param[in] _uri Uri of the file.
* @param[in] _fileName Name of the file.
* @return Read Image.
*/
egami::Image loadJPG2000(const etk::Uri& _uri);
egami::Image loadJPG2000(const etk::String& _fileName);
}

View File

@ -8,7 +8,7 @@
#include <egami/debug.hpp>
#include <egami/Image.hpp>
#include <egami/wrapperPNG.hpp>
#include <etk/uri/uri.hpp>
#include <etk/os/FSNode.hpp>
#include <png/png.h>
namespace egami {
class ReaderInstance {
@ -19,22 +19,22 @@ namespace egami {
virtual void flush() = 0;
};
class ReaderInstancIOInterface : public egami::ReaderInstance {
class ReaderInstanceFSNode : public egami::ReaderInstance {
private:
ememory::SharedPtr<etk::io::Interface> m_data;
etk::FSNode& m_data;
public:
ReaderInstancIOInterface(const ememory::SharedPtr<etk::io::Interface>& _data):
ReaderInstanceFSNode(etk::FSNode& _data):
m_data(_data) {
}
void read(png_bytep _data, png_size_t _length) override {
m_data->read(_data, 1, _length);
m_data.fileRead(_data, 1, _length);
}
void write(png_bytep _data, png_size_t _length) override {
m_data->write(_data, 1, _length);
m_data.fileWrite(_data, 1, _length);
}
void flush() override {
m_data->flush();
m_data.fileFlush();
}
};
@ -267,26 +267,26 @@ static egami::Image genericLoader(png_structp _pngPtr, png_infop _infoPtr) {
}
egami::Image egami::loadPNG(const etk::Uri& _uri) {
egami::Image egami::loadPNG(const etk::String& _inputFile) {
egami::Image out;
auto fileIo = etk::uri::get(_uri);
if (fileIo == null) {
EGAMI_ERROR("Can not create the uri: " << _uri);
etk::FSNode fileName(_inputFile);
if (fileName.exist() == false) {
EGAMI_ERROR("File does not existed='" << fileName << "'");
return out;
}
if (fileIo->open(etk::io::OpenMode::Read) == false) {
EGAMI_ERROR("Can not open (r) the file : " << _uri);
if(fileName.fileOpenRead() == false) {
EGAMI_ERROR("Can not find the file name='" << fileName << "'");
return out;
}
unsigned char header[8];
if (fileIo->read(header,1,8) != 8) {
if (fileName.fileRead(header,1,8) != 8) {
EGAMI_ERROR("error loading file header");
fileIo->close();
fileName.fileClose();
return out;
}
if (png_sig_cmp(header, 0, 8)) {
EGAMI_ERROR("Invalid file :" << _uri);
EGAMI_ERROR("Invalid file :" << fileName);
return out;
}
@ -294,14 +294,14 @@ egami::Image egami::loadPNG(const etk::Uri& _uri) {
png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, userErrorFunction, userWarningFunction);
if (png_ptr == null) {
EGAMI_ERROR("Can not Allocate PNG structure");
fileIo->close();
fileName.fileClose();
return out;
}
png_infop info_ptr = png_create_info_struct(png_ptr);
if (info_ptr == null) {
EGAMI_ERROR("Can not Allocate PNG info structure");
png_destroy_read_struct(&png_ptr, null, null);
fileIo->close();
fileName.fileClose();
return out;
}
/*
@ -309,11 +309,11 @@ egami::Image egami::loadPNG(const etk::Uri& _uri) {
EGAMI_ERROR(" Can not set the JUMP buffer adresses");
// Free all of the memory associated with the png_ptr and info_ptr
png_destroy_read_struct(&png_ptr, &info_ptr, null);
fileIo->close();
fileName.fileClose();
return false;
}
*/
ReaderInstancIOInterface tmpNode(fileIo);
ReaderInstanceFSNode tmpNode(fileName);
ReaderInstance* tmpPoiter = &tmpNode;
@ -322,7 +322,7 @@ egami::Image egami::loadPNG(const etk::Uri& _uri) {
tmpPoiter,
&local_ReadData);
out = genericLoader(png_ptr, info_ptr);
fileIo->close();
fileName.fileClose();
return out;
}
@ -444,36 +444,31 @@ bool egami::storePNG(etk::Vector<uint8_t>& _buffer, const egami::Image& _inputIm
return genericWriter(png_ptr, info_ptr, _inputImage);
}
bool egami::storePNG(const etk::Uri& _uri, const egami::Image& _inputImage) {
auto fileIo = etk::uri::get(_uri);
if (fileIo == null) {
EGAMI_ERROR("Can not create the uri: " << _uri);
return false;
}
if (fileIo->open(etk::io::OpenMode::Write) == false) {
EGAMI_ERROR("Can not open (w) the file : " << _uri);
bool egami::storePNG(const etk::String& _fileName, const egami::Image& _inputImage) {
etk::FSNode fileName(_fileName);
if(fileName.fileOpenWrite() == false) {
EGAMI_ERROR("Can not find the file name='" << fileName << "'");
return false;
}
png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, userErrorFunction, userWarningFunction);
if (png_ptr == null) {
EGAMI_ERROR("Can not Allocate PNG structure");
fileIo->close();
return false;
}
png_infop info_ptr = png_create_info_struct(png_ptr);
if (info_ptr == null) {
EGAMI_ERROR("Can not Allocate PNG info structure");
png_destroy_write_struct(&png_ptr, null);
fileIo->close();
fileName.fileClose();
return false;
}
if (setjmp(png_jmpbuf(png_ptr))) {
EGAMI_ERROR("Error during init_io");
png_destroy_write_struct(&png_ptr, &info_ptr);
fileIo->close();
fileName.fileClose();
return false;
}
ReaderInstancIOInterface tmpNode(fileIo);
ReaderInstanceFSNode tmpNode(fileName);
ReaderInstance* tmpPoiter = &tmpNode;
@ -484,6 +479,6 @@ bool egami::storePNG(const etk::Uri& _uri, const egami::Image& _inputImage) {
&local_FlushData);
bool out = genericWriter(png_ptr, info_ptr, _inputImage);
fileIo->close();
fileName.fileClose();
return out;
}

View File

@ -10,10 +10,10 @@
namespace egami {
/**
* @breif Load a png file in the image.
* @param[in] _uri Uri of the file.
* @param[in] _fileName Name of the file.
* @return Read Image.
*/
egami::Image loadPNG(const etk::Uri& _uri);
egami::Image loadPNG(const etk::String& _fileName);
/**
* @breif Load a png file in the image.
* @param[in] _buffer File buffer.
@ -22,11 +22,11 @@ namespace egami {
egami::Image loadPNG(const etk::Vector<uint8_t>& _buffer);
/**
* @breif Store a PNG file in the image.
* @param[in] _uri Uri of the file.
* @param[in] _fileName Name of the file.
* @param[in] _inputImage write data.
* @return true if all is done correctly, false otherwise.
*/
bool storePNG(const etk::Uri& _uri, const egami::Image& _inputImage);
bool storePNG(const etk::String& _fileName, const egami::Image& _inputImage);
/**
* @breif Store a PNG file in the image.
* @param[out] _buffer output file buffer.

View File

@ -8,15 +8,15 @@
#include <egami/debug.hpp>
#include <egami/Image.hpp>
#include <egami/wrapperSVG.hpp>
#include <etk/uri/uri.hpp>
#include <etk/os/FSNode.hpp>
#include <esvg/esvg.hpp>
egami::Image egami::loadSVG(const etk::Uri& _uri, const ivec2& _size) {
egami::Image egami::loadSVG(const etk::String& _fileName, const ivec2& _size) {
egami::Image out;
esvg::Document svgDocument;
if (svgDocument.load(_uri) == false) {
EGAMI_ERROR("Error to load SVG file " << _uri );
if (svgDocument.load(_fileName) == false) {
EGAMI_ERROR("Error to load SVG file " << _fileName );
return out;
}
ivec2 imageSize = _size;

View File

@ -10,10 +10,10 @@
namespace egami {
/**
* @brief Load a svg file in the image.
* @param[in] _uri Uri of the file.
* @param[in] _fileName Name of the file.
* @param[in] _size size of the output image.
* @return Generated image
*/
egami::Image loadSVG(const etk::Uri& _uri, const ivec2& _size=ivec2(-1,-1));
egami::Image loadSVG(const etk::String& _fileName, const ivec2& _size=ivec2(-1,-1));
}

View File

@ -8,10 +8,26 @@
#include <egami/debug.hpp>
#include <egami/Image.hpp>
#include <egami/wrapperTIFF.hpp>
#include <etk/os/FSNode.hpp>
egami::Image egami::loadTIFF(const etk::Uri& _uri) {
egami::Image egami::loadTIFF(const etk::String& _inputFile) {
egami::Image out;
EGAMI_TODO("Read TIFF file");
etk::FSNode fileName(_inputFile);
if (fileName.exist() == false) {
EGAMI_ERROR("File does not existed='" << fileName << "'");
return out;
}
if(fileName.fileOpenRead() == false) {
EGAMI_ERROR("Can not find the file name='" << fileName << "'");
return out;
}
return out;
}

View File

@ -10,9 +10,9 @@
namespace egami {
/**
* @breif Load a tiff file in the image.
* @param[in] _uri Uri of the file.
* @param[in] _fileName Name of the file.
* @return Read Image.
*/
egami::Image loadTIFF(const etk::Uri& _uri);
egami::Image loadTIFF(const etk::String& _fileName);
}

View File

@ -1,5 +1,5 @@
#!/usr/bin/python
import realog.debug as debug
import lutin.debug as debug
import lutin.tools as tools

View File

@ -1,5 +1,5 @@
#!/usr/bin/python
import realog.debug as debug
import lutin.debug as debug
import lutin.tools as tools

View File

@ -1,5 +1,5 @@
#!/usr/bin/python
import realog.debug as debug
import lutin.debug as debug
import lutin.tools as tools

View File

@ -19,29 +19,29 @@ static void readBMP() {
egami::Image image;
//! [egami_sample_declare_image]
//! [egami_sample_read_file_bmp]
image = egami::load("DATA:///read.bmp");
image = egami::load("DATA:read.bmp");
//! [egami_sample_read_file_bmp]
TEST_INFO("image exist (BMP): " << image.exist());
}
static void readSVG() {
//! [egami_sample_read_file_svg]
egami::Image image = egami::load("DATA:///read.svg");
egami::Image image = egami::load("DATA:read.svg");
//! [egami_sample_read_file_svg]
TEST_INFO("image exist (SVG): " << image.exist());
//! [egami_sample_read_file_svg_rescale]
image = egami::load("DATA:///read.svg", ivec2(800,600));
image = egami::load("DATA:read.svg", ivec2(800,600));
//! [egami_sample_read_file_svg_rescale]
TEST_INFO("image exist (SVG-rescale): " << image.exist());
//! [egami_sample_read_file_svg_scale_factor]
// TODO : image = egami::load("DATA:///read.svg", 0.5);
// TODO : image = egami::load("DATA:read.svg", 0.5);
//! [egami_sample_read_file_svg_scale_factor]
TEST_INFO("image exist (SVG-scale): " << image.exist());
}
static void readPNG() {
//! [egami_sample_read_file_png]
egami::Image image = egami::load("DATA:///read_128x128.png");
egami::Image image = egami::load("DATA:read_128x128.png");
//! [egami_sample_read_file_png]
TEST_INFO("image exist (PNG): " << image.exist());
}

View File

@ -18,7 +18,7 @@ int main(int argc, const char *argv[]) {
}
TEST(TestBMP, read_227x149) {
egami::Image image = egami::load("DATA:///read_227x149.bmp");
egami::Image image = egami::load("DATA:read_227x149.bmp");
egami::store(image, "out/read_227x149.bmp.bmp");
// Check if image is loaded
EXPECT_EQ(true, image.exist());
@ -32,7 +32,7 @@ TEST(TestBMP, read_227x149) {
}
TEST(TestBMP, read_128x128) {
egami::Image image = egami::load("DATA:///read_128x128.bmp");
egami::Image image = egami::load("DATA:read_128x128.bmp");
egami::store(image, "out/read_128x128.bmp.bmp");
// Check if image is loaded
EXPECT_EQ(true, image.exist());
@ -47,7 +47,7 @@ TEST(TestBMP, read_128x128) {
TEST(TestPNG, read_227x149) {
egami::Image image = egami::load("DATA:///read_227x149.png");
egami::Image image = egami::load("DATA:read_227x149.png");
egami::store(image, "out/read.png_227x149.bmp");
// Check if image is loaded
EXPECT_EQ(true, image.exist());
@ -61,7 +61,7 @@ TEST(TestPNG, read_227x149) {
}
TEST(TestPNG, read_128x128) {
egami::Image image = egami::load("DATA:///read_128x128.png");
egami::Image image = egami::load("DATA:read_128x128.png");
egami::store(image, "out/read_128x128.png.bmp");
// Check if image is loaded
EXPECT_EQ(true, image.exist());
@ -75,7 +75,7 @@ TEST(TestPNG, read_128x128) {
}
TEST(TestSVG, read) {
egami::Image image = egami::load("DATA:///read.svg");
egami::Image image = egami::load("DATA:read.svg");
egami::store(image, "out/read.svg.bmp");
// Check if image is loaded
EXPECT_EQ(true, image.exist());
@ -90,7 +90,7 @@ TEST(TestSVG, read) {
TEST(TestJPG, read_227x149) {
egami::Image image = egami::load("DATA:///read_227x149.jpg");
egami::Image image = egami::load("DATA:read_227x149.jpg");
egami::store(image, "out/read_227x149.jpg.bmp");
// Check if image is loaded
EXPECT_EQ(true, image.exist());
@ -105,7 +105,7 @@ TEST(TestJPG, read_227x149) {
TEST(TestJPG, read_128x128) {
egami::Image image = egami::load("DATA:///read_128x128.jpg");
egami::Image image = egami::load("DATA:read_128x128.jpg");
egami::store(image, "out/read_128x128.jpg.bmp");
// Check if image is loaded
EXPECT_EQ(true, image.exist());

View File

@ -22,8 +22,8 @@ static void usage(int _retValue = 0) {
int main(int argc, const char *argv[]) {
// the only one init for etk:
etk::init(argc, argv);
etk::Path input;
etk::Path output;
etk::String input;
etk::String output;
for (int32_t iii=0; iii<argc ; ++iii) {
etk::String data = argv[iii];
if ( data == "-h"

View File

@ -1,5 +1,5 @@
#!/usr/bin/python
import realog.debug as debug
import lutin.debug as debug
import lutin.tools as tools
import os

View File

@ -10,6 +10,7 @@
#include <ewol/widget/Image.hpp>
#include <ewol/context/Context.hpp>
#include <etk/os/FSNode.hpp>
#include <eproperty/Value.hpp>
appl::MainWindows::MainWindows() :
@ -20,7 +21,7 @@ appl::MainWindows::MainWindows() :
void appl::MainWindows::init() {
ewol::widget::Windows::init();
m_image = ewol::widget::Image::create("src", etk::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");
@ -41,16 +42,16 @@ void appl::MainWindows::onCallbackShortCut(const etk::String& _value) {
}
}
void appl::MainWindows::setListOfFiles(etk::Vector<etk::Path> _listImages) {
void appl::MainWindows::setListOfFiles(etk::Vector<etk::String> _listImages) {
m_listImages = _listImages;
if (m_listImages.size() == 0) {
m_idDisplayed = -1;
m_image->propertySource.set("DATA:///icon.png");
m_image->propertySource.set("DATA:icon.png");
propertyTitle.set("EVI");
} else {
m_idDisplayed = 0;
m_image->propertySource.set(m_listImages[0]);
propertyTitle.set("EVI:" + m_listImages[0].getString());
propertyTitle.set("EVI:" + m_listImages[0]);
}
}
@ -73,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].getString() + " " + etk::toString(m_idDisplayed+1) + "/" + etk::toString(m_listImages.size()));
propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::toString(m_idDisplayed+1) + "/" + etk::toString(m_listImages.size()));
return true;
}
if (_event.getType() == gale::key::keyboard::left) {
@ -83,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].getString() + " " + etk::toString(m_idDisplayed+1) + "/" + etk::toString(m_listImages.size()));
propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::toString(m_idDisplayed+1) + "/" + etk::toString(m_listImages.size()));
return true;
}
if (_event.getType() == gale::key::keyboard::down) {
@ -92,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].getString() + " " + etk::toString(m_idDisplayed+1) + "/" + etk::toString(m_listImages.size()));
propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::toString(m_idDisplayed+1) + "/" + etk::toString(m_listImages.size()));
return true;
}
if (_event.getType() == gale::key::keyboard::up) {
@ -101,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].getString() + " " + etk::toString(m_idDisplayed+1) + "/" + etk::toString(m_listImages.size()));
propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::toString(m_idDisplayed+1) + "/" + etk::toString(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].getString() + " " + etk::toString(m_idDisplayed+1) + "/" + etk::toString(m_listImages.size()));
propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::toString(m_idDisplayed+1) + "/" + etk::toString(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].getString() + " " + etk::toString(m_idDisplayed+1) + "/" + etk::toString(m_listImages.size()));
propertyTitle.set("EVI:" + m_listImages[m_idDisplayed] + " " + etk::toString(m_idDisplayed+1) + "/" + etk::toString(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;
etk::Vector<etk::Path> m_listImages;
etk::Vector<etk::String> m_listImages;
int64_t m_idDisplayed;
public:
// Constructeur
@ -22,7 +22,7 @@ namespace appl {
public:
DECLARE_FACTORY(MainWindows);
~MainWindows() {};
void setListOfFiles(etk::Vector<etk::Path> _listImages);
void setListOfFiles(etk::Vector<etk::String> _listImages);
protected:
void onCallbackShortCut(const etk::String& _value);
bool onEventInput(const ewol::event::Input& _event) override;

View File

@ -6,8 +6,7 @@
#include <etk/types.hpp>
#include <etk/types.hpp>
#include <etk/theme/theme.hpp>
#include <etk/path/fileSystem.hpp>
#include <etk/os/FSNode.hpp>
#include <ewol/ewol.hpp>
#include <ewol/object/Object.hpp>
#include <ewol/context/Context.hpp>
@ -18,7 +17,7 @@
namespace appl {
class MainApplication : public ewol::context::Application {
private:
etk::Vector<etk::Path> m_listFiles;
etk::Vector<etk::String> m_listFiles;
public:
virtual void onCreate(ewol::Context& _context) {
APPL_INFO(" == > CREATE ... (START) [" << gale::getBoardType() << "] (" << gale::getCompilationMode() << ") (BEGIN)");
@ -36,16 +35,19 @@ namespace appl {
continue;
}
// TODO : Check if it is a path ...
if (etk::path::exist(tmpppp) == false) {
if (etk::FSNodeExist(tmpppp) == false) {
APPL_ERROR("element does not exist: '" << tmpppp << "' ==> rejected");
} else {
if (etk::path::isFile(tmpppp) == true) {
m_listFiles.pushBack(tmpppp);
} else {
etk::Vector<etk::Path> list = etk::path::list(tmpppp, etk::path::LIST_FILE);
for (auto &it : list) {
etk::FSNode elem(tmpppp);
if (elem.getNodeType() == etk::typeNode_folder) {
etk::Vector<etk::String> tmp = elem.folderGetSub(false, true, ".*");
tmp.sort(0, tmp.size(), [](const etk::String& _left, const etk::String& _right) { return _left < _right;});
for (auto &it : tmp) {
m_listFiles.pushBack(it);
}
} else {
// simple file:
m_listFiles.pushBack(tmpppp);
}
}
}
@ -65,7 +67,7 @@ namespace appl {
#endif
// set the application icon ...
_context.setIcon("DATA:///icon.png");
_context.setIcon("DATA:icon.png");
APPL_INFO("==> CREATE ... (END)");
}

View File

@ -1,5 +1,5 @@
#!/usr/bin/python
import realog.debug as debug
import lutin.debug as debug
import lutin.tools as tools
import os