[DEV] integarate std x11
This commit is contained in:
parent
ee8d484470
commit
5f26683625
@ -480,14 +480,14 @@ etk::CCout& agg::operator <<(etk::CCout &os, const struct agg::rgba8& obj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
etk::UString draw::getHexString(const draw::Color& color)
|
std::string draw::getHexString(const draw::Color& color)
|
||||||
{
|
{
|
||||||
char colorText[256];
|
char colorText[256];
|
||||||
sprintf(colorText, "0x%08X", color.Get());
|
sprintf(colorText, "0x%08X", color.Get());
|
||||||
return colorText;
|
return colorText;
|
||||||
}
|
}
|
||||||
|
|
||||||
etk::UString draw::getString(const draw::Color& color)
|
std::string draw::getString(const draw::Color& color)
|
||||||
{
|
{
|
||||||
char colorText[256];
|
char colorText[256];
|
||||||
sprintf(colorText, "#%08X", color.Get());
|
sprintf(colorText, "#%08X", color.Get());
|
||||||
|
@ -84,8 +84,8 @@ namespace draw {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void parseColor(const char* _input, struct agg::rgba8& color);
|
void parseColor(const char* _input, struct agg::rgba8& color);
|
||||||
etk::UString getHexString(const draw::Color& color);
|
std::string getHexString(const draw::Color& color);
|
||||||
etk::UString getString(const draw::Color& color);
|
std::string getString(const draw::Color& color);
|
||||||
|
|
||||||
namespace color {
|
namespace color {
|
||||||
extern const Color none;
|
extern const Color none;
|
||||||
|
@ -57,7 +57,7 @@ void draw::Image::init(void)
|
|||||||
// basic element :
|
// basic element :
|
||||||
draw::Color tmpBg(0,0,0,0);
|
draw::Color tmpBg(0,0,0,0);
|
||||||
// preallocate data with a basic bg elements :
|
// 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 (m_size.x()*m_size.y() > m_data.size()) {
|
if (m_size.x()*m_size.y() > m_data.size()) {
|
||||||
DRAW_ERROR("Allocation of data buffer in error");
|
DRAW_ERROR("Allocation of data buffer in error");
|
||||||
return;
|
return;
|
||||||
@ -142,7 +142,7 @@ void draw::Image::resize(ivec2 size)
|
|||||||
// basic element :
|
// basic element :
|
||||||
draw::Color tmpBg(0,0,0,0);
|
draw::Color tmpBg(0,0,0,0);
|
||||||
// preallocate data with a basic bg elements :
|
// 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 (m_size.x()*m_size.y() > m_data.size()) {
|
if (m_size.x()*m_size.y() > m_data.size()) {
|
||||||
DRAW_ERROR("Allocation of data buffer in error");
|
DRAW_ERROR("Allocation of data buffer in error");
|
||||||
return;
|
return;
|
||||||
@ -231,7 +231,7 @@ void draw::Image::dot(vec2 pos)
|
|||||||
/*
|
/*
|
||||||
Begin();
|
Begin();
|
||||||
MoveTo(pos);
|
MoveTo(pos);
|
||||||
LineTo(pos+etk::Vector2D<float>(1,1));
|
LineTo(pos+std::vector2D<float>(1,1));
|
||||||
End();
|
End();
|
||||||
*/
|
*/
|
||||||
set(pos, m_fillColor);
|
set(pos, m_fillColor);
|
||||||
@ -321,7 +321,7 @@ void draw::Image::distanceField(ivec2 pos, ivec2 size, int32_t upscaler, int32_t
|
|||||||
{
|
{
|
||||||
#ifndef BASIC_GRADIENT
|
#ifndef BASIC_GRADIENT
|
||||||
float maxVal = 1/(1000.0*sqrtf(META_DIST*META_DIST+META_DIST*META_DIST));
|
float maxVal = 1/(1000.0*sqrtf(META_DIST*META_DIST+META_DIST*META_DIST));
|
||||||
etk::Vector2D<int32_t> tmpPos;
|
std::vector2D<int32_t> tmpPos;
|
||||||
// generate distance system ... matrix ...
|
// generate distance system ... matrix ...
|
||||||
Grid grid2(ivec2(META_DIST*2,META_DIST*2));
|
Grid grid2(ivec2(META_DIST*2,META_DIST*2));
|
||||||
for(tmpPos.setY(0) ; tmpPos.y()<META_DIST*2 ; tmpPos+=vec2(0,1) ) {
|
for(tmpPos.setY(0) ; tmpPos.y()<META_DIST*2 ; tmpPos+=vec2(0,1) ) {
|
||||||
|
34
draw/Image.h
34
draw/Image.h
@ -26,7 +26,7 @@
|
|||||||
#define __DRAW_IMAGE_H__
|
#define __DRAW_IMAGE_H__
|
||||||
|
|
||||||
#include <etk/types.h>
|
#include <etk/types.h>
|
||||||
#include <etk/Vector.h>
|
#include <vector>
|
||||||
#include <etk/math/Vector2D.h>
|
#include <etk/math/Vector2D.h>
|
||||||
#include <draw/debug.h>
|
#include <draw/debug.h>
|
||||||
#include <draw/Color.h>
|
#include <draw/Color.h>
|
||||||
@ -49,8 +49,8 @@
|
|||||||
class Grid
|
class Grid
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
etk::Vector2D<int32_t> m_size;
|
std::vector2D<int32_t> m_size;
|
||||||
etk::Vector<int32_t> m_data;
|
std::vector<int32_t> m_data;
|
||||||
int32_t m_outsideVal;
|
int32_t m_outsideVal;
|
||||||
int32_t m_errorVal;
|
int32_t m_errorVal;
|
||||||
Grid(ivec2 _size) {
|
Grid(ivec2 _size) {
|
||||||
@ -60,7 +60,7 @@ class Grid
|
|||||||
// basic element :
|
// basic element :
|
||||||
int32_t tmpPoint = 0;
|
int32_t tmpPoint = 0;
|
||||||
// preallocate data with a basic bg elements :
|
// preallocate data with a basic bg elements :
|
||||||
m_data.reSize(m_size.x()*m_size.y(), tmpPoint);
|
m_data.resize(m_size.x()*m_size.y(), tmpPoint);
|
||||||
};
|
};
|
||||||
~Grid(void) { };
|
~Grid(void) { };
|
||||||
void setOutsideVal(int32_t _newVal) {
|
void setOutsideVal(int32_t _newVal) {
|
||||||
@ -69,20 +69,20 @@ class Grid
|
|||||||
void setErrorVal(int32_t _newVal) {
|
void setErrorVal(int32_t _newVal) {
|
||||||
m_errorVal = _newVal;
|
m_errorVal = _newVal;
|
||||||
}
|
}
|
||||||
void setInide(etk::Vector2D<int32_t> _pos) {
|
void setInide(std::vector2D<int32_t> _pos) {
|
||||||
if( _pos.x()>=0 && _pos.x()<m_size.x()
|
if( _pos.x()>=0 && _pos.x()<m_size.x()
|
||||||
&& _pos.y()>=0 && _pos.y()<m_size.y()) {
|
&& _pos.y()>=0 && _pos.y()<m_size.y()) {
|
||||||
m_data[_pos.x()+_pos.y()*m_size.x()]=0;
|
m_data[_pos.x()+_pos.y()*m_size.x()]=0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
void setOutside(etk::Vector2D<int32_t> _pos) {
|
void setOutside(std::vector2D<int32_t> _pos) {
|
||||||
if( _pos.x()>=0 && _pos.x()<m_size.x()
|
if( _pos.x()>=0 && _pos.x()<m_size.x()
|
||||||
&& _pos.y()>=0 && _pos.y()<m_size.y()) {
|
&& _pos.y()>=0 && _pos.y()<m_size.y()) {
|
||||||
m_data[_pos.x()+_pos.y()*m_size.x()]=m_outsideVal;
|
m_data[_pos.x()+_pos.y()*m_size.x()]=m_outsideVal;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
int32_t get(etk::Vector2D<int32_t> _pos) {
|
int32_t get(std::vector2D<int32_t> _pos) {
|
||||||
;
|
;
|
||||||
if( _pos.x()>0 && _pos.x()<m_size.x()
|
if( _pos.x()>0 && _pos.x()<m_size.x()
|
||||||
&& _pos.y()>0 && _pos.y()<m_size.y()) {
|
&& _pos.y()>0 && _pos.y()<m_size.y()) {
|
||||||
@ -91,7 +91,7 @@ class Grid
|
|||||||
return m_errorVal;
|
return m_errorVal;
|
||||||
};
|
};
|
||||||
|
|
||||||
void set(etk::Vector2D<int32_t> _pos, int32_t _val) {
|
void set(std::vector2D<int32_t> _pos, int32_t _val) {
|
||||||
if( _pos.x()>0 && _pos.x()<m_size.x()
|
if( _pos.x()>0 && _pos.x()<m_size.x()
|
||||||
&& _pos.y()>0 && _pos.y()<m_size.y()) {
|
&& _pos.y()>0 && _pos.y()<m_size.y()) {
|
||||||
m_data[_pos.x()+_pos.y()*m_size.x()] = _val;
|
m_data[_pos.x()+_pos.y()*m_size.x()] = _val;
|
||||||
@ -103,7 +103,7 @@ class Grid
|
|||||||
class Grid {
|
class Grid {
|
||||||
public:
|
public:
|
||||||
ivec2 m_size;
|
ivec2 m_size;
|
||||||
etk::Vector<ivec2> m_data;
|
std::vector<ivec2> m_data;
|
||||||
int32_t m_outsideVal;
|
int32_t m_outsideVal;
|
||||||
int32_t m_errorVal;
|
int32_t m_errorVal;
|
||||||
Grid(ivec2 _size) {
|
Grid(ivec2 _size) {
|
||||||
@ -111,9 +111,9 @@ class Grid {
|
|||||||
m_outsideVal = 20;
|
m_outsideVal = 20;
|
||||||
m_errorVal = 0;
|
m_errorVal = 0;
|
||||||
// basic element :
|
// basic element :
|
||||||
etk::Vector2D<int32_t> tmpPoint(0,0);
|
ivec2 tmpPoint(0,0);
|
||||||
// preallocate data with a basic bg elements :
|
// preallocate data with a basic bg elements :
|
||||||
m_data.reSize(m_size.x()*m_size.y(), tmpPoint);
|
m_data.resize(m_size.x()*m_size.y(), tmpPoint);
|
||||||
};
|
};
|
||||||
~Grid(void) { };
|
~Grid(void) { };
|
||||||
void setOutsideVal(int32_t _newVal) {
|
void setOutsideVal(int32_t _newVal) {
|
||||||
@ -142,7 +142,7 @@ class Grid {
|
|||||||
// && _pos.y>0 && _pos.y<m_size.y) {
|
// && _pos.y>0 && _pos.y<m_size.y) {
|
||||||
return m_data[_pos.x()+_pos.y()*m_size.x()];
|
return m_data[_pos.x()+_pos.y()*m_size.x()];
|
||||||
//}
|
//}
|
||||||
//return etk::Vector2D<int32_t>(m_errorVal,m_errorVal);
|
//return std::vector2D<int32_t>(m_errorVal,m_errorVal);
|
||||||
};
|
};
|
||||||
|
|
||||||
void set(ivec2 _pos, ivec2 _val) {
|
void set(ivec2 _pos, ivec2 _val) {
|
||||||
@ -175,7 +175,7 @@ namespace draw
|
|||||||
class Image {
|
class Image {
|
||||||
private:
|
private:
|
||||||
ivec2 m_size;
|
ivec2 m_size;
|
||||||
etk::Vector<draw::Color> m_data;
|
std::vector<draw::Color> m_data;
|
||||||
agg::rendering_buffer * m_renderingBuffer;
|
agg::rendering_buffer * m_renderingBuffer;
|
||||||
agg::pixfmt_rgba32 * m_pixFrame;
|
agg::pixfmt_rgba32 * m_pixFrame;
|
||||||
rendererBase_t * m_renderBase;
|
rendererBase_t * m_renderBase;
|
||||||
@ -204,7 +204,7 @@ namespace draw
|
|||||||
// -----------------------------------------------
|
// -----------------------------------------------
|
||||||
public :
|
public :
|
||||||
void resize(ivec2 size);
|
void resize(ivec2 size);
|
||||||
//void Resize(etk::Vector2D<int32_t> startPos, Vector2D<int32_t> size);
|
//void Resize(std::vector2D<int32_t> startPos, Vector2D<int32_t> size);
|
||||||
|
|
||||||
ivec2 getSize(void) const {
|
ivec2 getSize(void) const {
|
||||||
return m_size;
|
return m_size;
|
||||||
@ -216,7 +216,7 @@ namespace draw
|
|||||||
return m_size.y();
|
return m_size.y();
|
||||||
};
|
};
|
||||||
|
|
||||||
//void Move(etk::Vector2D<int32_t> pos);
|
//void Move(std::vector2D<int32_t> pos);
|
||||||
|
|
||||||
//void Rotate(float angle); // radian
|
//void Rotate(float angle); // radian
|
||||||
|
|
||||||
@ -249,9 +249,9 @@ namespace draw
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Image getSubImage(etk::Vector2D<int32_t> startPos, Vector2D<int32_t> size) const;
|
//Image getSubImage(std::vector2D<int32_t> startPos, Vector2D<int32_t> size) const;
|
||||||
|
|
||||||
//void setData(uint8_t *data, etk::Vector2D<int32_t> size);
|
//void setData(uint8_t *data, std::vector2D<int32_t> size);
|
||||||
|
|
||||||
// -----------------------------------------------
|
// -----------------------------------------------
|
||||||
// -- drawing tools :
|
// -- drawing tools :
|
||||||
|
Loading…
x
Reference in New Issue
Block a user