Correction of the trueType FONT display and add circle display of EOL files
This commit is contained in:
parent
eddb65de56
commit
2ea7bc27d2
@ -300,8 +300,8 @@ class FTFontInternal
|
||||
listElement[iii].width = glyphMaxWidth;
|
||||
listElement[iii].posStart.u = (etkFloat_t)(tmpRowId *glyphMaxWidth) / (etkFloat_t)textureWidth;
|
||||
listElement[iii].posStart.v = (etkFloat_t)(tmpLineId*glyphMaxHeight) / (etkFloat_t)textureHeight;
|
||||
listElement[iii].posStop.u = (etkFloat_t)(tmpRowId *glyphMaxWidth + glyphMaxWidth ) / (etkFloat_t)textureWidth;
|
||||
listElement[iii].posStop.v = (etkFloat_t)(tmpLineId*glyphMaxHeight + glyphMaxHeight ) / (etkFloat_t)textureHeight;
|
||||
listElement[iii].posStop.u = (etkFloat_t)(tmpRowId *glyphMaxWidth + glyphMaxWidth) / (etkFloat_t)textureWidth;
|
||||
listElement[iii].posStop.v = (etkFloat_t)(tmpLineId*glyphMaxHeight + glyphMaxHeight + 1) / (etkFloat_t)textureHeight;
|
||||
}
|
||||
// Now We Just Setup Some Texture Parameters.
|
||||
glBindTexture( GL_TEXTURE_2D, textureId);
|
||||
@ -495,7 +495,7 @@ void ewol::DrawText(int32_t fontID,
|
||||
etk::VectorType<freeTypeFontElement_ts> & listOfElement = m_listLoadedFont[fontID]->GetRefOnElement();
|
||||
|
||||
fontTextureId = m_listLoadedFont[fontID]->GetOglId();
|
||||
int32_t size = m_listLoadedFont[fontID]->GetSize();
|
||||
int32_t size = m_listLoadedFont[fontID]->GetHeight();
|
||||
|
||||
etkFloat_t posDrawX = drawPosition.x;
|
||||
while(*unicodeString != 0) {
|
||||
@ -533,7 +533,6 @@ void ewol::DrawText(int32_t fontID,
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ewol::DrawText(int32_t fontID,
|
||||
coord2D_ts & drawPosition,
|
||||
const char * utf8String,
|
||||
@ -563,7 +562,7 @@ void ewol::DrawText(int32_t fontID,
|
||||
char * tmpVal = (char*)utf8String;
|
||||
|
||||
fontTextureId = m_listLoadedFont[fontID]->GetOglId();
|
||||
int32_t size = m_listLoadedFont[fontID]->GetSize();
|
||||
int32_t size = m_listLoadedFont[fontID]->GetHeight();
|
||||
|
||||
etkFloat_t posDrawX = drawPosition.x;
|
||||
while(*tmpVal != 0) {
|
||||
@ -599,6 +598,8 @@ void ewol::DrawText(int32_t fontID,
|
||||
tmpTex.v = listOfElement[charIndex].posStop.v;
|
||||
coordTex.PushBack(tmpTex);
|
||||
// set display positions :
|
||||
/*int32_t xxxx = posDrawX;
|
||||
int32_t yyyy = drawPosition.y;*/
|
||||
coord2D_ts tmpCoord;
|
||||
tmpCoord.x = posDrawX;
|
||||
tmpCoord.y = drawPosition.y;
|
||||
|
@ -22,7 +22,98 @@
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#include <ewol/theme/Theme.h>
|
||||
#include <ewol/theme/EolBaseCircle.h>
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "ewol::theme::EolBaseCircle"
|
||||
|
||||
|
||||
|
||||
ewol::theme::EolBaseCircle::EolBaseCircle(void)
|
||||
{
|
||||
//EWOL_DEBUG("new element Base : Circle/Disk ...");
|
||||
}
|
||||
|
||||
ewol::theme::EolBaseCircle::~EolBaseCircle(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ewol::theme::EolBaseCircle::Parse(TiXmlNode * pNode)
|
||||
{
|
||||
m_colorBG = pNode->ToElement()->Attribute("colorBG");
|
||||
m_colorBorder = pNode->ToElement()->Attribute("colorBorder");
|
||||
|
||||
const char * tmp = pNode->ToElement()->Attribute("position");
|
||||
if (NULL == tmp) {
|
||||
m_posCenter.x=0;
|
||||
m_posCenter.y=0;
|
||||
} else {
|
||||
double xxx,yyy;
|
||||
// optimize for multiple type input ...
|
||||
sscanf(tmp, "%lf;%lf", &xxx,&yyy);
|
||||
m_posCenter.x=xxx;
|
||||
m_posCenter.y=yyy;
|
||||
}
|
||||
|
||||
tmp = pNode->ToElement()->Attribute("radius");
|
||||
if (NULL == tmp) {
|
||||
m_radius=0;
|
||||
} else {
|
||||
double tmpVal;
|
||||
// optimize for multiple type input ...
|
||||
sscanf(tmp, "%lf", &tmpVal);
|
||||
m_radius=tmpVal;
|
||||
}
|
||||
|
||||
tmp = pNode->ToElement()->Attribute("thickness");
|
||||
if (NULL == tmp) {
|
||||
m_thickness=0.01;
|
||||
} else {
|
||||
double tmpVal;
|
||||
// optimize for multiple type input ...
|
||||
sscanf(tmp, "%lf", &tmpVal);
|
||||
m_thickness=tmpVal;
|
||||
}
|
||||
EWOL_DEBUG("(l " << pNode->Row() << ") Parse Base Element : \"Circle\" : pos(" << m_posCenter.x << "," << m_posCenter.y << ") radius=" << m_radius
|
||||
<< " colorBG=\"" << m_colorBG << "\" colorBorder=\"" << m_colorBorder << "\" thickness=" << m_thickness);
|
||||
}
|
||||
|
||||
|
||||
void ewol::theme::EolBaseCircle::Generate(const ewol::theme::Theme * myTheme, const ewol::theme::EolElement * myElement, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY)
|
||||
{
|
||||
if (m_colorBG != "") {
|
||||
color_ts selectedColorBG = {1.0, 1.0, 1.0, 1.0};
|
||||
bool res = false;
|
||||
if (NULL != myElement) {
|
||||
res = myElement->GetColor(m_colorBG, selectedColorBG);
|
||||
}
|
||||
// try from theme if not existed
|
||||
if( false == res
|
||||
&& NULL != myTheme ) {
|
||||
myElement->GetColor(m_colorBG, selectedColorBG);
|
||||
}
|
||||
newObject.SetColor(selectedColorBG);
|
||||
newObject.Disc(posX + m_posCenter.x*sizeX, posY + m_posCenter.y*sizeY, m_radius*(sizeX+sizeY)/2);
|
||||
}
|
||||
if (m_colorBorder != "") {
|
||||
color_ts selectedColorBorder = {0.0, 0.0, 0.0, 1.0};
|
||||
bool res = false;
|
||||
// try get color for current element
|
||||
if (NULL != myElement) {
|
||||
res = myElement->GetColor(m_colorBorder, selectedColorBorder);
|
||||
}
|
||||
// try from theme if not existed
|
||||
if( false == res
|
||||
&& NULL != myTheme ) {
|
||||
myElement->GetColor(m_colorBorder, selectedColorBorder);
|
||||
}
|
||||
newObject.SetColor(selectedColorBorder);
|
||||
newObject.Circle(posX + m_posCenter.x*sizeX, posY + m_posCenter.y*sizeY, m_radius*(sizeX+sizeY)/2, m_thickness*(sizeX+sizeY)/2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -23,9 +23,35 @@
|
||||
*/
|
||||
|
||||
#include <ewol/theme/EolBase.h>
|
||||
#include <ewol/theme/EolColor.h>
|
||||
|
||||
#ifndef __EWOL_THEME_EOL_BASE_CIRCLE_H__
|
||||
#define __EWOL_THEME_EOL_BASE_CIRCLE_H__
|
||||
|
||||
namespace ewol {
|
||||
namespace theme {
|
||||
class EolBaseCircle : public EolBase {
|
||||
public:
|
||||
EolBaseCircle(void);
|
||||
virtual ~EolBaseCircle(void);
|
||||
/*
|
||||
<circle colorBG="..." ==> generate condition to display background ...
|
||||
colorBorder="..." ==> generate condition to display border ...
|
||||
position="0.53;0.56"
|
||||
radius="0.2"
|
||||
thickness="0.05" ==> only if neededd by border, default 0.01
|
||||
/>
|
||||
*/
|
||||
virtual void Parse(TiXmlNode * pNode);
|
||||
virtual void Generate(const ewol::theme::Theme * myTheme, const ewol::theme::EolElement * myElement, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY);
|
||||
private:
|
||||
etk::String m_colorBG;
|
||||
etk::String m_colorBorder;
|
||||
coord2D_ts m_posCenter;
|
||||
etkFloat_t m_radius;
|
||||
etkFloat_t m_thickness;
|
||||
};
|
||||
};
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -68,12 +68,12 @@ void ewol::theme::EolBaseLine::Parse(TiXmlNode * pNode)
|
||||
}
|
||||
tmp = pNode->ToElement()->Attribute("thickness");
|
||||
if (NULL == tmp) {
|
||||
m_thickness=0;
|
||||
m_thickness=0.01;
|
||||
} else {
|
||||
double th;
|
||||
double tmpVal;
|
||||
// optimize for multiple type input ...
|
||||
sscanf(tmp, "%lf", &th);
|
||||
m_thickness=th;
|
||||
sscanf(tmp, "%lf", &tmpVal);
|
||||
m_thickness=tmpVal;
|
||||
}
|
||||
EWOL_DEBUG("(l " << pNode->Row() << ") Parse Base Element : \"line\" : pos(" << m_posStart.x << "," << m_posStart.y << ") to pos(" << m_posStop.x << "," << m_posStop.y << ") thickness=" << m_thickness);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ namespace ewol {
|
||||
EolBaseLine(void);
|
||||
virtual ~EolBaseLine(void);
|
||||
/*
|
||||
<Line color="..."
|
||||
<line color="..."
|
||||
positionStart="0.53;0.56"
|
||||
positionStop="0.22;0.11"
|
||||
thickness="0.05"
|
||||
|
@ -65,25 +65,52 @@ void ewol::theme::EolBaseRect::Parse(TiXmlNode * pNode)
|
||||
m_size.x=xxx;
|
||||
m_size.y=yyy;
|
||||
}
|
||||
m_color = pNode->ToElement()->Attribute("color");
|
||||
EWOL_DEBUG("(l " << pNode->Row() << ") Parse Base Element : \"rect\" : pos(" << m_position.x << "," << m_position.y << ") size(" << m_size.x << "," << m_size.y << ") colorName=\"" << m_color << "\"");
|
||||
tmp = pNode->ToElement()->Attribute("thickness");
|
||||
if (NULL == tmp) {
|
||||
m_thickness=0.01;
|
||||
} else {
|
||||
double tmpVal;
|
||||
// optimize for multiple type input ...
|
||||
sscanf(tmp, "%lf", &tmpVal);
|
||||
m_thickness=tmpVal;
|
||||
}
|
||||
m_colorBG = pNode->ToElement()->Attribute("colorBG");
|
||||
m_colorBorder = pNode->ToElement()->Attribute("colorBorder");
|
||||
EWOL_DEBUG("(l " << pNode->Row() << ") Parse Base Element : \"rect\" : pos(" << m_position.x << "," << m_position.y << ") "
|
||||
<< "size(" << m_size.x << "," << m_size.y << ") colorBG=\"" << m_colorBG << "\" colorBorder=\"" << m_colorBorder << "\" thickness=" << m_thickness);
|
||||
}
|
||||
|
||||
void ewol::theme::EolBaseRect::Generate(const ewol::theme::Theme * myTheme, const ewol::theme::EolElement * myElement, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY)
|
||||
{
|
||||
bool res = false;
|
||||
color_ts selectedColor = {0.0, 0.0, 0.0, 1.0};
|
||||
// try get color for current element
|
||||
if (NULL != myElement) {
|
||||
res = myElement->GetColor(m_color, selectedColor);
|
||||
if (m_colorBG != "") {
|
||||
color_ts selectedColorBG = {1.0, 1.0, 1.0, 1.0};
|
||||
bool res = false;
|
||||
if (NULL != myElement) {
|
||||
res = myElement->GetColor(m_colorBG, selectedColorBG);
|
||||
}
|
||||
// try from theme if not existed
|
||||
if( false == res
|
||||
&& NULL != myTheme ) {
|
||||
myElement->GetColor(m_colorBG, selectedColorBG);
|
||||
}
|
||||
newObject.SetColor(selectedColorBG);
|
||||
newObject.Rectangle(posX + m_position.x*sizeX, posY + m_position.y*sizeY, m_size.x*sizeX, m_size.y*sizeY);
|
||||
}
|
||||
// try from theme if not existed
|
||||
if( false == res
|
||||
&& NULL != myTheme ) {
|
||||
myElement->GetColor(m_color, selectedColor);
|
||||
if (m_colorBorder != "") {
|
||||
color_ts selectedColorBorder = {0.0, 0.0, 0.0, 1.0};
|
||||
bool res = false;
|
||||
// try get color for current element
|
||||
if (NULL != myElement) {
|
||||
res = myElement->GetColor(m_colorBorder, selectedColorBorder);
|
||||
}
|
||||
// try from theme if not existed
|
||||
if( false == res
|
||||
&& NULL != myTheme ) {
|
||||
myElement->GetColor(m_colorBorder, selectedColorBorder);
|
||||
}
|
||||
newObject.SetColor(selectedColorBorder);
|
||||
newObject.RectangleBorder(posX + m_position.x*sizeX, posY + m_position.y*sizeY, m_size.x*sizeX, m_size.y*sizeY, m_thickness*(sizeX+sizeY)/2);
|
||||
}
|
||||
newObject.SetColor(selectedColor);
|
||||
newObject.Rectangle(posX + m_position.x*sizeX, posY + m_position.y*sizeY, m_size.x*sizeX, m_size.y*sizeY);
|
||||
}
|
||||
|
||||
|
||||
|
@ -36,17 +36,21 @@ namespace ewol {
|
||||
EolBaseRect(void);
|
||||
virtual ~EolBaseRect(void);
|
||||
/*
|
||||
<rect color="..."
|
||||
<rect colorBG="..." ==> generate condition to display background ...
|
||||
colorBorder="..." ==> generate condition to display border ...
|
||||
position="0.53;0.56"
|
||||
size="0.22;0.11"
|
||||
thickness="0.05" ==> only if neededd by border, default 0.01
|
||||
/>
|
||||
*/
|
||||
virtual void Parse(TiXmlNode * pNode);
|
||||
virtual void Generate(const ewol::theme::Theme * myTheme, const ewol::theme::EolElement * myElement, ewol::OObject2DColored & newObject, etkFloat_t posX, etkFloat_t posY, etkFloat_t sizeX, etkFloat_t sizeY);
|
||||
private:
|
||||
etk::String m_color;
|
||||
etk::String m_colorBG;
|
||||
etk::String m_colorBorder;
|
||||
coord2D_ts m_position;
|
||||
coord2D_ts m_size;
|
||||
etkFloat_t m_thickness;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
@ -83,7 +83,11 @@ void ewol::theme::EolElementFrame::Parse(TiXmlNode * root)
|
||||
} else if (nodeValue == "polygone") {
|
||||
EWOL_WARNING("(l " << pNode->Row() << ") Not Parsed now : \"" << nodeValue <<"\"");
|
||||
} else if (nodeValue == "circle") {
|
||||
EWOL_WARNING("(l " << pNode->Row() << ") Not Parsed now : \"" << nodeValue <<"\"");
|
||||
//EWOL_INFO("Find baseElement Rectangle");
|
||||
myBaseTmp = new ewol::theme::EolBaseCircle();
|
||||
if (NULL == myBaseTmp) {
|
||||
EWOL_ERROR("(l " << pNode->Row() << ") Error Allocation : \"" << nodeValue <<"\"");
|
||||
}
|
||||
} else if (nodeValue == "circlePart") {
|
||||
EWOL_WARNING("(l " << pNode->Row() << ") Not Parsed now : \"" << nodeValue <<"\"");
|
||||
} else {
|
||||
|
@ -35,6 +35,10 @@
|
||||
#include <ewol/theme/EolBase.h>
|
||||
#include <ewol/theme/EolBaseLine.h>
|
||||
#include <ewol/theme/EolBaseRect.h>
|
||||
#include <ewol/theme/EolBaseCircle.h>
|
||||
#include <ewol/theme/EolBaseCirclePart.h>
|
||||
#include <ewol/theme/EolBaseTriangle.h>
|
||||
#include <ewol/theme/EolBasePolygone.h>
|
||||
|
||||
|
||||
namespace ewol {
|
||||
|
@ -121,7 +121,7 @@ void ewol::Button::OnRegenerateDisplay(void)
|
||||
int32_t fontWidth = ewol::GetWidth(fontId, m_label.c_str());
|
||||
int32_t posy = (m_size.y - fontHeight - 6)/2 + 3;
|
||||
int32_t posx = (m_size.x - fontWidth - 6)/2 + 3;
|
||||
tmpText->Text(posx+2, posy+3, m_label.c_str());
|
||||
tmpText->Text(posx+2, posy, m_label.c_str());
|
||||
|
||||
ewol::OObject2DColored * tmpOObjects = new ewol::OObject2DColored;
|
||||
int32_t radius = fontHeight / 2;
|
||||
|
@ -113,7 +113,7 @@ void ewol::CheckBox::OnRegenerateDisplay(void)
|
||||
//int32_t fontWidth = ewol::GetWidth(fontId, m_label.c_str());
|
||||
int32_t posy = (m_size.y - fontHeight - 6)/2 + 3;
|
||||
//int32_t posx = (m_size.x - fontWidth - 6)/2 + 25;
|
||||
tmpText->Text(25, posy+3, m_label.c_str());
|
||||
tmpText->Text(25, posy, m_label.c_str());
|
||||
|
||||
|
||||
ewol::OObject2DColored * tmpOObjects = new ewol::OObject2DColored;
|
||||
|
@ -39,6 +39,7 @@
|
||||
-->
|
||||
<color name="Background" val="#EEEEEEFF"/>
|
||||
<color name="Red" val="#FF0000FF"/>
|
||||
<color name="Green" val="#00FF00FF"/>
|
||||
<color name="Border" val="0.0;0.000512;1.0;0.755562535"/>
|
||||
<!--...-->
|
||||
|
||||
@ -58,19 +59,24 @@
|
||||
<!--...-->
|
||||
|
||||
<frame id="0" name="basic">
|
||||
<rect color="Background"
|
||||
<rect colorBG="Background"
|
||||
position="0.0;0.0"
|
||||
size="1.0;1.0"
|
||||
/>
|
||||
<rect color="Red"
|
||||
position="0.53;0.56"
|
||||
size="0.22;0.11"
|
||||
<rect colorBorder="Red"
|
||||
position="0.1;0.1"
|
||||
size="0.25;0.25"
|
||||
thickness="0.01"
|
||||
/>
|
||||
<line color="TestPlop"
|
||||
positionStart="0.53;0.56"
|
||||
positionStop="0.22;0.11"
|
||||
thickness="0.01"
|
||||
/>
|
||||
<circle colorBG="Green"
|
||||
position="0.75;0.75"
|
||||
radius="0.25"
|
||||
/>
|
||||
</frame>
|
||||
<frame id="0" name="hover">
|
||||
<rect color="..."
|
||||
|
Loading…
x
Reference in New Issue
Block a user