[DEV] update of new etk Uri API
This commit is contained in:
parent
efd3b160ad
commit
160a7dec30
@ -17,7 +17,7 @@ const int32_t ewol::compositing::Image::m_vboIdCoordTex(1);
|
||||
const int32_t ewol::compositing::Image::m_vboIdColor(2);
|
||||
#define NB_VBO (3)
|
||||
|
||||
ewol::compositing::Image::Image(const etk::String& _imageName,
|
||||
ewol::compositing::Image::Image(const etk::Uri& _imageName,
|
||||
bool _df,
|
||||
int32_t _size) :
|
||||
m_filename(_imageName),
|
||||
@ -271,9 +271,9 @@ void ewol::compositing::Image::printPart(const vec2& _size,
|
||||
m_VBO->flush();
|
||||
}
|
||||
|
||||
void ewol::compositing::Image::setSource(const etk::String& _newFile, const vec2& _size) {
|
||||
void ewol::compositing::Image::setSource(const etk::Uri& _uri, const vec2& _size) {
|
||||
clear();
|
||||
if ( m_filename == _newFile
|
||||
if ( m_filename == _uri
|
||||
&& m_requestSize == _size) {
|
||||
// Nothing to do ...
|
||||
return;
|
||||
@ -281,14 +281,14 @@ void ewol::compositing::Image::setSource(const etk::String& _newFile, const vec2
|
||||
ememory::SharedPtr<ewol::resource::TextureFile> resource = m_resource;
|
||||
ememory::SharedPtr<ewol::resource::ImageDF> resourceDF = m_resourceDF;
|
||||
ememory::SharedPtr<ewol::resource::Texture> resourceTex = m_resourceImage;
|
||||
m_filename = _newFile;
|
||||
m_filename = _uri;
|
||||
m_requestSize = _size;
|
||||
m_resource.reset();
|
||||
m_resourceDF.reset();
|
||||
m_resourceImage.reset();
|
||||
ivec2 tmpSize(_size.x(),_size.y());
|
||||
// note that no image can be loaded...
|
||||
if (_newFile != "") {
|
||||
if (_uri.isEmpty() == false) {
|
||||
// link to new one
|
||||
if (m_distanceFieldMode == false) {
|
||||
m_resource = ewol::resource::TextureFile::create(m_filename, tmpSize);
|
||||
|
@ -17,7 +17,7 @@ namespace ewol {
|
||||
public:
|
||||
static const int32_t sizeAuto;
|
||||
private:
|
||||
etk::String m_filename;
|
||||
etk::Uri m_filename;
|
||||
ivec2 m_requestSize;
|
||||
vec3 m_position; //!< The current position to draw
|
||||
vec3 m_clippingPosStart; //!< Clipping start position
|
||||
@ -50,11 +50,11 @@ namespace ewol {
|
||||
public:
|
||||
/**
|
||||
* @brief generic constructor
|
||||
* @param[in] _imageName Name of the file that might be loaded
|
||||
* @param[in] _uri URI of the file that might be loaded
|
||||
* @param[in] _df enable distance field mode
|
||||
* @param[in] _size for the image when Verctorial image loading is requested
|
||||
*/
|
||||
Image(const etk::String& _imageName="",
|
||||
Image(const etk::Uri& _uri="",
|
||||
bool _df=false,
|
||||
int32_t _size=ewol::compositing::Image::sizeAuto);
|
||||
/**
|
||||
@ -156,13 +156,13 @@ namespace ewol {
|
||||
vec2 _sourcePosStop);
|
||||
/**
|
||||
* @brief change the image Source == > can not be done to display 2 images at the same time ...
|
||||
* @param[in] _newFile New file of the Image
|
||||
* @param[in] _uri New file of the Image
|
||||
* @param[in] _size for the image when Verctorial image loading is requested
|
||||
*/
|
||||
void setSource(const etk::String& _newFile, int32_t _size=32) {
|
||||
setSource(_newFile, vec2(_size,_size));
|
||||
void setSource(const etk::Uri& _uri, int32_t _size=32) {
|
||||
setSource(_uri, vec2(_size,_size));
|
||||
};
|
||||
void setSource(const etk::String& _newFile, const vec2& _size);
|
||||
void setSource(const etk::Uri& _uri, const vec2& _size);
|
||||
void setSource(egami::Image _image);
|
||||
/**
|
||||
* @brief Sometimes the user declare an image but not allocate the ressources all the time, this is to know it ..
|
||||
|
@ -44,7 +44,7 @@ ewol::Context& ewol::getContext() {
|
||||
}
|
||||
|
||||
|
||||
void ewol::Context::setInitImage(const etk::String& _fileName) {
|
||||
void ewol::Context::setInitImage(const etk::Uri& _fileName) {
|
||||
//m_initDisplayImageName = _fileName;
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ namespace ewol {
|
||||
* @brief Special for init (main) set the start image when loading data
|
||||
* @param[in] _fileName Name of the image to load
|
||||
*/
|
||||
void setInitImage(const etk::String& _fileName);
|
||||
void setInitImage(const etk::Uri& _fileName);
|
||||
public:
|
||||
/**
|
||||
* @brief Request a display after call a resize
|
||||
|
@ -160,9 +160,9 @@ static int32_t nextP2(int32_t _value) {
|
||||
|
||||
|
||||
|
||||
ememory::SharedPtr<ewol::resource::ImageDF> ewol::resource::ImageDF::create(const etk::String& _filename, ivec2 _size) {
|
||||
EWOL_VERBOSE("KEEP: TextureFile: '" << _filename << "' size=" << _size);
|
||||
if (_filename == "") {
|
||||
ememory::SharedPtr<ewol::resource::ImageDF> ewol::resource::ImageDF::create(const etk::Uri& _uri, ivec2 _size) {
|
||||
EWOL_VERBOSE("KEEP: TextureFile: '" << _uri << "' size=" << _size);
|
||||
if (_uri.isEmpty() == true) {
|
||||
ememory::SharedPtr<ewol::resource::ImageDF> object(ETK_NEW(ewol::resource::ImageDF));
|
||||
if (object == null) {
|
||||
EWOL_ERROR("allocation error of a resource : ??TEX??");
|
||||
@ -180,8 +180,8 @@ ememory::SharedPtr<ewol::resource::ImageDF> ewol::resource::ImageDF::create(cons
|
||||
_size.setY(-1);
|
||||
//EWOL_ERROR("Error Request the image size.y() =0 ???");
|
||||
}
|
||||
etk::String TmpFilename = _filename;
|
||||
if (etk::end_with(_filename, ".svg") == false) {
|
||||
etk::Uri tmpFilename = _uri;
|
||||
if (etk::toLower(_uri.getPath().getExtention()) != "svg") {
|
||||
_size = ivec2(-1,-1);
|
||||
}
|
||||
#ifdef __TARGET_OS__MacOs
|
||||
@ -194,33 +194,31 @@ ememory::SharedPtr<ewol::resource::ImageDF> ewol::resource::ImageDF::create(cons
|
||||
#ifdef __TARGET_OS__Android
|
||||
_size.setValue(nextP2(_size.x()), nextP2(_size.y()));
|
||||
#endif
|
||||
TmpFilename += ":";
|
||||
TmpFilename += etk::toString(_size.x());
|
||||
TmpFilename += "x";
|
||||
TmpFilename += etk::toString(_size.y());
|
||||
tmpFilename.getQuery().set("x", etk::toString(_size.x()));
|
||||
tmpFilename.getQuery().set("y", etk::toString(_size.y()));
|
||||
}
|
||||
|
||||
EWOL_VERBOSE("KEEP: TextureFile: '" << TmpFilename << "' new size=" << _size);
|
||||
EWOL_VERBOSE("KEEP: TextureFile: '" << tmpFilename << "' new size=" << _size);
|
||||
ememory::SharedPtr<ewol::resource::ImageDF> object = null;
|
||||
ememory::SharedPtr<gale::Resource> object2 = getManager().localKeep("DF__" + TmpFilename);
|
||||
ememory::SharedPtr<gale::Resource> object2 = getManager().localKeep("DF__" + tmpFilename.getString());
|
||||
if (object2 != null) {
|
||||
object = ememory::dynamicPointerCast<ewol::resource::ImageDF>(object2);
|
||||
if (object == null) {
|
||||
EWOL_CRITICAL("Request resource file : '" << TmpFilename << "' With the wrong type (dynamic cast error)");
|
||||
EWOL_CRITICAL("Request resource file : '" << tmpFilename << "' With the wrong type (dynamic cast error)");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
if (object != null) {
|
||||
return object;
|
||||
}
|
||||
EWOL_INFO("CREATE: ImageDF: '" << TmpFilename << "' size=" << _size);
|
||||
EWOL_INFO("CREATE: ImageDF: '" << tmpFilename << "' size=" << _size);
|
||||
// need to crate a new one ...
|
||||
object = ememory::SharedPtr<ewol::resource::ImageDF>(ETK_NEW(ewol::resource::ImageDF));
|
||||
if (object == null) {
|
||||
EWOL_ERROR("allocation error of a resource : " << _filename);
|
||||
EWOL_ERROR("allocation error of a resource : " << _uri);
|
||||
return null;
|
||||
}
|
||||
object->init("DF__" + TmpFilename, _filename, _size);
|
||||
object->init("DF__" + tmpFilename.getString(), _uri, _size);
|
||||
getManager().localAdd(object);
|
||||
return object;
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ namespace ewol {
|
||||
* @param[in] _requested size of the image (usefull when loading .svg to automatic rescale)
|
||||
* @return pointer on the resource or null if an error occured.
|
||||
*/
|
||||
static ememory::SharedPtr<ewol::resource::ImageDF> create(const etk::String& _filename, ivec2 _size=ivec2(-1,-1));
|
||||
static ememory::SharedPtr<ewol::resource::ImageDF> create(const etk::Uri& _uri, ivec2 _size=ivec2(-1,-1));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -58,9 +58,9 @@ void ewol::resource::TextureFile::init(etk::String _genName, const etk::Uri& _ur
|
||||
#endif
|
||||
}
|
||||
|
||||
ememory::SharedPtr<ewol::resource::TextureFile> ewol::resource::TextureFile::create(const etk::String& _filename, ivec2 _size, ivec2 _sizeRegister) {
|
||||
EWOL_VERBOSE("KEEP: TextureFile: '" << _filename << "' size=" << _size << " sizeRegister=" << _sizeRegister);
|
||||
if (_filename == "") {
|
||||
ememory::SharedPtr<ewol::resource::TextureFile> ewol::resource::TextureFile::create(const etk::Uri& _uri, ivec2 _size, ivec2 _sizeRegister) {
|
||||
EWOL_VERBOSE("KEEP: TextureFile: '" << _uri << "' size=" << _size << " sizeRegister=" << _sizeRegister);
|
||||
if (_uri.isEmpty() == true) {
|
||||
ememory::SharedPtr<ewol::resource::TextureFile> object(ETK_NEW(ewol::resource::TextureFile));
|
||||
if (object == null) {
|
||||
EWOL_ERROR("allocation error of a resource : ??TEX??");
|
||||
@ -78,8 +78,8 @@ ememory::SharedPtr<ewol::resource::TextureFile> ewol::resource::TextureFile::cre
|
||||
_size.setY(-1);
|
||||
//EWOL_ERROR("Error Request the image size.y() =0 ???");
|
||||
}
|
||||
etk::String tmpFilename = _filename;
|
||||
if (etk::end_with(_filename, ".svg") == false) {
|
||||
etk::Uri tmpFilename = _uri;
|
||||
if (etk::toLower(_uri.getPath().getExtention()) != "svg") {
|
||||
_size = ewol::resource::TextureFile::sizeAuto;
|
||||
}
|
||||
if (_size.x()>0 && _size.y()>0) {
|
||||
@ -87,17 +87,15 @@ ememory::SharedPtr<ewol::resource::TextureFile> ewol::resource::TextureFile::cre
|
||||
_size.setValue(nextP2(_size.x()), nextP2(_size.y()));
|
||||
if (_sizeRegister != ewol::resource::TextureFile::sizeAuto) {
|
||||
if (_sizeRegister != ewol::resource::TextureFile::sizeDefault) {
|
||||
tmpFilename += ":";
|
||||
tmpFilename += etk::toString(_size.x());
|
||||
tmpFilename += "x";
|
||||
tmpFilename += etk::toString(_size.y());
|
||||
tmpFilename.getQuery().set("x", etk::toString(_size.x()));
|
||||
tmpFilename.getQuery().set("y", etk::toString(_size.y()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EWOL_VERBOSE("KEEP: TextureFile: '" << tmpFilename << "' new size=" << _size);
|
||||
ememory::SharedPtr<ewol::resource::TextureFile> object = null;
|
||||
ememory::SharedPtr<gale::Resource> object2 = getManager().localKeep(tmpFilename);
|
||||
ememory::SharedPtr<gale::Resource> object2 = getManager().localKeep(tmpFilename.getString());
|
||||
if (object2 != null) {
|
||||
object = ememory::dynamicPointerCast<ewol::resource::TextureFile>(object2);
|
||||
if (object == null) {
|
||||
@ -112,10 +110,10 @@ ememory::SharedPtr<ewol::resource::TextureFile> ewol::resource::TextureFile::cre
|
||||
// need to crate a new one ...
|
||||
object = ememory::SharedPtr<ewol::resource::TextureFile>(ETK_NEW(ewol::resource::TextureFile));
|
||||
if (object == null) {
|
||||
EWOL_ERROR("allocation error of a resource : " << _filename);
|
||||
EWOL_ERROR("allocation error of a resource : " << _uri);
|
||||
return null;
|
||||
}
|
||||
object->init(tmpFilename, _filename, _size);
|
||||
object->init(tmpFilename.getString(), _uri, _size);
|
||||
getManager().localAdd(object);
|
||||
return object;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ namespace ewol {
|
||||
* @param[in] _sizeRegister size register in named (When you preaload the images the size write here will be )
|
||||
* @return pointer on the resource or null if an error occured.
|
||||
*/
|
||||
static ememory::SharedPtr<ewol::resource::TextureFile> create(const etk::String& _filename,
|
||||
static ememory::SharedPtr<ewol::resource::TextureFile> create(const etk::Uri& _filename,
|
||||
ivec2 _size=ewol::resource::TextureFile::sizeAuto,
|
||||
ivec2 _sizeRegister=ewol::resource::TextureFile::sizeAuto);
|
||||
};
|
||||
|
@ -44,10 +44,10 @@ void ewol::widget::Image::init() {
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::widget::Image::set(const etk::String& _file, const gale::Dimension& _border) {
|
||||
EWOL_VERBOSE("Set Image : " << _file << " border=" << _border);
|
||||
void ewol::widget::Image::set(const etk::Uri& _uri, const gale::Dimension& _border) {
|
||||
EWOL_VERBOSE("Set Image : " << _uri << " border=" << _border);
|
||||
propertyBorder.set(_border);
|
||||
propertySource.set(_file);
|
||||
propertySource.set(_uri);
|
||||
}
|
||||
|
||||
void ewol::widget::Image::setCustumSource(const egami::Image& _image) {
|
||||
|
@ -25,7 +25,7 @@ namespace ewol {
|
||||
public: // signals
|
||||
esignal::Signal<> signalPressed;
|
||||
public: // properties
|
||||
eproperty::Value<etk::String> propertySource; //!< file name of the image.
|
||||
eproperty::Value<etk::Uri> propertySource; //!< file name of the image.
|
||||
eproperty::Value<gale::Dimension> propertyBorder; //!< border to add at the image.
|
||||
eproperty::Value<gale::Dimension> propertyImageSize; //!< border to add at the image.
|
||||
eproperty::Value<bool> propertyKeepRatio; //!< keep the image ratio between width and hight
|
||||
@ -52,10 +52,10 @@ namespace ewol {
|
||||
virtual ~Image();
|
||||
/**
|
||||
* @brief set All the configuration of the current image
|
||||
* @param[in] _file Filaneme of the new image
|
||||
* @param[in] _uri URI of the new image
|
||||
* @param[in] _border New border size to set
|
||||
*/
|
||||
void set(const etk::String& _file, const gale::Dimension& _border);
|
||||
void set(const etk::Uri& _uri, const gale::Dimension& _border);
|
||||
/**
|
||||
* @brief Set an image with direct elements
|
||||
* @param[in] _image Image to set in the display
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
#include "BasicTree.hpp"
|
||||
#include <etk/tool.hpp>
|
||||
#include <etk/os/FSNode.hpp>
|
||||
#include <test-debug/debug.hpp>
|
||||
|
||||
#include <etk/typeInfo.hpp>
|
||||
|
@ -6,7 +6,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <ewol/widget/TreeView.hpp>
|
||||
#include <etk/os/FSNode.hpp>
|
||||
#include <ewol/resource/ColorFile.hpp>
|
||||
#include <esignal/Signal.hpp>
|
||||
#include <etk/FlatTree.hpp>
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include <test-debug/debug.hpp>
|
||||
#include <etk/Vector.hpp>
|
||||
#include <etk/String.hpp>
|
||||
#include <etk/os/FSNode.hpp>
|
||||
#include <etk/archive/Archive.hpp>
|
||||
#include <etk/etk.hpp>
|
||||
#include <etk/Color.hpp>
|
||||
|
@ -24,8 +24,6 @@
|
||||
#include <ewol/widget/Manager.hpp>
|
||||
#include <ewol/widget/Spin.hpp>
|
||||
#include <ewol/context/Context.hpp>
|
||||
#include <appl/TestDistanceField.hpp>
|
||||
#include <etk/os/FSNode.hpp>
|
||||
#include <eproperty/Value.hpp>
|
||||
|
||||
appl::MainWindows::MainWindows() {
|
||||
|
@ -6,15 +6,16 @@
|
||||
|
||||
#include <etk/types.hpp>
|
||||
#include <etk/types.hpp>
|
||||
#include <etk/os/FSNode.hpp>
|
||||
#include <ewol/ewol.hpp>
|
||||
#include <ewol/object/Object.hpp>
|
||||
#include <ewol/context/Context.hpp>
|
||||
#include <ewol/widget/Manager.hpp>
|
||||
#include <etk/theme/theme.hpp>
|
||||
|
||||
#include <appl/debug.hpp>
|
||||
#include <appl/MainWindows.hpp>
|
||||
#include <appl/widget/SizerColor.hpp>
|
||||
|
||||
namespace appl {
|
||||
class MainApplication : public ewol::context::Application {
|
||||
public:
|
||||
|
@ -64,5 +64,6 @@
|
||||
</button>
|
||||
<spacer expand="true,true"/>
|
||||
</sizer>
|
||||
<TestDistanceField expand="true,false" fill="true,true"/>
|
||||
</sizer>
|
||||
</composer>
|
||||
|
Loading…
x
Reference in New Issue
Block a user