From ed0661317bb59183336d11b13f76025bdf08bb34 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Thu, 3 Oct 2013 23:14:00 +0200 Subject: [PATCH] [DEV] change coding style --- draw/Color.cpp | 16 +++++----- draw/Color.h | 8 ++--- draw/Image.cpp | 86 +++++++++++++++++++++++++------------------------- draw/Image.h | 60 +++++++++++++++++------------------ 4 files changed, 85 insertions(+), 85 deletions(-) diff --git a/draw/Color.cpp b/draw/Color.cpp index 954e47d..946f787 100644 --- a/draw/Color.cpp +++ b/draw/Color.cpp @@ -1,7 +1,7 @@ /** ******************************************************************************* * @file draw/Color.h - * @brief Ewol Tool Kit : basic colors + * @brief Ewol tool Kit : basic colors * @author Edouard DUPIN * @date 23/04/2012 * @par Project @@ -362,7 +362,7 @@ static bool strnCmpNoCase(const char * input1, const char * input2, int32_t maxL -void draw::ParseColor(const char* _input, struct agg::rgba8& color) +void draw::parseColor(const char* _input, struct agg::rgba8& color) { color = draw::color::white; if (NULL == _input) { @@ -385,7 +385,7 @@ void draw::ParseColor(const char* _input, struct agg::rgba8& color) } else { TK_ERROR(" pb in parsing the color : \"" << inputData << "\""); } - } else if (len==5) { + } else if (len == 5) { int32_t red=0, green=0, blue=0, alpha=0; if (sscanf(inputData + 1, "%1x%1x%1x%1x", &red, &green, &blue, &alpha) == 4) { color.r = (red | red << 4); @@ -415,7 +415,7 @@ void draw::ParseColor(const char* _input, struct agg::rgba8& color) TK_ERROR(" pb in parsing the color : \"" << inputData << "\""); } } else { - TK_ERROR(" pb in parsing the color : \"" << inputData << "\" ==> unknown methode ..."); + TK_ERROR(" pb in parsing the color : \"" << inputData << "\" == > unknown methode ..."); } } else if( 4 <= len && inputData[0] == 'r' @@ -450,7 +450,7 @@ void draw::ParseColor(const char* _input, struct agg::rgba8& color) color.g = (uint8_t)(fgreen * 255.); color.b = (uint8_t)(fblue * 255.); } else { - TK_ERROR(" pb in parsing the color : \"" << inputData << "\" ==> unknown methode ..."); + TK_ERROR(" pb in parsing the color : \"" << inputData << "\" == > unknown methode ..."); } } else { bool findIt = false; @@ -468,7 +468,7 @@ void draw::ParseColor(const char* _input, struct agg::rgba8& color) TK_ERROR(" pb in parsing the color : \"" << inputData << "\" not find ..."); } } - TK_VERBOSE("Parse color : \"" << inputData << "\" ==> " << color); + TK_VERBOSE("Parse color : \"" << inputData << "\" == > " << color); } etk::CCout& agg::operator <<(etk::CCout &os, const struct agg::rgba8& obj) @@ -480,14 +480,14 @@ etk::CCout& agg::operator <<(etk::CCout &os, const struct agg::rgba8& obj) } -etk::UString draw::GetHexString(const draw::Color& color) +etk::UString draw::getHexString(const draw::Color& color) { char colorText[256]; sprintf(colorText, "0x%08X", color.Get()); return colorText; } -etk::UString draw::GetString(const draw::Color& color) +etk::UString draw::getString(const draw::Color& color) { char colorText[256]; sprintf(colorText, "#%08X", color.Get()); diff --git a/draw/Color.h b/draw/Color.h index 86a80c6..1ee74cb 100644 --- a/draw/Color.h +++ b/draw/Color.h @@ -1,7 +1,7 @@ /** ******************************************************************************* * @file draw/Color.h - * @brief Ewol Tool Kit : basic colors + * @brief Ewol tool Kit : basic colors * @author Edouard DUPIN * @date 23/04/2012 * @par Project @@ -83,9 +83,9 @@ namespace draw { }; }; - void ParseColor(const char* _input, struct agg::rgba8& color); - etk::UString GetHexString(const draw::Color& color); - etk::UString GetString(const draw::Color& color); + void parseColor(const char* _input, struct agg::rgba8& color); + etk::UString getHexString(const draw::Color& color); + etk::UString getString(const draw::Color& color); namespace color { extern const Color none; diff --git a/draw/Image.cpp b/draw/Image.cpp index 565c881..2aa8412 100644 --- a/draw/Image.cpp +++ b/draw/Image.cpp @@ -57,8 +57,8 @@ void draw::Image::Init(void) // basic element : draw::Color tmpBg(0,0,0,0); // preallocate data with a basic bg elements : - m_data.ReSize(m_size.x()*m_size.y(), tmpBg); - if (m_size.x()*m_size.y() > m_data.Size()) { + m_data.reSize(m_size.x()*m_size.y(), tmpBg); + if (m_size.x()*m_size.y() > m_data.size()) { DRAW_ERROR("Allocation of data buffer in error"); return; } @@ -142,8 +142,8 @@ void draw::Image::Resize(ivec2 size) // basic element : draw::Color tmpBg(0,0,0,0); // preallocate data with a basic bg elements : - m_data.ReSize(m_size.x()*m_size.y(), tmpBg); - if (m_size.x()*m_size.y() > m_data.Size()) { + m_data.reSize(m_size.x()*m_size.y(), tmpBg); + if (m_size.x()*m_size.y() > m_data.size()) { DRAW_ERROR("Allocation of data buffer in error"); return; } @@ -221,7 +221,7 @@ void draw::Image::Join(void) } // generate the display -void draw::Image::Draw(void) +void draw::Image::draw(void) { } @@ -234,7 +234,7 @@ void draw::Image::Dot(vec2 pos) LineTo(pos+etk::Vector2D(1,1)); End(); */ - Set(pos, m_fillColor); + set(pos, m_fillColor); } void draw::Image::Line(vec2 posStart, vec2 posEnd) @@ -271,39 +271,39 @@ void draw::Image::Disc(vec2 pos, float radius, float angleStart, float angleStop } #ifdef BASIC_GRADIENT -void Grid::GenerateSDF() +void Grid::generateSDF() { // Pass 0 ivec2 tmpPos(1,1); for (tmpPos.setY(1) ; tmpPos.y()0 ; tmpPos-=vec2(1,0) ) { - ivec2 p = Get(tmpPos); + ivec2 p = get(tmpPos); Compare(p, tmpPos, 1, 0 ); - Set(tmpPos, p ); + set(tmpPos, p ); } } // Pass 1 for (tmpPos.setY(m_size.y()-2) ; tmpPos.y()>0 ; tmpPos-=vec2(0,1)) { for (tmpPos.setX(m_size.x()-2) ; tmpPos.x()>1 ; tmpPos-=vec2(1,0)) { - ivec2 p = Get(tmpPos); + ivec2 p = get(tmpPos); Compare(p, tmpPos, 1, 0 ); Compare(p, tmpPos, 0, 1 ); Compare(p, tmpPos, -1, 1 ); Compare(p, tmpPos, 1, 1 ); - Set(tmpPos, p); + set(tmpPos, p); } for (tmpPos.setX(1) ; tmpPos.x() tmpDist) { newDist = tmpDist; } @@ -366,47 +366,47 @@ void draw::Image::DistanceField(ivec2 pos, ivec2 size, int32_t upscaler, int32_t } } // set the finded distance : - draw::Color tmpColor = Get(pos+tmpPos); + draw::Color tmpColor = get(pos+tmpPos); float tmpValue = ((1.0-((float)newDist * maxVal)) * 0.5) * 128.0; if (tmpColor.a<=0x7F) { tmpColor.a = etk_avg(0, tmpValue, 255); } else { tmpColor.a = etk_avg(0, 255-tmpValue, 255); } - Set(pos+tmpPos, tmpColor); + set(pos+tmpPos, tmpColor); } } #else Grid grid1(size); Grid grid2(size); - grid1.SetOutsideVal(500000); - grid2.SetOutsideVal(500000); - grid1.SetErrorVal(0); - grid2.SetErrorVal(500000); + grid1.setOutsideVal(500000); + grid2.setOutsideVal(500000); + grid1.setErrorVal(0); + grid2.setErrorVal(500000); ivec2 tmpPos; for(tmpPos.setY(0) ; tmpPos.y() " << (dist*3 + 128)); + DRAW_DEBUG( "generate Distance : " << dist1 << "," << dist2 << " == > " << (dist*3 + 128)); } else if (tmpPos.x == 32) { DRAW_DEBUG( " ---" ); } } */ - draw::Color tmpColor = Get(pos+tmpPos); + draw::Color tmpColor = get(pos+tmpPos); // Clamp and scale it, just for display purposes. tmpColor.a = etk_avg(0, (dist*3 + 128), 255); - Set(pos+tmpPos, tmpColor); + set(pos+tmpPos, tmpColor); } } #endif diff --git a/draw/Image.h b/draw/Image.h index 85387b2..4f912a8 100644 --- a/draw/Image.h +++ b/draw/Image.h @@ -61,25 +61,25 @@ class Grid // basic element : int32_t tmpPoint = 0; // 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) { }; - void SetOutsideVal(int32_t newVal) + void setOutsideVal(int32_t newVal) { m_outsideVal = newVal; } - void SetErrorVal(int32_t newVal) + void setErrorVal(int32_t newVal) { m_errorVal = newVal; } - void SetInide(etk::Vector2D pos) + void setInide(etk::Vector2D pos) { if( pos.x()>=0 && pos.x()=0 && pos.y() pos) + void setOutside(etk::Vector2D pos) { if( pos.x()>=0 && pos.x()=0 && pos.y() pos) + int32_t get(etk::Vector2D pos) { ; if( pos.x()>0 && pos.x() pos, int32_t val) + void set(etk::Vector2D pos, int32_t val) { if( pos.x()>0 && pos.x()0 && pos.y() tmpPoint(0,0); // 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) { }; - void SetOutsideVal(int32_t newVal) + void setOutsideVal(int32_t newVal) { m_outsideVal = newVal; } - void SetErrorVal(int32_t newVal) + void setErrorVal(int32_t newVal) { m_errorVal = newVal; } - void SetInide(ivec2 pos) + void setInide(ivec2 pos) { //if( pos.x>=0 && pos.x=0 && pos.y=0 && pos.x=0 && pos.y0 && pos.x0 && pos.y(m_errorVal,m_errorVal); }; - void Set(ivec2 pos, ivec2 val) + void set(ivec2 pos, ivec2 val) { //if( pos.x>0 && pos.x0 && pos.y startPos, Vector2D size); - ivec2 GetSize(void) const + ivec2 getSize(void) const { return m_size; }; - int32_t GetWidth(void) const + int32_t getWidth(void) const { return m_size.x(); }; - int32_t GetHeight(void) const + int32_t getHeight(void) const { return m_size.y(); }; @@ -242,7 +242,7 @@ namespace draw //void Zoom(float coefficient); - void Clear(void) + void clear(void) { for (int32_t iii=0; iii0 && pos.x()=0 && pos.x()=0 && pos.y() startPos, Vector2D size) const; + //Image getSubImage(etk::Vector2D startPos, Vector2D size) const; - //void SetData(uint8_t *data, etk::Vector2D size); + //void setData(uint8_t *data, etk::Vector2D size); // ----------------------------------------------- - // -- Drawing tools : + // -- drawing tools : // ----------------------------------------------- public : void Begin(void); void End(void); - void SetFillColor(draw::Color newColor) { + void setFillColor(draw::Color newColor) { m_fillColor = newColor; } - void SetStrokeColor(draw::Color newColor) { + void setStrokeColor(draw::Color newColor) { m_strokeColor = newColor; } - void SetStrokeSize(float thickness) { + void setStrokeSize(float thickness) { m_strokeSize = thickness; } void MoveTo(vec2 pos); @@ -295,7 +295,7 @@ namespace draw void LineTo(vec2 pos); void LineToAbs(vec2 pos); void Join(void); - void Draw(void); + void draw(void); void Line(vec2 posStart, vec2 posEnd); void Dot(vec2 pos);