[DEV] integarate std x11

This commit is contained in:
Edouard DUPIN 2013-11-11 20:17:48 +01:00
parent 01cf75fc9c
commit 35a6730533
10 changed files with 22 additions and 22 deletions

View File

@ -13,7 +13,7 @@ egami::Image::Image(const ivec2& _size) :
// basic element :
etk::Color<> tmpBg(0,0,0,0);
// preallocate data with a basic bg elements :
m_data.reSize(m_size.x()*m_size.y(), tmpBg);
m_data.resize(m_size.x()*m_size.y(), tmpBg);
if ((uint32_t)m_size.x()*m_size.y() > m_data.size()) {
TK_ERROR("Allocation of data buffer in error");
return;
@ -22,7 +22,7 @@ egami::Image::Image(const ivec2& _size) :
void egami::Image::resize(const ivec2& _size, const etk::Color<>& _color) {
m_size=_size;
m_data.reSize(m_size.x()*m_size.y(), _color);
m_data.resize(m_size.x()*m_size.y(), _color);
}
void egami::Image::resize(const ivec2& _size, const ivec2& _startPos) {
@ -34,7 +34,7 @@ void egami::Image::resize(const ivec2& _size, const ivec2& _startPos) {
egami::Image tmpImage(*this);
m_size=_size;
etk::Color<> tmpBg(0,0,0,0);
m_data.reSize(m_size.x()*m_size.y(), tmpBg);
m_data.resize(m_size.x()*m_size.y(), tmpBg);
for (int32_t jjj=0; jjj<m_size.y(); jjj++) {
for (int32_t iii=0; iii<m_size.y(); iii++) {
ivec2 tmppos(iii,jjj);

View File

@ -10,7 +10,7 @@
#define __EGAMI_IMAGE_H__
#include <etk/types.h>
#include <etk/Vector.h>
#include <vector>
#include <etk/math/Vector2D.h>
#include <etk/Color.h>
@ -18,7 +18,7 @@ namespace egami {
class Image {
private:
ivec2 m_size;
etk::Vector<etk::Color<> > m_data;
std::vector<etk::Color<> > m_data;
public:
// constructor :
Image(const ivec2& _size=ivec2(32,32));

View File

@ -13,15 +13,15 @@
#include <egami/wrapperPNG.h>
#include <egami/wrapperBMP.h>
bool egami::scalable(const etk::UString& _fileName) {
bool egami::scalable(const std::string& _fileName) {
if (true == _fileName.endWith(".svg") ) {
return true;
}
return false;
}
bool egami::load(egami::Image& _output, const etk::UString& _fileName, const ivec2& _size) {
etk::UString tmpName = _fileName.toLower();
bool egami::load(egami::Image& _output, const std::string& _fileName, const ivec2& _size) {
std::string tmpName = _fileName.toLower();
// select the corect Loader :
if (true == tmpName.endWith(".bmp") ) {
if (false == egami::loadBMP(_fileName, _output)) {
@ -45,8 +45,8 @@ bool egami::load(egami::Image& _output, const etk::UString& _fileName, const ive
return true;
}
bool egami::store(const egami::Image& _input, const etk::UString& _fileName) {
etk::UString tmpName = _fileName.toLower();
bool egami::store(const egami::Image& _input, const std::string& _fileName) {
std::string tmpName = _fileName.toLower();
// select the corect Loader :
if (true == tmpName.endWith(".bmp") ) {
if (false == egami::storeBMP(_fileName, _input)) {

View File

@ -10,7 +10,7 @@
#define __EGAMI_H__
#include <etk/types.h>
#include <etk/Vector.h>
#include <vector>
#include <etk/math/Vector2D.h>
#include <etk/Color.h>
#include <egami/Image.h>
@ -24,20 +24,20 @@ namespace egami
* @param[in] _size Dimention of the file when resizable (SVG).
* @return true if the file is corectly loaded, false otherwise.
*/
bool load(egami::Image& _output, const etk::UString& _fileName, const ivec2& _size=ivec2(-1,-1) );
bool load(egami::Image& _output, const std::string& _fileName, 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 etk::UString& _fileName);
bool store(const egami::Image& _input, const std::string& _fileName);
/**
* @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 etk::UString& _fileName);
bool scalable(const std::string& _fileName);
};
#endif

View File

@ -45,7 +45,7 @@ enum modeBitmap {
#undef __class__
#define __class__ "wrapperBMP"
bool egami::loadBMP(const etk::UString& _inputFile, egami::Image& _ouputImage) {
bool egami::loadBMP(const std::string& _inputFile, egami::Image& _ouputImage) {
enum modeBitmap m_dataMode = BITS_16_R5G6B5;
int32_t m_width = 0;
int32_t m_height = 0;
@ -215,7 +215,7 @@ bool egami::loadBMP(const etk::UString& _inputFile, egami::Image& _ouputImage) {
return true;
}
bool egami::storeBMP(const etk::UString& _fileName, const egami::Image& _inputImage) {
bool egami::storeBMP(const std::string& _fileName, const egami::Image& _inputImage) {
struct bitmapFileHeader m_FileHeader;
struct bitmapInfoHeader m_InfoHeader;

View File

@ -19,14 +19,14 @@ namespace egami
* @param[out] _ouputImage Read data.
* @return true if all is done correctly, false otherwise.
*/
bool loadBMP(const etk::UString& _fileName, egami::Image& _ouputImage);
bool loadBMP(const std::string& _fileName, egami::Image& _ouputImage);
/**
* @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 etk::UString& _fileName, const egami::Image& _inputImage);
bool storeBMP(const std::string& _fileName, const egami::Image& _inputImage);
};
#endif

View File

@ -42,7 +42,7 @@ static void localFlushData(png_structp png_ptr)
}
*/
bool egami::loadPNG(const etk::UString& _inputFile, egami::Image& _ouputImage) {
bool egami::loadPNG(const std::string& _inputFile, egami::Image& _ouputImage) {
etk::FSNode fileName(_inputFile);
if (false == fileName.exist()) {

View File

@ -19,7 +19,7 @@ namespace egami
* @param[out] _ouputImage Read data.
* @return true if all is done correctly, false otherwise.
*/
bool loadPNG(const etk::UString& _fileName, egami::Image& _ouputImage);
bool loadPNG(const std::string& _fileName, egami::Image& _ouputImage);
};
#endif

View File

@ -18,7 +18,7 @@
#define __class__ "wrapperSVG"
bool egami::loadSVG(const etk::UString& _fileName, egami::Image& _ouputImage, const ivec2& _size) {
bool egami::loadSVG(const std::string& _fileName, egami::Image& _ouputImage, const ivec2& _size) {
esvg::Document m_element(_fileName);
if (false == m_element.isLoadOk()) {
EGAMI_ERROR("Error to load SVG file " << _fileName );

View File

@ -20,7 +20,7 @@ namespace egami
* @param[in] _size size of the output image.
* @return true if all is done correctly, false otherwise.
*/
bool loadSVG(const etk::UString& _fileName, egami::Image& _ouputImage, const ivec2& _size=ivec2(-1,-1));
bool loadSVG(const std::string& _fileName, egami::Image& _ouputImage, const ivec2& _size=ivec2(-1,-1));
};
#endif