diff --git a/.classpath b/.classpath
index 1fbd196..d97562f 100644
--- a/.classpath
+++ b/.classpath
@@ -13,6 +13,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -38,20 +53,10 @@
-
+
-
-
-
-
-
-
-
-
-
-
diff --git a/lib/freetype-jni.jar b/lib/freetype-jni.jar
deleted file mode 100644
index 1156985..0000000
Binary files a/lib/freetype-jni.jar and /dev/null differ
diff --git a/lib/libfreetype-jni.so b/lib/libfreetype-jni.so
deleted file mode 100755
index e0db50b..0000000
Binary files a/lib/libfreetype-jni.so and /dev/null differ
diff --git a/lib/svgSalamander-1.1.2.jar b/lib/svgSalamander-1.1.2.jar
deleted file mode 100644
index 36ce4eb..0000000
Binary files a/lib/svgSalamander-1.1.2.jar and /dev/null differ
diff --git a/resources/resources/ewol/data/color.frag b/resources/resources/ewol/data/color.frag
index cb8e54c..d80be0c 100644
--- a/resources/resources/ewol/data/color.frag
+++ b/resources/resources/ewol/data/color.frag
@@ -3,8 +3,8 @@ precision mediump float;
precision mediump int;
#endif
-varying vec4 f_color;
+varying vec4 io_color;
void main(void) {
- gl_FragColor = f_color;
+ gl_FragColor = io_color;
}
diff --git a/resources/resources/ewol/data/color.prog b/resources/resources/ewol/data/color.prog
deleted file mode 100644
index 0a98668..0000000
--- a/resources/resources/ewol/data/color.prog
+++ /dev/null
@@ -1,2 +0,0 @@
-color.vert
-color.frag
\ No newline at end of file
diff --git a/resources/resources/ewol/data/color.vert b/resources/resources/ewol/data/color.vert
index 977e7f5..2f64410 100644
--- a/resources/resources/ewol/data/color.vert
+++ b/resources/resources/ewol/data/color.vert
@@ -4,15 +4,15 @@ precision mediump int;
#endif
// Input :
-attribute vec2 EW_coord2d;
-attribute vec4 EW_color;
-uniform mat4 EW_MatrixTransformation;
+attribute vec2 in_coord2d;
+attribute vec4 in_color;
+uniform mat4 in_MatrixTransformation;
// output :
-varying vec4 f_color;
+varying vec4 io_color;
void main(void) {
- gl_Position = EW_MatrixTransformation * vec4(EW_coord2d, 0.0, 1.0);
- //gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * vec4(EW_coord2d, 0.0, 1.0);
- f_color = EW_color;
+ gl_Position = in_MatrixTransformation * vec4(in_coord2d, 0.0, 1.0);
+ //gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * vec4(in_coord2d, 0.0, 1.0);
+ io_color = in_color;
}
diff --git a/resources/resources/ewol/data/color3.frag b/resources/resources/ewol/data/color3.frag
index 0d43917..3470fe0 100644
--- a/resources/resources/ewol/data/color3.frag
+++ b/resources/resources/ewol/data/color3.frag
@@ -1,10 +1,13 @@
+#version 400 core
+
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
-varying vec4 f_color;
+varying vec4 io_color;
void main(void) {
- gl_FragColor = f_color;
+ gl_FragColor = io_color;
+ //gl_FragColor = vec4(1.0,1.0,1.0,1.0);
}
diff --git a/resources/resources/ewol/data/color3.prog b/resources/resources/ewol/data/color3.prog
deleted file mode 100644
index 3b4f341..0000000
--- a/resources/resources/ewol/data/color3.prog
+++ /dev/null
@@ -1,2 +0,0 @@
-color3.vert
-color3.frag
\ No newline at end of file
diff --git a/resources/resources/ewol/data/color3.vert b/resources/resources/ewol/data/color3.vert
index d12c73b..5134b3b 100644
--- a/resources/resources/ewol/data/color3.vert
+++ b/resources/resources/ewol/data/color3.vert
@@ -1,18 +1,22 @@
+#version 400 core
+
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
// Input :
-attribute vec3 EW_coord3d;
-attribute vec4 EW_color;
-uniform mat4 EW_MatrixTransformation;
-uniform mat4 EW_MatrixPosition;
+layout (location = 0) in vec3 in_position;
+layout (location = 3) in vec4 in_colors;
+uniform mat4 in_MatrixTransformation;
+uniform mat4 in_MatrixPosition;
// output :
-varying vec4 f_color;
+varying vec4 io_color;
void main(void) {
- gl_Position = EW_MatrixTransformation * EW_MatrixPosition * vec4(EW_coord3d, 1.0);
- f_color = EW_color;
+ gl_Position = in_MatrixTransformation * in_MatrixPosition * vec4(in_position, 1.0);
+ gl_Position = in_MatrixTransformation * vec4(in_position, 1.0);
+ //gl_Position = vec4(in_position, 1.0);
+ io_color = in_colors;
}
diff --git a/resources/resources/ewol/data/simple3D.frag b/resources/resources/ewol/data/simple3D.frag
index cb8e54c..d80be0c 100644
--- a/resources/resources/ewol/data/simple3D.frag
+++ b/resources/resources/ewol/data/simple3D.frag
@@ -3,8 +3,8 @@ precision mediump float;
precision mediump int;
#endif
-varying vec4 f_color;
+varying vec4 io_color;
void main(void) {
- gl_FragColor = f_color;
+ gl_FragColor = io_color;
}
diff --git a/resources/resources/ewol/data/simple3D.prog b/resources/resources/ewol/data/simple3D.prog
deleted file mode 100644
index 9106c32..0000000
--- a/resources/resources/ewol/data/simple3D.prog
+++ /dev/null
@@ -1,2 +0,0 @@
-simple3D.vert
-simple3D.frag
\ No newline at end of file
diff --git a/resources/resources/ewol/data/simple3D.vert b/resources/resources/ewol/data/simple3D.vert
index cdc691a..b8dbc89 100644
--- a/resources/resources/ewol/data/simple3D.vert
+++ b/resources/resources/ewol/data/simple3D.vert
@@ -4,15 +4,15 @@ precision mediump int;
#endif
// Input :
-attribute vec3 EW_coord3d;
-uniform vec4 EW_color;
-uniform mat4 EW_MatrixTransformation;
+attribute vec3 in_coord3d;
+uniform vec4 in_color;
+uniform mat4 in_MatrixTransformation;
// output :
-varying vec4 f_color;
+varying vec4 io_color;
void main(void) {
- gl_Position = EW_MatrixTransformation * vec4(EW_coord3d, 1.0);
- //gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * vec4(EW_coord2d, 0.0, 1.0);
- f_color = EW_color;
+ gl_Position = in_MatrixTransformation * vec4(in_coord3d, 1.0);
+ //gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * vec4(in_coord2d, 0.0, 1.0);
+ io_color = in_color;
}
diff --git a/resources/resources/ewol/data/text.frag b/resources/resources/ewol/data/text.frag
index 32a55e5..f4a241f 100644
--- a/resources/resources/ewol/data/text.frag
+++ b/resources/resources/ewol/data/text.frag
@@ -4,16 +4,16 @@ precision mediump int;
#endif
// Input :
-uniform sampler2D EW_texID;
+uniform sampler2D in_texID;
-varying vec2 f_texcoord;
-varying vec4 f_color;
+varying vec2 io_texcoord;
+varying vec4 io_color;
/*
void main(void) {
- gl_FragColor = f_color;
- vec2 tmpCoord = f_texcoord;
+ gl_FragColor = io_color;
+ vec2 tmpCoord = io_texcoord;
tmpCoord = mod(tmpCoord, 1.0);
- vec4 map = texture2D(EW_texID, tmpCoord);
+ vec4 map = texture2D(in_texID, tmpCoord);
if (f_texcoord.x<1.0) {
// normal font :
gl_FragColor.a = gl_FragColor.a*map.a;
@@ -30,12 +30,12 @@ void main(void) {
}
*/
-varying vec4 f_patern;
+varying vec4 io_patern;
void main(void) {
- gl_FragColor = f_color;
- vec4 map = texture2D(EW_texID, f_texcoord);
- float alphaCoef = dot(map, f_patern);
+ gl_FragColor = io_color;
+ vec4 map = texture2D(in_texID, io_texcoord);
+ float alphaCoef = dot(map, io_patern);
gl_FragColor.a = gl_FragColor.a*alphaCoef;
}
diff --git a/resources/resources/ewol/data/text.prog b/resources/resources/ewol/data/text.prog
deleted file mode 100644
index 6b0ff18..0000000
--- a/resources/resources/ewol/data/text.prog
+++ /dev/null
@@ -1,2 +0,0 @@
-text.vert
-text.frag
\ No newline at end of file
diff --git a/resources/resources/ewol/data/text.vert b/resources/resources/ewol/data/text.vert
index c06eb71..3507087 100644
--- a/resources/resources/ewol/data/text.vert
+++ b/resources/resources/ewol/data/text.vert
@@ -4,44 +4,44 @@ precision mediump int;
#endif
// Input :
-attribute vec3 EW_coord3d;
-attribute vec2 EW_texture2d;
-attribute vec4 EW_color;
-uniform mat4 EW_MatrixTransformation;
+attribute vec3 in_coord3d;
+attribute vec2 in_texture2d;
+attribute vec4 in_color;
+uniform mat4 in_MatrixTransformation;
// output :
-varying vec4 f_color;
-varying vec2 f_texcoord;
+varying vec4 io_color;
+varying vec2 io_texcoord;
/*
void main(void) {
- gl_Position = EW_MatrixTransformation * vec4(EW_coord2d, 0.0, 1.0);
- //gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * vec4(EW_coord2d, 0.0, 1.0);
+ gl_Position = in_MatrixTransformation * vec4(in_coord2d, 0.0, 1.0);
+ //gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * vec4(in_coord2d, 0.0, 1.0);
// set texture output coord
- f_texcoord = EW_texture2d;
+ io_texcoord = in_texture2d;
// set output color :
- f_color = EW_color;
+ io_color = in_color;
}
*/
-varying vec4 f_patern;
+varying vec4 io_patern;
void main(void) {
- gl_Position = EW_MatrixTransformation * vec4(EW_coord3d, 1.0);
- //gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * vec4(EW_coord2d, 0.0, 1.0);
+ gl_Position = in_MatrixTransformation * vec4(in_coord3d, 1.0);
+ //gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * vec4(in_coord2d, 0.0, 1.0);
// set output color :
- f_color = EW_color;
- if (EW_texture2d.x<1.0) {
+ io_color = in_color;
+ if (in_texture2d.x<1.0) {
// normal font :
- f_patern = vec4 (0.0, 0.0, 0.0, 1.0);
- } else if (EW_texture2d.x<2.0) {
+ io_patern = vec4 (0.0, 0.0, 0.0, 1.0);
+ } else if (in_texture2d.x<2.0) {
// Italic font :
- f_patern = vec4 (1.0, 0.0, 0.0, 0.0);
- } else if (EW_texture2d.x<3.0) {
+ io_patern = vec4 (1.0, 0.0, 0.0, 0.0);
+ } else if (in_texture2d.x<3.0) {
// Bold font :
- f_patern = vec4 (0.0, 1.0, 0.0, 0.0);
+ io_patern = vec4 (0.0, 1.0, 0.0, 0.0);
} else {
// bold italic font :
- f_patern = vec4 (0.0, 0.0, 1.0, 0.0);
+ io_patern = vec4 (0.0, 0.0, 1.0, 0.0);
}
// set texture output coord
- f_texcoord = mod(EW_texture2d, 1.0);
+ io_texcoord = mod(in_texture2d, 1.0);
}
diff --git a/resources/resources/ewol/data/textured.frag b/resources/resources/ewol/data/textured.frag
index 50eea1c..01b4bdf 100644
--- a/resources/resources/ewol/data/textured.frag
+++ b/resources/resources/ewol/data/textured.frag
@@ -4,11 +4,11 @@ precision mediump int;
#endif
// Input :
-uniform sampler2D EW_texID;
+uniform sampler2D in_texID;
-varying vec2 f_texcoord;
-varying vec4 f_color;
+varying vec2 io_texcoord;
+varying vec4 io_color;
void main(void) {
- gl_FragColor = texture2D(EW_texID, f_texcoord) * f_color;
+ gl_FragColor = texture2D(in_texID, io_texcoord) * io_color;
}
diff --git a/resources/resources/ewol/data/textured.prog b/resources/resources/ewol/data/textured.prog
deleted file mode 100644
index eb053e2..0000000
--- a/resources/resources/ewol/data/textured.prog
+++ /dev/null
@@ -1,2 +0,0 @@
-textured.vert
-textured.frag
\ No newline at end of file
diff --git a/resources/resources/ewol/data/textured.vert b/resources/resources/ewol/data/textured.vert
index d5ec23e..e981d10 100644
--- a/resources/resources/ewol/data/textured.vert
+++ b/resources/resources/ewol/data/textured.vert
@@ -4,19 +4,19 @@ precision mediump int;
#endif
// Input :
-attribute vec2 EW_coord2d;
-attribute vec2 EW_texture2d;
-attribute vec4 EW_color;
-uniform mat4 EW_MatrixTransformation;
+attribute vec2 in_coord2d;
+attribute vec2 in_texture2d;
+attribute vec4 in_color;
+uniform mat4 in_MatrixTransformation;
// output :
-varying vec4 f_color;
-varying vec2 f_texcoord;
+varying vec4 io_color;
+varying vec2 io_texcoord;
void main(void) {
- gl_Position = EW_MatrixTransformation * vec4(EW_coord2d, 0.0, 1.0);
+ gl_Position = in_MatrixTransformation * vec4(in_coord2d, 0.0, 1.0);
// set texture output coord
- f_texcoord = EW_texture2d;
+ io_texcoord = in_texture2d;
// set output color :
- f_color = EW_color;
+ io_color = in_color;
}
diff --git a/resources/resources/ewol/data/textured3D.frag b/resources/resources/ewol/data/textured3D.frag
index ce2a070..90e2702 100644
--- a/resources/resources/ewol/data/textured3D.frag
+++ b/resources/resources/ewol/data/textured3D.frag
@@ -4,12 +4,12 @@ precision mediump int;
#endif
// Input :
-uniform sampler2D EW_texID;
+uniform sampler2D in_texID;
-varying vec2 f_texcoord;
-varying vec4 f_color;
+varying vec2 io_texcoord;
+varying vec4 io_color;
void main(void) {
- gl_FragColor = texture2D(EW_texID, f_texcoord) * f_color;
+ gl_FragColor = texture2D(in_texID, io_texcoord) * io_color;
//gl_FragColor = vec4(1.0,1.0,0.2,0.6);
}
diff --git a/resources/resources/ewol/data/textured3D.prog b/resources/resources/ewol/data/textured3D.prog
deleted file mode 100644
index 35578b6..0000000
--- a/resources/resources/ewol/data/textured3D.prog
+++ /dev/null
@@ -1,2 +0,0 @@
-textured3D.vert
-textured3D.frag
\ No newline at end of file
diff --git a/resources/resources/ewol/data/textured3D.vert b/resources/resources/ewol/data/textured3D.vert
index 65973c9..542ecc6 100644
--- a/resources/resources/ewol/data/textured3D.vert
+++ b/resources/resources/ewol/data/textured3D.vert
@@ -3,19 +3,19 @@ precision mediump float;
precision mediump int;
#endif
// Input :
-attribute vec3 EW_coord3d;
-attribute vec2 EW_texture2d;
-attribute vec4 EW_color;
-uniform mat4 EW_MatrixTransformation;
+attribute vec3 in_coord3d;
+attribute vec2 in_texture2d;
+attribute vec4 in_color;
+uniform mat4 in_MatrixTransformation;
// output :
-varying vec4 f_color;
-varying vec2 f_texcoord;
+varying vec4 io_color;
+varying vec2 io_texcoord;
void main(void) {
- gl_Position = EW_MatrixTransformation * vec4(EW_coord3d, 1.0);
+ gl_Position = in_MatrixTransformation * vec4(in_coord3d, 1.0);
// set texture output coord
- f_texcoord = EW_texture2d;
+ io_texcoord = in_texture2d;
// set output color :
- f_color = EW_color;
+ io_color = in_color;
}
diff --git a/resources/resources/ewol/data/textured3D2.frag b/resources/resources/ewol/data/textured3D2.frag
index f37bf8e..a404a98 100644
--- a/resources/resources/ewol/data/textured3D2.frag
+++ b/resources/resources/ewol/data/textured3D2.frag
@@ -18,37 +18,37 @@ struct Material {
};
// Light
-uniform DirectionalLight EW_directionalLight;
+uniform DirectionalLight in_directionalLight;
// Material
-uniform Material EW_material;
+uniform Material in_material;
// Input :
-uniform sampler2D EW_texID;
+uniform sampler2D in_texID;
-varying vec2 f_texcoord;
+varying vec2 io_texcoord;
varying vec3 v_ecNormal;
void main(void) {
- vec4 tmpElementColor = texture2D(EW_texID, f_texcoord);
+ vec4 tmpElementColor = texture2D(in_texID, io_texcoord);
// Normalize v_ecNormal
vec3 ecNormal = v_ecNormal / length(v_ecNormal);
- float ecNormalDotLightDirection = max(0.0, dot(ecNormal, EW_directionalLight.direction));
- float ecNormalDotLightHalfplane = max(0.0, dot(ecNormal, EW_directionalLight.halfplane));
+ float ecNormalDotLightDirection = max(0.0, dot(ecNormal, in_directionalLight.direction));
+ float ecNormalDotLightHalfplane = max(0.0, dot(ecNormal, in_directionalLight.halfplane));
// Calculate ambient light
- vec4 ambientLight = EW_directionalLight.ambientColor * EW_material.ambientFactor;
+ vec4 ambientLight = in_directionalLight.ambientColor * in_material.ambientFactor;
// Calculate diffuse light
- vec4 diffuseLight = ecNormalDotLightDirection * EW_directionalLight.diffuseColor * EW_material.diffuseFactor;
+ vec4 diffuseLight = ecNormalDotLightDirection * in_directionalLight.diffuseColor * in_material.diffuseFactor;
// Calculate specular light
vec4 specularLight = vec4(0.0);
if (ecNormalDotLightHalfplane > 0.0) {
- specularLight = pow(ecNormalDotLightHalfplane, EW_material.shininess) * EW_directionalLight.specularColor * EW_material.specularFactor;
- specularLight = EW_directionalLight.specularColor * EW_material.specularFactor;
+ specularLight = pow(ecNormalDotLightHalfplane, in_material.shininess) * in_directionalLight.specularColor * in_material.specularFactor;
+ specularLight = in_directionalLight.specularColor * in_material.specularFactor;
}
vec4 light = ambientLight + diffuseLight + specularLight;
gl_FragColor = tmpElementColor;// * light;
diff --git a/resources/resources/ewol/data/textured3D2.prog b/resources/resources/ewol/data/textured3D2.prog
deleted file mode 100644
index e7330f0..0000000
--- a/resources/resources/ewol/data/textured3D2.prog
+++ /dev/null
@@ -1,2 +0,0 @@
-textured3D2.vert
-textured3D2.frag
\ No newline at end of file
diff --git a/resources/resources/ewol/data/textured3D2.vert b/resources/resources/ewol/data/textured3D2.vert
index 69ddada..dd81ca2 100644
--- a/resources/resources/ewol/data/textured3D2.vert
+++ b/resources/resources/ewol/data/textured3D2.vert
@@ -3,23 +3,23 @@ precision mediump float;
precision mediump int;
#endif
// Input :
-attribute vec3 EW_coord3d;
-attribute vec2 EW_texture2d;
-attribute vec3 EW_normal;
-uniform mat4 EW_MatrixTransformation;
-uniform mat4 EW_MatrixPosition;
+attribute vec3 in_coord3d;
+attribute vec2 in_texture2d;
+attribute vec3 in_normal;
+uniform mat4 in_MatrixTransformation;
+uniform mat4 in_MatrixPosition;
// output :
-varying vec2 f_texcoord;
+varying vec2 io_texcoord;
varying vec3 v_ecNormal;
void main(void) {
- gl_Position = EW_MatrixTransformation * EW_MatrixPosition * vec4(EW_coord3d, 1.0);
+ gl_Position = in_MatrixTransformation * in_MatrixPosition * vec4(in_coord3d, 1.0);
// set texture output coord
- f_texcoord = EW_texture2d;
- mat4 MatrixPosition = EW_MatrixPosition;
+ io_texcoord = in_texture2d;
+ mat4 MatrixPosition = in_MatrixPosition;
MatrixPosition[3][0] = 0.0;
MatrixPosition[3][1] = 0.0;
MatrixPosition[3][2] = 0.0;
- v_ecNormal = vec3(MatrixPosition * vec4(EW_normal, 1.0) );
+ v_ecNormal = vec3(MatrixPosition * vec4(in_normal, 1.0) );
}
diff --git a/resources/resources/ewol/data/texturedDF.frag b/resources/resources/ewol/data/texturedDF.frag
index 8a76bc7..91aeb7f 100644
--- a/resources/resources/ewol/data/texturedDF.frag
+++ b/resources/resources/ewol/data/texturedDF.frag
@@ -5,21 +5,21 @@ precision mediump int;
#endif
// Input :
-uniform sampler2D EW_texID;
-uniform float EW_SoftEdgeMin;
-uniform float EW_SoftEdgeMax;
-uniform int EW_SoftEdge;
+uniform sampler2D in_texID;
+uniform float in_SoftEdgeMin;
+uniform float in_SoftEdgeMax;
+uniform int in_SoftEdge;
-varying vec2 f_texcoord;
-varying vec4 f_color;
+varying vec2 io_texcoord;
+varying vec4 io_color;
void main(void) {
- vec4 color = texture2D(EW_texID, f_texcoord );
+ vec4 color = texture2D(in_texID, io_texcoord );
float dist = color.r;
float width = fwidth(dist);
float alpha = smoothstep(0.5-width, 0.5+width, dist);
// Smooth
- gl_FragColor = vec4(f_color[0], f_color[1], f_color[2], f_color[3]*alpha);
+ gl_FragColor = vec4(io_color[0], io_color[1], io_color[2], io_color[3]*alpha);
}
diff --git a/resources/resources/ewol/data/texturedDF.vert b/resources/resources/ewol/data/texturedDF.vert
index 1e8591b..86c5400 100644
--- a/resources/resources/ewol/data/texturedDF.vert
+++ b/resources/resources/ewol/data/texturedDF.vert
@@ -4,19 +4,19 @@ precision mediump int;
#endif
// Input :
-attribute vec3 EW_coord3d;
-attribute vec2 EW_texture2d;
-attribute vec4 EW_color;
-uniform mat4 EW_MatrixTransformation;
+attribute vec3 in_coord3d;
+attribute vec2 in_texture2d;
+attribute vec4 in_color;
+uniform mat4 in_MatrixTransformation;
// output :
-varying vec4 f_color;
-varying vec2 f_texcoord;
+varying vec4 io_color;
+varying vec2 io_texcoord;
void main(void) {
- gl_Position = EW_MatrixTransformation * vec4(EW_coord3d, 1.0);
+ gl_Position = in_MatrixTransformation * vec4(in_coord3d, 1.0);
// set texture output coord
- f_texcoord = EW_texture2d;
+ io_texcoord = in_texture2d;
// set output color :
- f_color = EW_color;
+ io_color = in_color;
}
\ No newline at end of file
diff --git a/resources/resources/ewol/data/texturedNoMaterial.frag b/resources/resources/ewol/data/texturedNoMaterial.frag
index b6c6e2a..7990eb1 100644
--- a/resources/resources/ewol/data/texturedNoMaterial.frag
+++ b/resources/resources/ewol/data/texturedNoMaterial.frag
@@ -4,10 +4,10 @@ precision mediump int;
#endif
// Input:
-uniform sampler2D EW_texID;
+uniform sampler2D in_texID;
-varying vec2 f_texcoord;
+varying vec2 io_texcoord;
void main(void) {
- gl_FragColor = texture2D(EW_texID, f_texcoord);
+ gl_FragColor = texture2D(in_texID, io_texcoord);
}
diff --git a/resources/resources/ewol/data/texturedNoMaterial.prog b/resources/resources/ewol/data/texturedNoMaterial.prog
deleted file mode 100644
index b9a1a8f..0000000
--- a/resources/resources/ewol/data/texturedNoMaterial.prog
+++ /dev/null
@@ -1,2 +0,0 @@
-texturedNoMaterial.vert
-texturedNoMaterial.frag
\ No newline at end of file
diff --git a/resources/resources/ewol/data/texturedNoMaterial.vert b/resources/resources/ewol/data/texturedNoMaterial.vert
index 6ce4ff3..433dd6e 100644
--- a/resources/resources/ewol/data/texturedNoMaterial.vert
+++ b/resources/resources/ewol/data/texturedNoMaterial.vert
@@ -3,16 +3,16 @@ precision mediump float;
precision mediump int;
#endif
// Input:
-attribute vec3 EW_coord3d;
-attribute vec2 EW_texture2d;
-uniform mat4 EW_MatrixTransformation;
-uniform mat4 EW_MatrixPosition;
+attribute vec3 in_coord3d;
+attribute vec2 in_texture2d;
+uniform mat4 in_MatrixTransformation;
+uniform mat4 in_MatrixPosition;
// output:
-varying vec2 f_texcoord;
+varying vec2 io_texcoord;
void main(void) {
// set texture output coord
- f_texcoord = EW_texture2d;
- gl_Position = EW_MatrixTransformation * EW_MatrixPosition * vec4(EW_coord3d, 1.0);
+ io_texcoord = in_texture2d;
+ gl_Position = in_MatrixTransformation * in_MatrixPosition * vec4(in_coord3d, 1.0);
}
diff --git a/samples/src/sample/atriasoft/ewol/simpleWindowsWithImage/Appl.java b/samples/src/sample/atriasoft/ewol/simpleWindowsWithImage/Appl.java
index f3f28e8..08bc7c5 100644
--- a/samples/src/sample/atriasoft/ewol/simpleWindowsWithImage/Appl.java
+++ b/samples/src/sample/atriasoft/ewol/simpleWindowsWithImage/Appl.java
@@ -24,7 +24,7 @@ public class Appl implements EwolApplication {
//! [ewol_sample_HW_main_set_windows_size]
//! [ewol_sample_HW_main_set_font_property]
// select font preference of der with a basic application size
- context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19);
+ context.getFontDefault().set("FreeSherif", 30);
//! [ewol_sample_HW_main_set_font_property]
//! [ewol_sample_HW_main_set_windows]
// Create the windows
diff --git a/samples/src/sample/atriasoft/ewol/simpleWindowsWithImage/MainWindows.java b/samples/src/sample/atriasoft/ewol/simpleWindowsWithImage/MainWindows.java
index 4a5dc8b..65fd483 100644
--- a/samples/src/sample/atriasoft/ewol/simpleWindowsWithImage/MainWindows.java
+++ b/samples/src/sample/atriasoft/ewol/simpleWindowsWithImage/MainWindows.java
@@ -1,7 +1,7 @@
package sample.atriasoft.ewol.simpleWindowsWithImage;
import org.atriasoft.etk.math.Vector2b;
-import org.atriasoft.ewol.widget.Label;
+import org.atriasoft.ewol.widget.Spacer;
import org.atriasoft.ewol.widget.Windows;
public class MainWindows extends Windows {
@@ -11,11 +11,17 @@ public class MainWindows extends Windows {
setPropertyTitle("Simple sample test");
//! [ewol_sample_HW_windows_label]
//! [ewol_sample_HW_windows_title]
+ /*
Label simpleLabel = new Label();
- simpleLabel.setPropertyValue("Hello World");
+ simpleLabel.setPropertyValue("Hello World
coucou comment ca vas ???
sdsdfgsdfgdsfgsZESRTZAERÉ");
simpleLabel.setPropertyExpand(new Vector2b(true, true));
simpleLabel.setPropertyFill(new Vector2b(true, true));
setSubWidget(simpleLabel);
+ */
//! [ewol_sample_HW_windows_label]
+ Spacer simpleSpacer = new Spacer();
+ simpleSpacer.setPropertyExpand(new Vector2b(true, true));
+ simpleSpacer.setPropertyFill(new Vector2b(true, true));
+ setSubWidget(simpleSpacer);
}
}
diff --git a/src/module-info.java b/src/module-info.java
index 1b9e33b..0f4a25f 100644
--- a/src/module-info.java
+++ b/src/module-info.java
@@ -17,13 +17,13 @@ open module org.atriasoft.ewol {
//exports org.atriasoft.ewol.widget.meta;
exports org.atriasoft.echrono;
- exports org.atriasoft.egami;
exports org.atriasoft.esignal;
+ requires transitive org.atriasoft.iogami;
requires transitive org.atriasoft.gale;
requires transitive org.atriasoft.etk;
+ requires transitive org.atriasoft.esvg;
requires transitive org.atriasoft.exml;
requires transitive org.atriasoft.ejson;
requires transitive io.scenarium.logger;
- requires freetype.jni;
}
diff --git a/src/org/atriasoft/egami/Egami.java b/src/org/atriasoft/egami/Egami.java
deleted file mode 100644
index 4cbb34b..0000000
--- a/src/org/atriasoft/egami/Egami.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.atriasoft.egami;
-
-import org.atriasoft.etk.Uri;
-import org.atriasoft.etk.math.Vector2i;
-import org.atriasoft.ewol.internal.Log;
-
-public class Egami {
- private Egami() {}
- public static Image load(Uri uri, Vector2i size) {
- Log.todo("Load image : " + uri + " size=" + size);
- return null;
- }
-}
diff --git a/src/org/atriasoft/egami/Image.java b/src/org/atriasoft/egami/Image.java
deleted file mode 100644
index a04f0d9..0000000
--- a/src/org/atriasoft/egami/Image.java
+++ /dev/null
@@ -1,170 +0,0 @@
-package org.atriasoft.egami;
-
-import org.atriasoft.etk.math.Vector2i;
-
-public class Image {
- private int width;
- private int height;
- private byte[] buffer;
-
- public Image(final int width, final int height) {
- this.width = width;
- this.height = height;
- this.buffer = new byte[width * height * 4];
- }
-
- public Image(final int width, final int height, final byte[] buffer) {
- this.buffer = buffer;
- this.width = width;
- this.height = height;
- }
-
- public void clear() {
- for (int xxx = 0; xxx < this.buffer.length; ++xxx) {
- this.buffer[xxx] = 0;
- }
-
- }
-
- public byte getA(final int x, final int y) {
- return this.buffer[(y * this.width + x) * 4 + 3];
- }
-
- public byte getB(final int x, final int y) {
- return this.buffer[(y * this.width + x) * 4 + 2];
- }
-
- public byte[] getBuffer() {
- return this.buffer;
- }
-
- public byte getG(final int x, final int y) {
- return this.buffer[(y * this.width + x) * 4 + 1];
- }
-
- public Vector2i getGPUSize() {
- /*
- if (false) {
- // Some GPU does not support not pow2 dimention....
- #if defined(__TARGET_OS__Android) \
- || defined(__TARGET_OS__IOs)
- return ivec2(nextP2(m_data->getSize().x()),
- nextP2(m_data->getSize().y()));
- }
- */
- return getSize();
- }
-
- public int getHeight() {
- return this.height;
- }
-
- public byte getR(final int x, final int y) {
- return this.buffer[(y * this.width + x) * 4];
- }
-
- public byte[] getRaw() {
- // TODO Auto-generated method stub
- return this.buffer;
- }
-
- public Vector2i getSize() {
- return new Vector2i(this.width, this.height);
- }
-
- public int getWidth() {
- return this.width;
- }
-
- public void resize(final int width, final int height) {
- if (width == this.width && height == this.height) {
- // same size == > nothing to do ...
- return;
- }
- final int oldWidth = this.width;
- final int oldHeight = this.height;
- final byte[] oldBuffer = this.buffer;
- this.width = width;
- this.height = height;
- this.buffer = new byte[this.width * this.height * 4];
- if (this.width <= oldWidth) {
- if (this.height < oldHeight) {
- // Just remove lines ....
- for (int yyy = 0; yyy < this.height; ++yyy) {
- for (int xxx = 0; xxx < this.width; ++xxx) {
- this.buffer[(yyy * this.width + xxx) * 4] = oldBuffer[(yyy * oldWidth + xxx) * 4];
- this.buffer[(yyy * this.width + xxx) * 4 + 1] = oldBuffer[(yyy * oldWidth + xxx) * 4 + 1];
- this.buffer[(yyy * this.width + xxx) * 4 + 2] = oldBuffer[(yyy * oldWidth + xxx) * 4 + 2];
- this.buffer[(yyy * this.width + xxx) * 4 + 3] = oldBuffer[(yyy * oldWidth + xxx) * 4 + 3];
- }
- }
- } else {
- // just add lines
- for (int yyy = 0; yyy < oldHeight; ++yyy) {
- for (int xxx = 0; xxx < this.width; ++xxx) {
- this.buffer[(yyy * this.width + xxx) * 4] = oldBuffer[(yyy * oldWidth + xxx) * 4];
- this.buffer[(yyy * this.width + xxx) * 4 + 1] = oldBuffer[(yyy * oldWidth + xxx) * 4 + 1];
- this.buffer[(yyy * this.width + xxx) * 4 + 2] = oldBuffer[(yyy * oldWidth + xxx) * 4 + 2];
- this.buffer[(yyy * this.width + xxx) * 4 + 3] = oldBuffer[(yyy * oldWidth + xxx) * 4 + 3];
- }
- }
- }
- } else if (this.height <= oldHeight) {
- for (int yyy = 0; yyy < this.height; ++yyy) {
- for (int xxx = 0; xxx < oldWidth; ++xxx) {
- this.buffer[(yyy * this.width + xxx) * 4] = oldBuffer[(yyy * oldWidth + xxx) * 4];
- this.buffer[(yyy * this.width + xxx) * 4 + 1] = oldBuffer[(yyy * oldWidth + xxx) * 4 + 1];
- this.buffer[(yyy * this.width + xxx) * 4 + 2] = oldBuffer[(yyy * oldWidth + xxx) * 4 + 2];
- this.buffer[(yyy * this.width + xxx) * 4 + 3] = oldBuffer[(yyy * oldWidth + xxx) * 4 + 3];
- }
- }
- } else {
- for (int yyy = 0; yyy < oldHeight; ++yyy) {
- for (int xxx = 0; xxx < oldWidth; ++xxx) {
- this.buffer[(yyy * this.width + xxx) * 4] = oldBuffer[(yyy * oldWidth + xxx) * 4];
- this.buffer[(yyy * this.width + xxx) * 4 + 1] = oldBuffer[(yyy * oldWidth + xxx) * 4 + 1];
- this.buffer[(yyy * this.width + xxx) * 4 + 2] = oldBuffer[(yyy * oldWidth + xxx) * 4 + 2];
- this.buffer[(yyy * this.width + xxx) * 4 + 3] = oldBuffer[(yyy * oldWidth + xxx) * 4 + 3];
- }
- }
- }
- }
-
- public void setA(final int x, final int y, final byte value) {
- this.buffer[(y * this.width + x) * 4 + 3] = value;
- }
-
- public void setA(final int x, final int y, final float value) {
- this.buffer[(y * this.width + x) * 4 + 3] = (byte) (value * 256.0f);
- }
-
- public void setB(final int x, final int y, final byte value) {
- this.buffer[(y * this.width + x) * 4 + 2] = value;
- }
-
- public void setB(final int x, final int y, final float value) {
- this.buffer[(y * this.width + x) * 4 + 2] = (byte) (value * 256.0f);
- }
-
- public void setG(final int x, final int y, final byte value) {
- this.buffer[(y * this.width + x) * 4 + 1] = value;
- }
-
- public void setG(final int x, final int y, final float value) {
- this.buffer[(y * this.width + x) * 4 + 1] = (byte) (value * 256.0f);
- }
-
- public void setR(final int x, final int y, final byte value) {
- this.buffer[(y * this.width + x) * 4] = value;
- }
-
- public void setR(final int x, final int y, final float value) {
- this.buffer[(y * this.width + x) * 4] = (byte) (value * 256.0f);
- }
-
- public void setSize(final int width, final int height) {
- this.width = width;
- this.height = height;
- this.buffer = new byte[width * height * 4];
- }
-}
diff --git a/src/org/atriasoft/egami/ImageFloat.java b/src/org/atriasoft/egami/ImageFloat.java
deleted file mode 100644
index 96cc071..0000000
--- a/src/org/atriasoft/egami/ImageFloat.java
+++ /dev/null
@@ -1,159 +0,0 @@
-package org.atriasoft.egami;
-
-import org.atriasoft.etk.math.Vector2i;
-
-public class ImageFloat {
- private int width;
- private int height;
- private float[] buffer;
-
- public ImageFloat(final int width, final int height) {
- this.width = width;
- this.height = height;
- this.buffer = new float[width * height * 4];
- }
-
- public ImageFloat(final int width, final int height, final float[] buffer) {
- this.buffer = buffer;
- this.width = width;
- this.height = height;
- }
-
- public float getA(final int x, final int y) {
- return this.buffer[(y * this.width + x) * 4 + 3];
- }
-
- public float getB(final int x, final int y) {
- return this.buffer[(y * this.width + x) * 4 + 2];
- }
-
- public float[] getBuffer() {
- return this.buffer;
- }
-
- public float getG(final int x, final int y) {
- return this.buffer[(y * this.width + x) * 4 + 1];
- }
-
- public Vector2i getGPUSize() {
- /*
- if (false) {
- // Some GPU does not support not pow2 dimention....
- /*
- #if defined(__TARGET_OS__Android) \
- || defined(__TARGET_OS__IOs)
- return ivec2(nextP2(m_data->getSize().x()),
- nextP2(m_data->getSize().y()));
- }
- */
- return getSize();
- }
-
- public int getHeight() {
- return this.height;
- }
-
- public float getR(final int x, final int y) {
- return this.buffer[(y * this.width + x) * 4];
- }
-
- public Vector2i getSize() {
- return new Vector2i(this.width, this.height);
- }
-
- public int getWidth() {
- return this.width;
- }
-
- public void resize(final int width, final int height) {
- if (width == this.width && height == this.height) {
- // same size == > nothing to do ...
- return;
- }
- final int oldWidth = this.width;
- final int oldHeight = this.height;
- final float[] oldBuffer = this.buffer;
- this.width = width;
- this.height = height;
- this.buffer = new float[this.width * this.height * 4];
- if (this.width <= oldWidth) {
- if (this.height < oldHeight) {
- // Just remove lines ....
- for (int yyy = 0; yyy < this.height; ++yyy) {
- for (int xxx = 0; xxx < this.width; ++xxx) {
- this.buffer[(yyy * this.width + xxx) * 4] = oldBuffer[(yyy * oldWidth + xxx) * 4];
- this.buffer[(yyy * this.width + xxx) * 4 + 1] = oldBuffer[(yyy * oldWidth + xxx) * 4 + 1];
- this.buffer[(yyy * this.width + xxx) * 4 + 2] = oldBuffer[(yyy * oldWidth + xxx) * 4 + 2];
- this.buffer[(yyy * this.width + xxx) * 4 + 3] = oldBuffer[(yyy * oldWidth + xxx) * 4 + 3];
- }
- }
- } else {
- // just add lines
- for (int yyy = 0; yyy < oldHeight; ++yyy) {
- for (int xxx = 0; xxx < this.width; ++xxx) {
- this.buffer[(yyy * this.width + xxx) * 4] = oldBuffer[(yyy * oldWidth + xxx) * 4];
- this.buffer[(yyy * this.width + xxx) * 4 + 1] = oldBuffer[(yyy * oldWidth + xxx) * 4 + 1];
- this.buffer[(yyy * this.width + xxx) * 4 + 2] = oldBuffer[(yyy * oldWidth + xxx) * 4 + 2];
- this.buffer[(yyy * this.width + xxx) * 4 + 3] = oldBuffer[(yyy * oldWidth + xxx) * 4 + 3];
- }
- }
- }
- } else if (this.height <= oldHeight) {
- for (int yyy = 0; yyy < this.height; ++yyy) {
- for (int xxx = 0; xxx < oldWidth; ++xxx) {
- this.buffer[(yyy * this.width + xxx) * 4] = oldBuffer[(yyy * oldWidth + xxx) * 4];
- this.buffer[(yyy * this.width + xxx) * 4 + 1] = oldBuffer[(yyy * oldWidth + xxx) * 4 + 1];
- this.buffer[(yyy * this.width + xxx) * 4 + 2] = oldBuffer[(yyy * oldWidth + xxx) * 4 + 2];
- this.buffer[(yyy * this.width + xxx) * 4 + 3] = oldBuffer[(yyy * oldWidth + xxx) * 4 + 3];
- }
- }
- } else {
- for (int yyy = 0; yyy < oldHeight; ++yyy) {
- for (int xxx = 0; xxx < oldWidth; ++xxx) {
- this.buffer[(yyy * this.width + xxx) * 4] = oldBuffer[(yyy * oldWidth + xxx) * 4];
- this.buffer[(yyy * this.width + xxx) * 4 + 1] = oldBuffer[(yyy * oldWidth + xxx) * 4 + 1];
- this.buffer[(yyy * this.width + xxx) * 4 + 2] = oldBuffer[(yyy * oldWidth + xxx) * 4 + 2];
- this.buffer[(yyy * this.width + xxx) * 4 + 3] = oldBuffer[(yyy * oldWidth + xxx) * 4 + 3];
- }
- }
- }
- }
-
- public void setA(final int x, final int y, final byte value) {
- this.buffer[(y * this.width + x) * 4 + 3] = value / 256.0f;
- }
-
- public void setA(final int x, final int y, final float value) {
- this.buffer[(y * this.width + x) * 4 + 3] = value;
- }
-
- public void setB(final int x, final int y, final byte value) {
- this.buffer[(y * this.width + x) * 4 + 2] = value / 256.0f;
- }
-
- public void setB(final int x, final int y, final float value) {
- this.buffer[(y * this.width + x) * 4 + 2] = value;
- }
-
- public void setG(final int x, final int y, final byte value) {
- this.buffer[(y * this.width + x) * 4 + 1] = value / 256.0f;
- }
-
- public void setG(final int x, final int y, final float value) {
- this.buffer[(y * this.width + x) * 4 + 1] = value;
- }
-
- public void setR(final int x, final int y, final byte value) {
- this.buffer[(y * this.width + x) * 4] = value / 256.0f;
- }
-
- public void setR(final int x, final int y, final float value) {
- this.buffer[(y * this.width + x) * 4] = value;
- }
-
- public void setSize(final int width, final int height) {
- this.width = width;
- this.height = height;
- this.buffer = new float[width * height * 4];
- }
-}
diff --git a/src/org/atriasoft/egami/ImageMono.java b/src/org/atriasoft/egami/ImageMono.java
deleted file mode 100644
index 73d9c61..0000000
--- a/src/org/atriasoft/egami/ImageMono.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package org.atriasoft.egami;
-
-import org.atriasoft.etk.math.Vector2i;
-
-public class ImageMono {
- private int width;
- private int height;
- private byte[] buffer;
-
- public ImageMono(final int width, final int height) {
- this.width = width;
- this.height = height;
- this.buffer = new byte[width * height];
- }
-
- public ImageMono(final int width, final int height, final byte[] buffer) {
- this.buffer = buffer;
- this.width = width;
- this.height = height;
- }
-
- public byte get(final int x, final int y) {
- return this.buffer[(y * this.width + x)];
- }
-
- public byte[] getBuffer() {
- return this.buffer;
- }
-
- public Vector2i getGPUSize() {
- /*
- if (false) {
- // Some GPU does not support not pow2 dimention....
- #if defined(__TARGET_OS__Android) \
- || defined(__TARGET_OS__IOs)
- return ivec2(nextP2(m_data->getSize().x()),
- nextP2(m_data->getSize().y()));
- }
- */
- return getSize();
- }
-
- public int getHeight() {
- return this.height;
- }
-
- public Vector2i getSize() {
- return new Vector2i(this.width, this.height);
- }
-
- public int getWidth() {
- return this.width;
- }
-
- public void resize(final int width, final int height) {
- if (width == this.width && height == this.height) {
- // same size == > nothing to do ...
- return;
- }
- final int oldWidth = this.width;
- final int oldHeight = this.height;
- final byte[] oldBuffer = this.buffer;
- this.width = width;
- this.height = height;
- this.buffer = new byte[this.width * this.height * 4];
- if (this.width <= oldWidth) {
- if (this.height < oldHeight) {
- // Just remove lines ....
- for (int yyy = 0; yyy < this.height; ++yyy) {
- for (int xxx = 0; xxx < this.width; ++xxx) {
- this.buffer[yyy * this.width + xxx] = oldBuffer[yyy * oldWidth + xxx];
- }
- }
- } else {
- // just add lines
- for (int yyy = 0; yyy < oldHeight; ++yyy) {
- for (int xxx = 0; xxx < this.width; ++xxx) {
- this.buffer[yyy * this.width + xxx] = oldBuffer[yyy * oldWidth + xxx];
- }
- }
- }
- } else if (this.height <= oldHeight) {
- for (int yyy = 0; yyy < this.height; ++yyy) {
- for (int xxx = 0; xxx < oldWidth; ++xxx) {
- this.buffer[yyy * this.width + xxx] = oldBuffer[yyy * oldWidth + xxx];
- }
- }
- } else {
- for (int yyy = 0; yyy < oldHeight; ++yyy) {
- for (int xxx = 0; xxx < oldWidth; ++xxx) {
- this.buffer[yyy * this.width + xxx] = oldBuffer[yyy * oldWidth + xxx];
- }
- }
- }
- }
-
- public void set(final int x, final int y, final byte value) {
- this.buffer[(y * this.width + x)] = value;
- }
-
- public void set(final int x, final int y, final float value) {
- this.buffer[(y * this.width + x)] = (byte) (value * 256.0f);
- }
-
- public void setSize(final int width, final int height) {
- this.width = width;
- this.height = height;
- this.buffer = new byte[width * height];
- }
-
-}
diff --git a/src/org/atriasoft/ewol/Ewol.java b/src/org/atriasoft/ewol/Ewol.java
index c0879e1..cca90ff 100644
--- a/src/org/atriasoft/ewol/Ewol.java
+++ b/src/org/atriasoft/ewol/Ewol.java
@@ -1,5 +1,6 @@
package org.atriasoft.ewol;
+import org.atriasoft.esvg.Esvg;
import org.atriasoft.etk.Uri;
/** @file
* @author Edouard DUPIN
@@ -20,6 +21,7 @@ public class Ewol {
public static void init() {
Uri.addLibrary("ewol", Ewol.class, "/resources/ewol/");
Gale.init();
+ Esvg.init();
}
/**
diff --git a/src/org/atriasoft/ewol/compositing/Compositing.java b/src/org/atriasoft/ewol/compositing/Compositing.java
index 4d030e7..a28edba 100644
--- a/src/org/atriasoft/ewol/compositing/Compositing.java
+++ b/src/org/atriasoft/ewol/compositing/Compositing.java
@@ -28,6 +28,11 @@ public abstract class Compositing {
public abstract void draw(final boolean disableDepthTest);
+ /**
+ * Require the transfer of all the data in the Graphic card (doen between the addinc element and the draw)
+ */
+ public abstract void flush();
+
/**
* reset to the eye matrix the openGL mouving system
*/
@@ -66,5 +71,4 @@ public abstract class Compositing {
public void translate(final Vector3f vect) {
this.matrixApply = this.matrixApply.multiply(Matrix4f.createMatrixTranslate(vect));
}
-
}
diff --git a/src/org/atriasoft/ewol/compositing/CompositingDrawing.java b/src/org/atriasoft/ewol/compositing/CompositingDrawing.java
index 337f340..a0b6197 100644
--- a/src/org/atriasoft/ewol/compositing/CompositingDrawing.java
+++ b/src/org/atriasoft/ewol/compositing/CompositingDrawing.java
@@ -17,7 +17,7 @@ import org.atriasoft.etk.math.Vector3f;
import org.atriasoft.ewol.internal.Log;
import org.atriasoft.gale.backend3d.OpenGL;
import org.atriasoft.gale.resource.ResourceProgram;
-import org.atriasoft.gale.resource.ResourceVirtualBufferObject;
+import org.atriasoft.gale.resource.ResourceVirtualArrayObject;
public class CompositingDrawing extends Compositing {
@@ -28,12 +28,13 @@ public class CompositingDrawing extends Compositing {
private Vector3f clippingPosStop = new Vector3f(0, 0, 0); // !< Clipping stop position
private Color color = Color.BLACK; // !< The text foreground color
private Color colorBg = Color.NONE; // !< The text background color
- private int oGLColor = -1; // !< openGL id on the element (color buffer)
+ private final int oGLColor = -1; // !< openGL id on the element (color buffer)
private int oGLMatrix = -1; // !< openGL id on the element (transformation matrix)
private int oGLMatrixPosition = -1; // !< position matrix
- private int oGLPosition = -1; // !< openGL id on the element (vertex buffer)
+ private final int oGLPosition = -1; // !< openGL id on the element (vertex buffer)
private ResourceProgram oGLprogram; // !< pointer on the opengl display program
private final List outColors = new ArrayList<>();
+ private final List outIndice = new ArrayList<>();
private final List outTriangles = new ArrayList<>();
private Vector3f position = new Vector3f(0, 0, 0); // !< The current position to draw
@@ -43,8 +44,10 @@ public class CompositingDrawing extends Compositing {
private final Vector3f[] triangle = new Vector3f[3]; // !< Register every system with a combinaison of tiangle
private final Color[] tricolor = new Color[3]; // !< Register every the associated color foreground
+
private int triElement = 0; // !< special counter of the single dot generated
- protected ResourceVirtualBufferObject vbo;
+ //protected ResourceVirtualBufferObject vbo;
+ protected ResourceVirtualArrayObject vbo;
// internal API for the generation abstraction of triangles
/**
@@ -57,7 +60,7 @@ public class CompositingDrawing extends Compositing {
this.tricolor[iii] = this.color;
}
// Create the VBO:
- this.vbo = ResourceVirtualBufferObject.create(4);
+ this.vbo = ResourceVirtualArrayObject.createDynamic();
// TO facilitate some debugs we add a name of the VBO:
this.vbo.setName("[VBO] of ewol::compositing::Area");
}
@@ -74,10 +77,8 @@ public class CompositingDrawing extends Compositing {
/**
* draw a 2D circle with the specify rafdius parameter.
* @param radius Distence to the dorder
- * @param angleStart start angle of this circle ([0..2PI] otherwithe == >
- * disable)
- * @param angleStop stop angle of this circle ([0..2PI] otherwithe == >
- * disable)
+ * @param angleStart start angle of this circle ([0..2PI] otherwise ==> disable)
+ * @param angleStop stop angle of this circle ([0..2PI] otherwise ==> disable)
*/
public void circle(final float radius) {
circle(radius, 0);
@@ -160,6 +161,7 @@ public class CompositingDrawing extends Compositing {
this.vbo.clear();
this.outTriangles.clear();
this.outColors.clear();
+ this.outIndice.clear();
// reset temporal variables :
this.position = Vector3f.ZERO;
@@ -182,13 +184,6 @@ public class CompositingDrawing extends Compositing {
*/
@Override
public void draw(final boolean disableDepthTest) {
-
- // push data on the VBO
- // TODO optimize this with single push when needed
- this.vbo.setVboData(CompositingDrawing.vboIdCoord, this.outTriangles.toArray(Vector3f[]::new));
- this.vbo.setVboData(CompositingDrawing.vboIdColor, this.outColors.toArray(Color[]::new));
- this.vbo.flush();
-
if (this.oGLprogram == null) {
Log.error("No shader ...");
return;
@@ -196,17 +191,47 @@ public class CompositingDrawing extends Compositing {
// set Matrix : translation/positionMatrix
final Matrix4f tmpMatrix = OpenGL.getMatrix().multiply(this.matrixApply);
this.oGLprogram.use();
+ this.vbo.bindForRendering();
this.oGLprogram.uniformMatrix(this.oGLMatrix, tmpMatrix);
this.oGLprogram.uniformMatrix(this.oGLMatrixPosition, Matrix4f.IDENTITY);
- // position:
- this.oGLprogram.sendAttributePointer(this.oGLPosition, this.vbo, CompositingDrawing.vboIdCoord);
- // color:
- this.oGLprogram.sendAttributePointer(this.oGLColor, this.vbo, CompositingDrawing.vboIdColor);
- // Request the draw od the elements :
- OpenGL.drawArrays(OpenGL.RenderMode.triangle, 0, this.vbo.bufferSize(CompositingDrawing.vboIdCoord));
+
+ // Request the draw of the elements:
+ this.vbo.renderArrays(OpenGL.RenderMode.triangle);
+ //this.vbo.render(OpenGL.RenderMode.triangle);
+ this.vbo.flush();
+ this.vbo.unBindForRendering();
+ // Request the draw of the elements :
+ // OpenGL.drawArrays(OpenGL.RenderMode.triangle, 0, this.vbo.bufferSize(CompositingDrawing.vboIdCoord));
+ // no: OpenGL.drawElements(OpenGL.RenderMode.triangle, this.vbo.bufferSize(CompositingDrawing.vboIdCoord));
this.oGLprogram.unUse();
}
+ @Override
+ public void flush() {
+ // push data on the VBO
+ this.vbo.setPosition(this.outTriangles.toArray(Vector3f[]::new));
+ this.vbo.setColors(this.outColors.toArray(Color[]::new));
+ //this.vbo.setIndices(this.outIndice);
+ this.vbo.setVertexCount(this.outTriangles.size());
+
+ // for test only
+
+ //float[] vertice = { -500f, -500f, 0.0f, 0.0f, 500f, 0.0f, 500f, -500f, 0.0f };
+ // float[] color = { 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, };
+ //
+ // this.vbo.setPosition(vertice);
+ // this.vbo.setColors(color);
+ // this.vbo.setVertexCount(3);
+
+ // Vector3f[] vertice = { new Vector3f(-500f, -500f, 0.0f), new Vector3f(0.0f, 500f, 0.0f), new Vector3f(500f, -500f, 0.0f) };
+ // Color[] color = { Color.RED, Color.GREEN, Color.BLUE };
+ //
+ // this.vbo.setPosition(vertice);
+ // this.vbo.setColors(color);
+ // this.vbo.setVertexCount(3);
+ // this.vbo.flush();
+ }
+
/**
* Lunch the generation of triangle
*/
@@ -324,10 +349,10 @@ public class CompositingDrawing extends Compositing {
this.oGLprogram = ResourceProgram.create(new Uri("DATA", "color3.vert", "ewol"), new Uri("DATA", "color3.frag", "ewol"));
// get the shader resource :
if (this.oGLprogram != null) {
- this.oGLPosition = this.oGLprogram.getAttribute("EWcoord3d");
- this.oGLColor = this.oGLprogram.getAttribute("EWcolor");
- this.oGLMatrix = this.oGLprogram.getUniform("EWMatrixTransformation");
- this.oGLMatrixPosition = this.oGLprogram.getUniform("EWMatrixPosition");
+ //this.oGLPosition = this.oGLprogram.getAttribute("in_coord3d");
+ //this.oGLColor = this.oGLprogram.getAttribute("in_color");
+ this.oGLMatrix = this.oGLprogram.getUniform("in_MatrixTransformation");
+ this.oGLMatrixPosition = this.oGLprogram.getUniform("in_MatrixPosition");
}
}
diff --git a/src/org/atriasoft/ewol/compositing/CompositingImage.java b/src/org/atriasoft/ewol/compositing/CompositingImage.java
index cb1fa8d..ecabbe5 100644
--- a/src/org/atriasoft/ewol/compositing/CompositingImage.java
+++ b/src/org/atriasoft/ewol/compositing/CompositingImage.java
@@ -34,7 +34,6 @@ public class CompositingImage extends Compositing {
private Vector3f clippingPosStop = new Vector3f(0, 0, 0); //!< Clipping stop position
private Color color = new Color(1, 1, 1); //!< The text foreground color
private Uri filename;
-
private int oGLColor = -1; //!< openGL id on the element (color buffer)
private int oGLMatrix = -1; //!< openGL id on the element (transformation matrix)
private int oGLPosition = -1; //!< openGL id on the element (vertex buffer)
@@ -48,6 +47,10 @@ public class CompositingImage extends Compositing {
private ResourceTexture2 resourceImage = null; //!< texture resources
private ResourceVirtualBufferObject vbo = null;
+ final Color[] vboDataColors = new Color[6];
+ final Vector3f[] vboDataCoords = new Vector3f[6];
+ final Vector2f[] vboDataCoordsTex = new Vector2f[6];
+
public CompositingImage() {
this(new Uri("DATA", ""), CompositingImage.SIZE_AUTO);
}
@@ -139,6 +142,16 @@ public class CompositingImage extends Compositing {
this.oGLprogram.unUse();
}
+ @Override
+ public void flush() {
+
+ this.vbo.setVboData(CompositingImage.VBO_ID_COORD, this.vboDataCoords);
+ this.vbo.setVboData(CompositingImage.VBO_ID_COORD_TEX, this.vboDataCoordsTex);
+ this.vbo.setVboData(CompositingImage.VBO_ID_COLOR, this.vboDataColors);
+
+ this.vbo.flush();
+ }
+
/**
* get the current display position (sometime needed in the gui control)
* @return the current position.
@@ -177,11 +190,11 @@ public class CompositingImage extends Compositing {
this.oGLPosition = 0;
this.oGLprogram = ResourceProgram.create(new Uri("DATA", "textured3D.vert", "ewol"), new Uri("DATA", "textured3D.frag", "ewol"));
if (this.oGLprogram != null) {
- this.oGLPosition = this.oGLprogram.getAttribute("EWcoord3d");
- this.oGLColor = this.oGLprogram.getAttribute("EWcolor");
- this.oGLtexture = this.oGLprogram.getAttribute("EWtexture2d");
- this.oGLMatrix = this.oGLprogram.getUniform("EWMatrixTransformation");
- this.oGLtexID = this.oGLprogram.getUniform("EWtexID");
+ this.oGLPosition = this.oGLprogram.getAttribute("in_coord3d");
+ this.oGLColor = this.oGLprogram.getAttribute("in_color");
+ this.oGLtexture = this.oGLprogram.getAttribute("in_texture2d");
+ this.oGLMatrix = this.oGLprogram.getUniform("in_MatrixTransformation");
+ this.oGLtexID = this.oGLprogram.getUniform("in_texID");
}
}
@@ -216,55 +229,46 @@ public class CompositingImage extends Compositing {
if (this.angle == 0.0f) {
Vector3f point = this.position;
-
- final Vector3f[] coords = new Vector3f[6];
- final Vector2f[] coordsTex = new Vector2f[6];
- final Color[] colors = new Color[6];
int indexElem = 0;
Vector2f tex = new Vector2f(sourcePosStart.x(), sourcePosStop.y());
- coords[indexElem] = point;
- coordsTex[indexElem] = tex;
- colors[indexElem] = this.color;
+ this.vboDataCoords[indexElem] = point;
+ this.vboDataCoordsTex[indexElem] = tex;
+ this.vboDataColors[indexElem] = this.color;
indexElem++;
tex = new Vector2f(sourcePosStop.x(), sourcePosStop.y());
point = new Vector3f(this.position.x() + size.x(), this.position.y(), 0);
- coords[indexElem] = point;
- coordsTex[indexElem] = tex;
- colors[indexElem] = this.color;
+ this.vboDataCoords[indexElem] = point;
+ this.vboDataCoordsTex[indexElem] = tex;
+ this.vboDataColors[indexElem] = this.color;
indexElem++;
tex = new Vector2f(sourcePosStop.x(), sourcePosStart.y());
point = new Vector3f(this.position.x() + size.x(), this.position.y() + size.y(), 0);
- coords[indexElem] = point;
- coordsTex[indexElem] = tex;
- colors[indexElem] = this.color;
+ this.vboDataCoords[indexElem] = point;
+ this.vboDataCoordsTex[indexElem] = tex;
+ this.vboDataColors[indexElem] = this.color;
indexElem++;
- coords[indexElem] = point;
- coordsTex[indexElem] = tex;
- colors[indexElem] = this.color;
+ this.vboDataCoords[indexElem] = point;
+ this.vboDataCoordsTex[indexElem] = tex;
+ this.vboDataColors[indexElem] = this.color;
indexElem++;
tex = new Vector2f(sourcePosStart.x(), sourcePosStart.y());
point = new Vector3f(this.position.x(), this.position.y() + size.y(), 0);
- coords[indexElem] = point;
- coordsTex[indexElem] = tex;
- colors[indexElem] = this.color;
+ this.vboDataCoords[indexElem] = point;
+ this.vboDataCoordsTex[indexElem] = tex;
+ this.vboDataColors[indexElem] = this.color;
indexElem++;
tex = new Vector2f(sourcePosStart.x(), sourcePosStop.y());
point = new Vector3f(this.position.x(), this.position.y(), 0);
- coords[indexElem] = point;
- coordsTex[indexElem] = tex;
- colors[indexElem] = this.color;
+ this.vboDataCoords[indexElem] = point;
+ this.vboDataCoordsTex[indexElem] = tex;
+ this.vboDataColors[indexElem] = this.color;
- this.vbo.setVboData(CompositingImage.VBO_ID_COORD, coords);
- this.vbo.setVboData(CompositingImage.VBO_ID_COORD_TEX, coordsTex);
- this.vbo.setVboData(CompositingImage.VBO_ID_COLOR, colors);
-
- this.vbo.flush();
return;
}
@@ -276,59 +280,51 @@ public class CompositingImage extends Compositing {
Vector2f tex = new Vector2f(sourcePosStart.x(), sourcePosStop.y());
- final Vector3f[] coords = new Vector3f[6];
- final Vector2f[] coordsTex = new Vector2f[6];
- final Color[] colors = new Color[6];
int indexElem = 0;
point = new Vector3f(-limitedSize.x(), -limitedSize.y(), 0);
point = point.rotateNew(new Vector3f(0, 0, 1), this.angle).add(center);
- coords[indexElem] = point;
- coordsTex[indexElem] = tex;
- colors[indexElem] = this.color;
+ this.vboDataCoords[indexElem] = point;
+ this.vboDataCoordsTex[indexElem] = tex;
+ this.vboDataColors[indexElem] = this.color;
indexElem++;
tex = new Vector2f(sourcePosStop.x(), sourcePosStop.y());
point = new Vector3f(limitedSize.x(), -limitedSize.y(), 0);
point = point.rotateNew(new Vector3f(0, 0, 1), this.angle).add(center);
- coords[indexElem] = point;
- coordsTex[indexElem] = tex;
- colors[indexElem] = this.color;
+ this.vboDataCoords[indexElem] = point;
+ this.vboDataCoordsTex[indexElem] = tex;
+ this.vboDataColors[indexElem] = this.color;
indexElem++;
tex = new Vector2f(sourcePosStop.x(), sourcePosStart.y());
point = new Vector3f(limitedSize.x(), limitedSize.y(), 0);
point = point.rotateNew(new Vector3f(0, 0, 1), this.angle).add(center);
- coords[indexElem] = point;
- coordsTex[indexElem] = tex;
- colors[indexElem] = this.color;
+ this.vboDataCoords[indexElem] = point;
+ this.vboDataCoordsTex[indexElem] = tex;
+ this.vboDataColors[indexElem] = this.color;
indexElem++;
- coords[indexElem] = point;
- coordsTex[indexElem] = tex;
- colors[indexElem] = this.color;
+ this.vboDataCoords[indexElem] = point;
+ this.vboDataCoordsTex[indexElem] = tex;
+ this.vboDataColors[indexElem] = this.color;
indexElem++;
tex = new Vector2f(sourcePosStart.x(), sourcePosStart.y());
point = new Vector3f(-limitedSize.x(), limitedSize.y(), 0);
point = point.rotateNew(new Vector3f(0, 0, 1), this.angle).add(center);
- coords[indexElem] = point;
- coordsTex[indexElem] = tex;
- colors[indexElem] = this.color;
+ this.vboDataCoords[indexElem] = point;
+ this.vboDataCoordsTex[indexElem] = tex;
+ this.vboDataColors[indexElem] = this.color;
indexElem++;
tex = new Vector2f(sourcePosStart.x(), sourcePosStop.y());
point = new Vector3f(-limitedSize.x(), -limitedSize.y(), 0);
point = point.rotateNew(new Vector3f(0, 0, 1), this.angle).add(center);
- coords[indexElem] = point;
- coordsTex[indexElem] = tex;
- colors[indexElem] = this.color;
+ this.vboDataCoords[indexElem] = point;
+ this.vboDataCoordsTex[indexElem] = tex;
+ this.vboDataColors[indexElem] = this.color;
- this.vbo.setVboData(CompositingImage.VBO_ID_COORD, coords);
- this.vbo.setVboData(CompositingImage.VBO_ID_COORD_TEX, coordsTex);
- this.vbo.setVboData(CompositingImage.VBO_ID_COLOR, colors);
-
- this.vbo.flush();
}
/**
diff --git a/src/org/atriasoft/ewol/compositing/CompositingText.java b/src/org/atriasoft/ewol/compositing/CompositingText.java
index a78fee3..0ef6db7 100644
--- a/src/org/atriasoft/ewol/compositing/CompositingText.java
+++ b/src/org/atriasoft/ewol/compositing/CompositingText.java
@@ -10,6 +10,7 @@ import java.util.ArrayList;
import java.util.List;
import org.atriasoft.etk.Color;
+import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.Matrix4f;
import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector3f;
@@ -48,9 +49,9 @@ public class CompositingText extends TextBase {
@Override
public Vector3f calculateSizeChar(final Character charcode) {
// get a pointer on the glyph property :
- final GlyphProperty myGlyph = getGlyphPointer(charcode);
+ final GlyphProperty myGlyphProperty = getGlyphPointer(charcode);
final int fontHeigh = (int) getHeight();
- if (myGlyph == null) {
+ if (myGlyphProperty == null) {
if (this.font == null) {
Log.warning("no Glyph... in no font");
} else {
@@ -61,10 +62,10 @@ public class CompositingText extends TextBase {
// get the kerning ofset :
float kerningOffset = 0.0f;
if (this.kerning) {
- kerningOffset = myGlyph.kerningGet(this.previousCharcode);
+ kerningOffset = myGlyphProperty.kerningGet(this.previousCharcode);
}
- final Vector3f outputSize = new Vector3f(myGlyph.advance.x() + kerningOffset, (fontHeigh), 0.0f);
+ final Vector3f outputSize = new Vector3f(myGlyphProperty.getAdvenceX() + kerningOffset, (fontHeigh), 0.0f);
// Register the previous character
this.previousCharcode = charcode;
return outputSize;
@@ -132,15 +133,6 @@ public class CompositingText extends TextBase {
// draw BG in any case:
this.vectorialDraw.draw();
- // TODO : do it only one time (when needed ...)
- // set texture coordonates :
- this.vbo.setVboData(TextBase.vboIdCoordText, this.texturePositions.toArray(Vector2f[]::new));
- // set display positions :
- this.vbo.setVboData(TextBase.vboIdCoord, this.pointPositions.toArray(Vector3f[]::new));
- // set the color
- this.vbo.setVboData(TextBase.vboIdColor, this.colors.toArray(Color[]::new));
- // TODO : do it only one time (when needed ...) --------- end -------
-
if (this.vbo.bufferSize(TextBase.vboIdCoord) <= 0 || this.font == null) {
// TODO : set it back ...
// Log.warning("Nothink to draw...");
@@ -177,6 +169,17 @@ public class CompositingText extends TextBase {
}
}
+ @Override
+ public void flush() {
+ super.flush();
+ // set texture coordinates :
+ this.vbo.setVboData(TextBase.vboIdCoordText, this.texturePositions.toArray(Vector2f[]::new));
+ // set display positions :
+ this.vbo.setVboData(TextBase.vboIdCoord, this.pointPositions.toArray(Vector3f[]::new));
+ // set the color
+ this.vbo.setVboData(TextBase.vboIdColor, this.colors.toArray(Color[]::new));
+ }
+
@Override
public GlyphProperty getGlyphPointer(final Character charcode) {
if (this.font == null) {
@@ -207,8 +210,8 @@ public class CompositingText extends TextBase {
@Override
public void printChar(final Character charcode) {
// get a pointer on the glyph property :
- final GlyphProperty myGlyph = getGlyphPointer(charcode);
- if (myGlyph == null) {
+ final GlyphProperty myGlyphProperty = getGlyphPointer(charcode);
+ if (myGlyphProperty == null) {
Log.error(" font does not really existed ...");
return;
}
@@ -218,7 +221,7 @@ public class CompositingText extends TextBase {
// get the kerning ofset :
float kerningOffset = 0;
if (this.kerning) {
- kerningOffset = myGlyph.kerningGet(this.previousCharcode);
+ kerningOffset = myGlyphProperty.kerningGet(this.previousCharcode);
if (kerningOffset != 0) {
// Log.debug("Kerning between : '" + this.previousCharcode + "''" + myGlyph.UVal
// + "' value : " + kerningOffset);
@@ -229,15 +232,15 @@ public class CompositingText extends TextBase {
/*
* Bitmap position xA xB yC *------* | | | | yD *------*
*/
- float dxA = this.position.x() + myGlyph.bearing.x() + kerningOffset;
- float dxB = dxA + myGlyph.sizeTexture.x();
- float dyC = this.position.y() + myGlyph.bearing.y() + fontHeigh - fontSize;
- float dyD = dyC - myGlyph.sizeTexture.y();
+ float dxA = this.position.x() /*+ myGlyphProperty.bearing.x()*/ + kerningOffset;
+ float dxB = dxA + myGlyphProperty.sizeTexture.x();
+ float dyC = this.position.y() /*+ myGlyphProperty.bearing.y()*/ + fontHeigh - fontSize;
+ float dyD = dyC - myGlyphProperty.sizeTexture.y();
- float tuA = myGlyph.texturePosStart.x();
- float tuB = tuA + myGlyph.texturePosSize.x();
- float tvC = myGlyph.texturePosStart.y();
- float tvD = tvC + myGlyph.texturePosSize.y();
+ float tuA = myGlyphProperty.texturePosStart.x();
+ float tuB = tuA + myGlyphProperty.texturePosSize.x();
+ float tvC = myGlyphProperty.texturePosStart.y();
+ float tvD = tvC + myGlyphProperty.texturePosSize.y();
// Clipping and drawing area
if (this.clippingEnable && (dxB < this.clippingPosStart.x() || dxA > this.clippingPosStop.x() || dyC < this.clippingPosStart.y() || dyD > this.clippingPosStop.y())) {
@@ -251,7 +254,7 @@ public class CompositingText extends TextBase {
final float drawSize = this.clippingPosStart.x() - dxA;
// update element start display
dxA = this.clippingPosStart.x();
- final float addElement = texSizeX * drawSize / myGlyph.sizeTexture.x();
+ final float addElement = texSizeX * drawSize / myGlyphProperty.sizeTexture.x();
// update texture start X Pos
tuA += addElement;
}
@@ -260,7 +263,7 @@ public class CompositingText extends TextBase {
final float drawSize = dxB - this.clippingPosStop.x();
// update element start display
dxB = this.clippingPosStop.x();
- final float addElement = texSizeX * drawSize / myGlyph.sizeTexture.x();
+ final float addElement = texSizeX * drawSize / myGlyphProperty.sizeTexture.x();
// update texture start X Pos
tuB -= addElement;
}
@@ -270,7 +273,7 @@ public class CompositingText extends TextBase {
final float drawSize = dyC - this.clippingPosStop.y();
// update element start display
dyC = this.clippingPosStop.y();
- final float addElement = texSizeY * drawSize / myGlyph.sizeTexture.y();
+ final float addElement = texSizeY * drawSize / myGlyphProperty.sizeTexture.y();
// update texture start X Pos
tvC -= addElement;
}
@@ -279,7 +282,7 @@ public class CompositingText extends TextBase {
final float drawSize = this.clippingPosStart.y() - dyD;
// update element start display
dyD = this.clippingPosStart.y();
- final float addElement = texSizeY * drawSize / myGlyph.sizeTexture.y();
+ final float addElement = texSizeY * drawSize / myGlyphProperty.sizeTexture.y();
// update texture start X Pos
tvD += addElement;
}
@@ -342,7 +345,7 @@ public class CompositingText extends TextBase {
// move the position :
// Log.debug(" 5 pos=" + this.position + " advance=" + myGlyph.advance.x() + "
// kerningOffset=" + kerningOffset);
- this.position = this.position.withX(this.position.x() + myGlyph.advance.x() + kerningOffset);
+ this.position = this.position.withX(this.position.x() + myGlyphProperty.getAdvenceX() + kerningOffset);
// Log.debug(" 6 print '" + char-code + "' : start=" + this.sizeDisplayStart + "
// stop=" + this.sizeDisplayStop + " pos=" + this.position);
// Register the previous character
@@ -358,14 +361,14 @@ public class CompositingText extends TextBase {
if (fontSize <= 0) {
fontSize = Ewol.getContext().getFontDefault().getSize();
}
- if (fontName.equals("")) {
+ if (fontName.isEmpty()) {
fontName = Ewol.getContext().getFontDefault().getName();
}
- fontName += ":";
- fontName += fontSize;
+ Uri fontUri = Ewol.getContext().getFontDefault().getFontUri(fontName).clone();
+ fontUri.setproperty("size", Integer.toString(fontSize));
Log.verbose("plop : " + fontName + " size=" + fontSize + " result :" + fontName);
// link to new one
- this.font = ResourceTexturedFont.create(fontName);
+ this.font = ResourceTexturedFont.create(fontUri);
if (this.font == null) {
Log.error("Can not get font resource");
this.font = previousFont;
diff --git a/src/org/atriasoft/ewol/compositing/TextBase.java b/src/org/atriasoft/ewol/compositing/TextBase.java
index 6439e2d..96fb144 100644
--- a/src/org/atriasoft/ewol/compositing/TextBase.java
+++ b/src/org/atriasoft/ewol/compositing/TextBase.java
@@ -13,6 +13,7 @@ import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.Matrix4f;
import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector3f;
+import org.atriasoft.etk.util.Dynamic;
import org.atriasoft.ewol.compositing.tools.TextDecoration;
import org.atriasoft.ewol.internal.Log;
import org.atriasoft.ewol.resource.font.FontMode;
@@ -161,7 +162,7 @@ public abstract class TextBase extends Compositing {
// get the last elements
this.sizeDisplayStop = Vector3f.max(this.position, this.sizeDisplayStop);
- this.sizeDisplayStart = Vector3f.min(this.position, this.sizeDisplayStop);
+ this.sizeDisplayStart = Vector3f.min(this.position, this.sizeDisplayStart);
// Log.debug(" 2 Start pos=" + this.sizeDisplayStart);
// Log.debug(" 2 Stop pos=" + this.sizeDisplayStop);
@@ -234,12 +235,12 @@ public abstract class TextBase extends Compositing {
* @return true if the right has free space that can be use for justify.
* false if we find '\n'
*/
- public boolean extrapolateLastId(final String text, final int start, int stop, int space, int freeSpace) {
+ public boolean extrapolateLastId(final String text, final int start, final Dynamic stop, final Dynamic space, final Dynamic freeSpace) {
// store previous :
final Character storePrevious = this.previousCharcode;
- stop = text.length();
- space = 0;
+ stop.value = text.length();
+ space.value = 0;
int lastSpacePosition = start;
int lastSpacefreeSize = 0;
@@ -256,40 +257,45 @@ public abstract class TextBase extends Compositing {
final Vector3f tmpSize = calculateSize(text.charAt(iii));
// check overflow :
if (endPos + tmpSize.x() > stopPosition) {
- stop = iii;
+ stop.value = iii;
break;
}
// save number of space :
if (text.charAt(iii) == Character.SPACE_SEPARATOR) {
- space++;
+ space.value++;
lastSpacePosition = iii;
lastSpacefreeSize = (int) (stopPosition - endPos);
} else if (text.charAt(iii) == Character.LINE_SEPARATOR) {
- stop = iii;
+ stop.value = iii;
endOfLine = true;
break;
}
// update local size :
endPos += tmpSize.x();
}
- freeSpace = (int) (stopPosition - endPos);
+ freeSpace.value = (int) (stopPosition - endPos);
// restore previous :
this.previousCharcode = storePrevious;
// need to align left or right ...
- if (stop == (long) text.length()) {
+ if (stop.value == (long) text.length()) {
return true;
}
if (endOfLine) {
return true;
}
- if (space == 0) {
+ if (space.value == 0) {
return true;
}
- stop = lastSpacePosition;
- freeSpace = lastSpacefreeSize;
+ stop.value = lastSpacePosition;
+ freeSpace.value = lastSpacefreeSize;
return false;
}
+ @Override
+ public void flush() {
+ this.vectorialDraw.flush();
+ }
+
/**
* This generate the line return == > it return to the alignment
* position start and at the correct line position ==> it might be use to
@@ -516,7 +522,7 @@ public abstract class TextBase extends Compositing {
* decorations (advence mode).
* @param text The string to display.
* @param decoration The text decoration for the text that might be display
- * (if the vector is smaller, the last parameter is get)
+ * (if the vector is smaller, the last 0,·;2p!arameter is get)
*/
public void print(final String text, final List decoration) {
Color tmpFg = this.color;
@@ -581,16 +587,16 @@ public abstract class TextBase extends Compositing {
}
final float basicSpaceWidth = calculateSize(' ').x();
int currentId = 0;
- final int stop = 0;
- final int space = 0;
- final int freeSpace = 0;
+ final Dynamic stop = new Dynamic(0);
+ final Dynamic space = new Dynamic(0);
+ final Dynamic freeSpace = new Dynamic(0);
while (currentId < (long) text.length()) {
final boolean needNoJustify = extrapolateLastId(text, currentId, stop, space, freeSpace);
float interpolation = basicSpaceWidth;
switch (this.alignment) {
case alignJustify:
if (!needNoJustify) {
- interpolation += (float) freeSpace / (float) (space - 1);
+ interpolation += (float) freeSpace.value / (float) (space.value - 1);
}
break;
case alignDisable: // must not came from here ...
@@ -600,13 +606,13 @@ public abstract class TextBase extends Compositing {
case alignRight:
if (this.needDisplay) {
// Move the first char at the right :
- setPos(new Vector3f(this.position.x() + freeSpace, this.position.y(), this.position.z()));
+ setPos(new Vector3f(this.position.x() + freeSpace.value, this.position.y(), this.position.z()));
}
break;
case alignCenter:
if (this.needDisplay) {
// Move the first char at the right :
- setPos(new Vector3f(this.position.x() + freeSpace / 2, this.position.y(), this.position.z()));
+ setPos(new Vector3f(this.position.x() + freeSpace.value / 2, this.position.y(), this.position.z()));
}
break;
default:
@@ -618,7 +624,7 @@ public abstract class TextBase extends Compositing {
setColorBg(this.colorCursor);
printCursor(false);
}
- for (int iii = currentId; (long) iii < stop && iii < text.length(); iii++) {
+ for (int iii = currentId; (long) iii < stop.value && iii < text.length(); iii++) {
final float fontHeigh = getHeight();
// get specific decoration if provided
if (iii < decoration.size()) {
@@ -665,24 +671,27 @@ public abstract class TextBase extends Compositing {
}
}
}
- if (currentId == stop) {
+ if (stop.value >= text.length()) {
+ currentId = stop.value;
+ continue;
+ }
+ if (currentId == stop.value) {
currentId++;
- } else if (text.charAt(stop) == Character.SPACE_SEPARATOR) {
- currentId = stop + 1;
+ } else if (text.charAt(stop.value) == Character.SPACE_SEPARATOR) {
+ currentId = stop.value + 1;
// reset position :
setPos(new Vector3f(this.startTextPos, this.position.y() - getHeight(), this.position.z()));
this.nbCharDisplayed++;
- } else if (text.charAt(stop) == Character.LINE_SEPARATOR) {
- currentId = stop + 1;
+ } else if (text.charAt(stop.value) == Character.LINE_SEPARATOR) {
+ currentId = stop.value + 1;
// reset position :
setPos(new Vector3f(this.startTextPos, this.position.y() - getHeight(), this.position.z()));
this.nbCharDisplayed++;
} else {
- currentId = stop;
+ currentId = stop.value;
}
}
- // Log.debug(" 4 print in not alligned mode : start=" + this.sizeDisplayStart +
- // " stop=" + this.sizeDisplayStop + " pos=" + this.position);
+ Log.debug(" 4 print in not alligned mode : start=" + this.sizeDisplayStart + " stop=" + this.sizeDisplayStop + " pos=" + this.position);
}
}
diff --git a/src/org/atriasoft/ewol/context/ConfigFont.java b/src/org/atriasoft/ewol/context/ConfigFont.java
index 2e3fbe7..74921c4 100644
--- a/src/org/atriasoft/ewol/context/ConfigFont.java
+++ b/src/org/atriasoft/ewol/context/ConfigFont.java
@@ -1,5 +1,8 @@
package org.atriasoft.ewol.context;
+import java.util.HashMap;
+import java.util.Map;
+
import org.atriasoft.etk.Uri;
import org.atriasoft.ewol.internal.Log;
@@ -10,21 +13,26 @@ import org.atriasoft.ewol.internal.Log;
*/
public class ConfigFont {
- private Uri folder = new Uri("DATA", "fonts", "ewol");
- private String name = "Arial;Helvetica";
- private int size = 10;
+ private final Map fonts = new HashMap<>();
+ private String name = "FreeSherif";
+ private int size = 20;
/**
* Constructor
*/
- public ConfigFont() {}
+ public ConfigFont() {
+ // add default Esvg fonts:
+ this.fonts.put("FreeSherif", new Uri("FONTS", "FreeSherif.svg", "esvg"));
+ this.fonts.put("FreeSans", new Uri("FONTS", "FreeSans.svg", "esvg"));
+ this.fonts.put("FreeMono", new Uri("FONTS", "FreeMono.svg", "esvg"));
+ }
- /**
- * get the default font folder.
- * @return The default font folder.
- */
- public Uri getFolder() {
- return this.folder;
+ public Uri getFontUri(final String fontName) {
+ Uri out = this.fonts.get(fontName);
+ if (out == null) {
+ Log.warning(" try to get unexistant font : " + fontName);
+ }
+ return out;
}
/**
@@ -54,14 +62,6 @@ public class ConfigFont {
Log.debug("Set default Font : '" + this.name + "' size=" + this.size);
}
- /**
- * Specify the default font folder for the Ewol search system (only needed when embended font)
- * @param folder basic folder of the font (ex: DATA:fonts)
- */
- public void setFolder(final Uri folder) {
- this.folder = folder;
- }
-
/**
* Set the current default font name
* @param fontName The font name requested (not case sensitive) ex "Arial" or multiple separate by ';' ex : "Arial;Helvetica".
@@ -79,5 +79,4 @@ public class ConfigFont {
this.size = size;
Log.debug("Set default Font : '" + this.name + "' size=" + this.size + " (change size only)");
}
-
}
diff --git a/src/org/atriasoft/ewol/internal/Log.java b/src/org/atriasoft/ewol/internal/Log.java
index d1748d7..1157977 100644
--- a/src/org/atriasoft/ewol/internal/Log.java
+++ b/src/org/atriasoft/ewol/internal/Log.java
@@ -4,6 +4,7 @@ import io.scenarium.logger.LogLevel;
import io.scenarium.logger.Logger;
public class Log {
+ private static final boolean FORCE_ALL = true;
private static final String LIB_NAME = "ewol";
private static final String LIB_NAME_DRAW = Logger.getDrawableName(Log.LIB_NAME);
private static final boolean PRINT_CRITICAL = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.CRITICAL);
@@ -16,53 +17,49 @@ public class Log {
private static final boolean PRINT_WARNING = Logger.getNeedPrint(Log.LIB_NAME, LogLevel.WARNING);
public static void critical(final String data) {
- if (Log.PRINT_CRITICAL) {
+ if (Log.PRINT_CRITICAL || Log.FORCE_ALL) {
Logger.critical(Log.LIB_NAME_DRAW, data);
}
}
public static void debug(final String data) {
- if (Log.PRINT_DEBUG) {
+ if (Log.PRINT_DEBUG || Log.FORCE_ALL) {
Logger.debug(Log.LIB_NAME_DRAW, data);
}
}
- public static void displayBackTrace() {
- Logger.displayBackTrace(Log.LIB_NAME_DRAW);
- }
-
public static void error(final String data) {
- if (Log.PRINT_ERROR) {
+ if (Log.PRINT_ERROR || Log.FORCE_ALL) {
Logger.error(Log.LIB_NAME_DRAW, data);
}
}
public static void info(final String data) {
- if (Log.PRINT_INFO) {
+ if (Log.PRINT_INFO || Log.FORCE_ALL) {
Logger.info(Log.LIB_NAME_DRAW, data);
}
}
public static void print(final String data) {
- if (Log.PRINT_PRINT) {
+ if (Log.PRINT_PRINT || Log.FORCE_ALL) {
Logger.print(Log.LIB_NAME_DRAW, data);
}
}
public static void todo(final String data) {
- if (Log.PRINT_TODO) {
+ if (Log.PRINT_TODO || Log.FORCE_ALL) {
Logger.todo(Log.LIB_NAME_DRAW, data);
}
}
public static void verbose(final String data) {
- if (Log.PRINT_VERBOSE) {
+ if (Log.PRINT_VERBOSE || Log.FORCE_ALL) {
Logger.verbose(Log.LIB_NAME_DRAW, data);
}
}
public static void warning(final String data) {
- if (Log.PRINT_WARNING) {
+ if (Log.PRINT_WARNING || Log.FORCE_ALL) {
Logger.warning(Log.LIB_NAME_DRAW, data);
}
}
diff --git a/src/org/atriasoft/ewol/resource/ResourceFontFreeType.java b/src/org/atriasoft/ewol/resource/ResourceFontFreeType.java
deleted file mode 100644
index 922f6e4..0000000
--- a/src/org/atriasoft/ewol/resource/ResourceFontFreeType.java
+++ /dev/null
@@ -1,281 +0,0 @@
-/** @file
- * @author Edouard DUPIN
- * @copyright 2011, Edouard DUPIN, all right reserved
- * @license MPL v2.0 (see license file)
- */
-package org.atriasoft.ewol.resource;
-
-import java.util.List;
-
-import org.atriasoft.egami.Image;
-import org.atriasoft.egami.ImageMono;
-import org.atriasoft.etk.Uri;
-import org.atriasoft.etk.math.Vector2f;
-import org.atriasoft.etk.math.Vector2i;
-import org.atriasoft.ewol.internal.LoadPackageStream;
-import org.atriasoft.ewol.internal.Log;
-import org.atriasoft.ewol.resource.font.FontBase;
-import org.atriasoft.ewol.resource.font.GlyphProperty;
-import org.atriasoft.gale.resource.Resource;
-
-import com.mlomb.freetypejni.Bitmap;
-import com.mlomb.freetypejni.Face;
-import com.mlomb.freetypejni.FreeType;
-import com.mlomb.freetypejni.FreeTypeConstants;
-import com.mlomb.freetypejni.FreeTypeConstants.FT_Kerning_Mode;
-import com.mlomb.freetypejni.FreeTypeConstants.FT_Render_Mode;
-import com.mlomb.freetypejni.GlyphSlot;
-import com.mlomb.freetypejni.Kerning;
-import com.mlomb.freetypejni.Library;
-
-// show : http://www.freetype.org/freetype2/docs/tutorial/step2.html
-public class ResourceFontFreeType extends FontBase {
- private static final Library LIBRARY;
- static {
- LIBRARY = FreeType.newLibrary();
- }
-
- public static ResourceFontFreeType create(final Uri uri) {
- Log.verbose("KEEP: FontFreeType: " + uri);
- ResourceFontFreeType object = null;
- final Resource object2 = Resource.getManager().localKeep(uri);
- if (object2 != null) {
- if (!(object2 instanceof ResourceFontFreeType)) {
- Log.critical("Request resource file : '" + uri + "' With the wrong type (dynamic cast error)");
- return null;
- }
- object = (ResourceFontFreeType) object2;
- }
- if (object != null) {
- return object;
- }
- Log.debug("CREATE: FontFreeType: " + uri);
- // need to crate a new one ...
- return new ResourceFontFreeType(uri);
- }
-
- private final Face fftFace;
- private final byte[] fileBuffer;
-
- private boolean init;
-
- private ResourceFontFreeType(final Uri uri) {
- super(uri);
- this.fileBuffer = LoadPackageStream.getAllData(uri.getPath());
- // load Face ...
- this.fftFace = ResourceFontFreeType.LIBRARY.newFace(this.fileBuffer, 0);
- if (this.fftFace == null) {
- Log.error("... the font file could be opened and read, but it appears ... that its font format is unsupported");
- } else {
- // all OK
- Log.debug("load font : \"" + uri + "\" glyph count = " + this.fftFace.getNumGlyphs());
- this.init = true;
- // display();
- }
- }
-
- @Override
- public synchronized void display() {
- if (!this.init) {
- return;
- }
- Log.info(" number of glyph = " + this.fftFace.getNumGlyphs());
- }
-
- @Override
- public synchronized boolean drawGlyph(final Image imageOut, final int fontSize, final Vector2i glyphPosition, final GlyphProperty property, final int posInImage) {
- if (!this.init) {
- return false;
- }
- // 300dpi (hight quality) 96 dpi (normal quality)
- final int fontQuality = 96;
- // Select size ...
- // note tha +6 == *64 corespond with the 1/64th of points calculation of
- // freetype
- boolean error = this.fftFace.setCharSize(fontSize + 6, fontSize + 6, fontQuality, fontQuality);
- if (!error) {
- Log.error("FTSetCharSize == > error in settings ...");
- return false;
- }
- // a small shortcut
- final GlyphSlot slot = this.fftFace.getGlyphSlot();
- // load glyph image into the slot (erase previous one)
- error = this.fftFace.loadGlyph(property.glyphIndex, FreeTypeConstants.FT_LOAD_DEFAULT);
- if (!error) {
- Log.error("FTLoadGlyph specify Glyph");
- return false;
- }
- // convert to an anti-aliased bitmap
- error = slot.renderGlyph(FT_Render_Mode.FT_RENDER_MODE_NORMAL);
- if (!error) {
- Log.error("FTRenderGlyph");
- return false;
- }
- // draw it on the output Image :
- final Bitmap bitmap = slot.getBitmap();
- for (int jjj = 0; jjj < bitmap.getRows(); jjj++) {
- for (int iii = 0; iii < bitmap.getWidth(); iii++) {
- final int valueColor = bitmap.getBuffer().get(iii + bitmap.getWidth() * jjj);
- // set only alpha :
- switch (posInImage) {
- default:
- case 0:
- imageOut.setA(glyphPosition.x() + iii, glyphPosition.y() + jjj, valueColor);
- break;
- case 1:
- imageOut.setR(glyphPosition.x() + iii, glyphPosition.y() + jjj, valueColor);
- break;
- case 2:
- imageOut.setG(glyphPosition.x() + iii, glyphPosition.y() + jjj, valueColor);
- break;
- case 3:
- imageOut.setB(glyphPosition.x() + iii, glyphPosition.y() + jjj, valueColor);
- break;
- }
- // real set of color
-
- }
- }
- return true;
- }
-
- @Override
- public synchronized boolean drawGlyph(final ImageMono imageOut, final int fontSize, final GlyphProperty property, final int borderSize) {
- if (!this.init) {
- return false;
- }
- // 300dpi (hight quality) 96 dpi (normal quality)
- final int fontQuality = 96;
- // Select size ...
- // note tha +6 == *64 corespond with the 1/64th of points calculation of
- // freetype
- boolean error = this.fftFace.setCharSize(fontSize + 6, fontSize + 6, fontQuality, fontQuality);
- if (!error) {
- Log.error("FTSetCharSize == > error in settings ...");
- return false;
- }
- // a small shortcut
- final GlyphSlot slot = this.fftFace.getGlyphSlot();
- // load glyph image into the slot (erase previous one)
- error = this.fftFace.loadGlyph(property.glyphIndex, // glyph index
- FreeTypeConstants.FT_LOAD_DEFAULT);
- if (!error) {
- Log.error("FTLoadGlyph specify Glyph");
- return false;
- }
- // convert to an anti-aliased bitmap
- error = slot.renderGlyph(FT_Render_Mode.FT_RENDER_MODE_NORMAL); // TODO set FT_RENDER_MODE_MONO ==> 1 bit
- // value ==> faster generation ...
- if (!error) {
- Log.error("FTRenderGlyph");
- return false;
- }
- // resize output image :
- final Bitmap bitmap = slot.getBitmap();
- imageOut.resize(bitmap.getWidth() + 2 * borderSize, bitmap.getRows() + 2 * borderSize);
-
- for (int jjj = 0; jjj < bitmap.getRows(); jjj++) {
- for (int iii = 0; iii < bitmap.getWidth(); iii++) {
- final int valueColor = bitmap.getBuffer().get(iii + bitmap.getWidth() * jjj);
- // real set of color
- imageOut.set(borderSize + iii, borderSize + jjj, valueColor);
- }
- }
- return true;
- }
-
- @Override
- public synchronized void generateKerning(final int fontSize, final List listGlyph) {
- if (!this.init) {
- return;
- }
- if (!this.fftFace.hasKerning()) {
- Log.info("No kerning generation (disable) in the font");
- }
- // 300dpi (hight quality) 96 dpi (normal quality)
- final int fontQuality = 96;
- // Select size ...
- // note tha +6 == *64 corespond with the 1/64th of points calculation of
- // freetype
- final boolean error = this.fftFace.setCharSize(fontSize + 6, fontSize + 6, fontQuality, fontQuality);
- if (!error) {
- Log.error("FTSetCharSize == > error in settings ...");
- return;
- }
- // For all the kerning element we get the kerning value :
- for (int iii = 0; iii < listGlyph.size(); iii++) {
- listGlyph.get(iii).kerningClear();
- for (int kkk = 0; kkk < listGlyph.size(); kkk++) {
- final Kerning kerning = this.fftFace.getKerning(listGlyph.get(kkk).glyphIndex, listGlyph.get(iii).glyphIndex, FT_Kerning_Mode.FT_KERNING_UNFITTED);
- // add the kerning only if != 0 ...
- if (kerning.x != 0) {
- listGlyph.get(iii).kerningAdd(listGlyph.get(kkk).uVal, kerning.x / 32.0f);
- // Log.debug("Kerning between : '" + (char)listGlyph[iii].this.UVal + "''" +
- // (char)listGlyph[kkk].this.UVal + "' value : " + kerning.x + " => " +
- // (kerning.x/64.0f));
- }
- }
- }
- }
-
- @Override
- public synchronized boolean getGlyphProperty(final int fontSize, final GlyphProperty property) {
- if (!this.init) {
- return false;
- }
- // 300dpi (hight quality) 96 dpi (normal quality)
- final int fontQuality = 96;
- // Select size ...
- // note tha +6 == *64 corespond with the 1/64th of points calculation of
- // freetype
- boolean error = this.fftFace.setCharSize(fontSize + 6, fontSize + 6, fontQuality, fontQuality);
- if (!error) {
- Log.error("FTSetCharSize == > error in settings ...");
- return false;
- }
- // a small shortcut
- final GlyphSlot slot = this.fftFace.getGlyphSlot();
- // retrieve glyph index from character code
- final int glyphindex = this.fftFace.getCharIndex(property.uVal);
- // load glyph image into the slot (erase previous one)
- error = this.fftFace.loadGlyph(glyphindex, // glyph index
- FreeTypeConstants.FT_LOAD_DEFAULT);
- if (!error) {
- Log.error("FTLoadGlyph specify Glyph");
- return false;
- }
- // convert to an anti-aliased bitmap
- error = slot.renderGlyph(FT_Render_Mode.FT_RENDER_MODE_NORMAL);
- if (!error) {
- Log.error("FTRenderGlyph");
- return false;
- }
- // set properties :
- property.glyphIndex = glyphindex;
- final Bitmap bitmap = slot.getBitmap();
- property.sizeTexture = new Vector2i(bitmap.getWidth(), bitmap.getRows());
- property.bearing = new Vector2i(slot.getMetrics().getHoriBearingX() >> 6, slot.getMetrics().getHoriBearingY() >> 6);
- property.advance = new Vector2i(slot.getMetrics().getHoriAdvance() >> 6, slot.getMetrics().getVertAdvance() >> 6);
- return true;
- }
-
- @Override
- public synchronized int getHeight(final int fontSize) {
- return (int) (fontSize * 1.43f); // this is a really "magic" number ...
- }
-
- @Override
- public synchronized Vector2f getSize(final int fontSize, final String unicodeString) {
- if (!this.init) {
- return new Vector2f(0, 0);
- }
- // TODO ...
- return new Vector2f(0, 0);
- }
-
- @Override
- public synchronized float getSizeWithHeight(final float fontHeight) {
- return fontHeight * 0.6993f; // this is a really "magic" number ...
- }
-
-}
diff --git a/src/org/atriasoft/ewol/resource/ResourceFontSvg.java b/src/org/atriasoft/ewol/resource/ResourceFontSvg.java
new file mode 100644
index 0000000..6ebe36b
--- /dev/null
+++ b/src/org/atriasoft/ewol/resource/ResourceFontSvg.java
@@ -0,0 +1,132 @@
+/** @file
+ * @author Edouard DUPIN
+ * @copyright 2011, Edouard DUPIN, all right reserved
+ * @license MPL v2.0 (see license file)
+ */
+package org.atriasoft.ewol.resource;
+
+import org.atriasoft.egami.Image;
+import org.atriasoft.egami.ImageMono;
+import org.atriasoft.esvg.EsvgFont;
+import org.atriasoft.esvg.font.Glyph;
+import org.atriasoft.esvg.render.Weight;
+import org.atriasoft.etk.Uri;
+import org.atriasoft.etk.math.Vector2f;
+import org.atriasoft.etk.math.Vector2i;
+import org.atriasoft.ewol.internal.Log;
+import org.atriasoft.ewol.resource.font.GlyphProperty;
+import org.atriasoft.gale.resource.Resource;
+
+// show : http://www.freetype.org/freetype2/docs/tutorial/step2.html
+public class ResourceFontSvg extends Resource {
+
+ public static ResourceFontSvg create(final Uri uri) {
+ Log.verbose("KEEP: FontFreeType: " + uri);
+ ResourceFontSvg object = null;
+ final Resource object2 = Resource.getManager().localKeep(uri);
+ if (object2 != null) {
+ if (!(object2 instanceof ResourceFontSvg)) {
+ Log.critical("Request resource file : '" + uri + "' With the wrong type (dynamic cast error)");
+ return null;
+ }
+ object = (ResourceFontSvg) object2;
+ }
+ if (object != null) {
+ return object;
+ }
+ Log.debug("CREATE: FontFreeType: " + uri);
+ // need to crate a new one ...
+ return new ResourceFontSvg(uri);
+ }
+
+ private final EsvgFont font;
+
+ private ResourceFontSvg(final Uri uri) {
+ super(uri);
+ this.font = EsvgFont.load(uri);
+ if (this.font == null) {
+ Log.error("... the font file could be opened and read, but it appears ... that its font format is unsupported");
+ } else {
+ // all OK
+ Log.debug("load font : '" + uri + "' glyph count = " + this.font.getNumGlyphs());
+ // display();
+ }
+ }
+
+ @Override
+ public void cleanUp() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public synchronized void display() {
+ Log.info(" number of glyph = " + this.font.getNumGlyphs());
+ }
+
+ public synchronized boolean drawGlyph(final Image imageOut, final int fontSize, final Vector2i glyphPosition, final GlyphProperty property, final int posInImage) {
+ Weight weight = this.font.render(property.glyph.getUnicodeValue(), fontSize);
+ if (weight == null) {
+ return false;
+ }
+ for (int yyy = 0; yyy < weight.getHeight(); yyy++) {
+ for (int xxx = 0; xxx < weight.getWidth(); xxx++) {
+ final float valueColor = weight.get(xxx, yyy);
+ // set only alpha :
+ switch (posInImage) {
+ default:
+ case 0:
+ imageOut.setA(glyphPosition.x() + xxx, glyphPosition.y() + yyy, valueColor);
+ break;
+ case 1:
+ imageOut.setR(glyphPosition.x() + xxx, glyphPosition.y() + yyy, valueColor);
+ break;
+ case 2:
+ imageOut.setG(glyphPosition.x() + xxx, glyphPosition.y() + yyy, valueColor);
+ break;
+ case 3:
+ imageOut.setB(glyphPosition.x() + xxx, glyphPosition.y() + yyy, valueColor);
+ break;
+ }
+ }
+ }
+ return true;
+ }
+
+ public synchronized boolean drawGlyph(final ImageMono imageOut, final int fontSize, final GlyphProperty property, final int borderSize) {
+ Weight weight = this.font.render(property.glyph.getUnicodeValue(), fontSize);
+ for (int jjj = 0; jjj < weight.getHeight(); jjj++) {
+ for (int iii = 0; iii < weight.getWidth(); iii++) {
+ final float valueColor = weight.get(iii, jjj);
+ // real set of color
+ imageOut.set(borderSize + iii, borderSize + jjj, valueColor);
+ }
+ }
+ return true;
+ }
+
+ public synchronized GlyphProperty getGlyphProperty(final int fontSize, final int uicodeVal) {
+ Glyph glyph = this.font.getGlyphNullIfMissing(uicodeVal);
+ GlyphProperty out;
+ if (glyph == null) {
+ out = new GlyphProperty(this.font, uicodeVal, fontSize);
+ } else {
+ out = new GlyphProperty(this.font, glyph, fontSize);
+ }
+ return out;
+ }
+
+ public synchronized int getHeight(final int fontSize) {
+ return this.font.calculateFontRealHeight(fontSize);
+ }
+
+ public synchronized Vector2f getSize(final int fontSize, final String unicodeString) {
+ float width = this.font.calculateWidth(unicodeString, fontSize, false);
+ float height = this.font.calculateFontRealHeight(fontSize);
+ return new Vector2f(width, height);
+ }
+
+ public synchronized float getSizeWithHeight(final float fontHeight) {
+ return this.font.calculateFontSizeWithHeight(fontHeight);
+ }
+
+}
diff --git a/src/org/atriasoft/ewol/resource/ResourceTexture2.java b/src/org/atriasoft/ewol/resource/ResourceTexture2.java
index 3ded17a..2decc05 100644
--- a/src/org/atriasoft/ewol/resource/ResourceTexture2.java
+++ b/src/org/atriasoft/ewol/resource/ResourceTexture2.java
@@ -41,23 +41,6 @@ public class ResourceTexture2 extends Resource {
* TextureColorMode.rgb), textureUnit); resource.flush(); return resource; }
*/
- /**
- * get the next power 2 if the input
- * @param value Value that we want the next power of 2
- * @return result value
- */
- private static int nextP2(final int value) {
- int val = 1;
- for (int iii = 1; iii < 31; iii++) {
- if (value <= val) {
- return val;
- }
- val *= 2;
- }
- Log.critical("impossible CASE....");
- return val;
- }
-
// openGl Context properties :
protected Image data = new Image(32, 32);
// !< Color space of the image.
diff --git a/src/org/atriasoft/ewol/resource/ResourceTexturedFont.java b/src/org/atriasoft/ewol/resource/ResourceTexturedFont.java
index bf2612b..6fb39ae 100644
--- a/src/org/atriasoft/ewol/resource/ResourceTexturedFont.java
+++ b/src/org/atriasoft/ewol/resource/ResourceTexturedFont.java
@@ -6,62 +6,47 @@
package org.atriasoft.ewol.resource;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import org.atriasoft.etk.Uri;
+import org.atriasoft.etk.math.FMath;
import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.ewol.Ewol;
import org.atriasoft.ewol.internal.Log;
-import org.atriasoft.ewol.resource.font.FontBase;
import org.atriasoft.ewol.resource.font.FontMode;
import org.atriasoft.ewol.resource.font.GlyphProperty;
import org.atriasoft.gale.resource.Resource;
public class ResourceTexturedFont extends ResourceTexture2 {
- public static ResourceTexturedFont create(final String fontName) {
+ public static ResourceTexturedFont create(final Uri fontBaseUri) {
ResourceTexturedFont resource;
Resource resource2;
- if (fontName.isEmpty() || fontName.contentEquals("---")) {
- Log.error("Can not create a Texture Font without a filaname " + fontName);
+ if (fontBaseUri.isEmpty()) {
+ Log.error("Can not create a Texture Font without a filaname " + fontBaseUri);
return null;
}
- resource2 = Resource.getManager().localKeep(fontName);
+ resource2 = Resource.getManager().localKeep("__TEXTURED__>>" + fontBaseUri.toString());
if (resource2 != null) {
if (resource2 instanceof ResourceTexturedFont) {
resource2.keep();
return (ResourceTexturedFont) resource2;
}
- Log.critical("Request resource fontName : '" + fontName + "' With the wrong type (dynamic cast error)");
+ Log.critical("Request resource fontName : '" + fontBaseUri + "' With the wrong type (dynamic cast error)");
return null;
}
- resource = new ResourceTexturedFont(fontName);
+ resource = new ResourceTexturedFont(fontBaseUri);
Resource.getManager().localAdd(resource);
return resource;
}
- /**
- * Get all the Path contain in the specidy path:
- * @param path Generic path to parse ...
- * @return The list of path found
- * example[start] auto out = explodeMultiplePath("DATA:///font?lib=ewol"); //
- * out contain: {"DATA:///font",
- * "DATA:///font?lib=ewol"} @example[stop]
- */
- private static List explodeMultiplePath(final Uri uri) {
- final List out = new ArrayList<>();
- out.add(uri);
- return out;
- }
-
// font is define for a specific mode
public GlyphProperty emptyGlyph;
private final Uri[] fileName = new Uri[4];
// specific element to have the the know if the specify element is known...
// == > otherwise I can just generate italic ...
// == > Bold is a little more complicated (maybe with the bordersize)
- private final FontBase[] font = new FontBase[4];
+ private final ResourceFontSvg[] font = new ResourceFontSvg[4];
private final int[] height = new int[4];
// for the texture generation :
public Vector2i[] lastGlyphPos = new Vector2i[4];
@@ -71,10 +56,10 @@ public class ResourceTexturedFont extends ResourceTexture2 {
private final FontMode[] modeWraping = new FontMode[4]; // !< This is a wrapping mode to prevent the fact that no
private int size = 10;
- protected ResourceTexturedFont(final String fontName) {
- super(fontName);
+ protected ResourceTexturedFont(final Uri fontBaseUri) {
+ super("__TEXTURED_FONT__>>" + fontBaseUri.toString());
- Log.debug("Load font : '" + fontName + "'");
+ Log.debug("Load font : '" + fontBaseUri + "'");
this.font[0] = null;
this.font[1] = null;
@@ -101,82 +86,29 @@ public class ResourceTexturedFont extends ResourceTexture2 {
this.listElement[2] = new ArrayList<>();
this.listElement[3] = new ArrayList<>();
- int tmpSize = 0;
- // extarct name and size :
- final String[] tmpList = fontName.split(":");
+ String sizeString = fontBaseUri.getproperty("size");
+ if (sizeString == null) {
+ this.size = 25;
+ } else {
+ this.size = Integer.parseInt(sizeString);
+ }
+ // find all the fonts...
+ Uri fontBaseUriBold = new Uri(fontBaseUri.getGroup(), fontBaseUri.getPath().replace("\\.svg", "Bold.svg"), fontBaseUri.getproperties());
+ Uri fontBaseUriOblique = new Uri(fontBaseUri.getGroup(), fontBaseUri.getPath().replace("\\.svg", "Oblique.svg"), fontBaseUri.getproperties());
+ Uri fontBaseUriBoldOblique = new Uri(fontBaseUri.getGroup(), fontBaseUri.getPath().replace("\\.svg", "BoldOblique.svg"), fontBaseUri.getproperties());
+ if (fontBaseUri.exist()) {
+ this.fileName[FontMode.Regular.getValue()] = fontBaseUri;
+ }
+ if (fontBaseUriBold.exist()) {
+ this.fileName[FontMode.Bold.getValue()] = fontBaseUriBold;
+ }
+ if (fontBaseUriOblique.exist()) {
+ this.fileName[FontMode.Italic.getValue()] = fontBaseUriOblique;
+ }
+ if (fontBaseUriBoldOblique.exist()) {
+ this.fileName[FontMode.BoldItalic.getValue()] = fontBaseUriBoldOblique;
+ }
- if (tmpList.length == 1) {
- this.size = 1;
- Log.critical("Can not parse the font name: '" + fontName + "' ??? ':' ");
- return;
- }
- // zsdefsdf
- tmpSize = Integer.parseInt(tmpList[1]);
-
- final String localName = tmpList[0];
- if (tmpSize > 400) {
- Log.error("Font size too big ==> limit at 400 when exceed ==> error: " + tmpSize + "==>30");
- tmpSize = 30;
- }
- this.size = tmpSize;
-
- final List folderList = new ArrayList<>();
- final Uri applicationBaseFont = Ewol.getContext().getFontDefault().getFolder();
- for (final Uri it : ResourceTexturedFont.explodeMultiplePath(applicationBaseFont)) {
- folderList.add(it);
- }
- for (int folderID = 0; folderID < folderList.size(); folderID++) {
- final List output = Uri.listRecursive(folderList.get(folderID));
-
- final String[] split = localName.split(";");
- Log.debug("try to find font named : " + split + " in: " + output);
- // Log.critical("parse string : " + split);
- boolean hasFindAFont = false;
- for (int jjj = 0; jjj < split.length; jjj++) {
- Log.debug(" try with : '" + split[jjj] + "'");
- for (int iii = 0; iii < output.size(); iii++) {
- final String nameFolder = output.get(iii).getPath();
- // Log.debug(" file : " + output.get(iii));
- if (nameFolder.endsWith(split[jjj] + "-" + "bold" + ".ttf") || nameFolder.endsWith(split[jjj] + "-" + "b" + ".ttf") || nameFolder.endsWith(split[jjj] + "-" + "bd" + ".ttf")
- || nameFolder.endsWith(split[jjj] + "bold" + ".ttf") || nameFolder.endsWith(split[jjj] + "bd" + ".ttf") || nameFolder.endsWith(split[jjj] + "b" + ".ttf")) {
- Log.debug(" find Font [Bold] : " + output.get(iii));
- this.fileName[FontMode.Bold.getValue()] = output.get(iii);
- hasFindAFont = true;
- } else if (nameFolder.endsWith(split[jjj] + "-" + "oblique" + ".ttf") || nameFolder.endsWith(split[jjj] + "-" + "italic" + ".ttf")
- || nameFolder.endsWith(split[jjj] + "-" + "Light" + ".ttf") || nameFolder.endsWith(split[jjj] + "-" + "i" + ".ttf") || nameFolder.endsWith(split[jjj] + "oblique" + ".ttf")
- || nameFolder.endsWith(split[jjj] + "italic" + ".ttf") || nameFolder.endsWith(split[jjj] + "light" + ".ttf") || nameFolder.endsWith(split[jjj] + "i" + ".ttf")) {
- Log.debug(" find Font [Italic] : " + output.get(iii));
- this.fileName[FontMode.Italic.getValue()] = output.get(iii);
- hasFindAFont = true;
- } else if (nameFolder.endsWith(split[jjj] + "-" + "bolditalic" + ".ttf") || nameFolder.endsWith(split[jjj] + "-" + "boldoblique" + ".ttf")
- || nameFolder.endsWith(split[jjj] + "-" + "bi" + ".ttf") || nameFolder.endsWith(split[jjj] + "-" + "z" + ".ttf") || nameFolder.endsWith(split[jjj] + "bolditalic" + ".ttf")
- || nameFolder.endsWith(split[jjj] + "boldoblique" + ".ttf") || nameFolder.endsWith(split[jjj] + "bi" + ".ttf") || nameFolder.endsWith(split[jjj] + "z" + ".ttf")) {
- Log.debug(" find Font [Bold-Italic] : " + output.get(iii));
- this.fileName[FontMode.BoldItalic.getValue()] = output.get(iii);
- hasFindAFont = true;
- } else if (nameFolder.endsWith(split[jjj] + "-" + "regular" + ".ttf") || nameFolder.endsWith(split[jjj] + "-" + "r" + ".ttf")
- || nameFolder.endsWith(split[jjj] + "regular" + ".ttf") || nameFolder.endsWith(split[jjj] + "r" + ".ttf") || nameFolder.endsWith(split[jjj] + ".ttf")) {
- Log.debug(" find Font [Regular] : " + output.get(iii));
- this.fileName[FontMode.Regular.getValue()] = output.get(iii);
- hasFindAFont = true;
- }
- }
- if (hasFindAFont) {
- Log.debug(" find this font : '" + split[jjj] + "'");
- break;
- }
- if (jjj == split.length - 1) {
- Log.debug("Find NO font in the LIST ... " + Arrays.toString(split));
- }
- }
- if (hasFindAFont) {
- Log.debug(" find this font : '" + folderList.get(folderID) + "'");
- break;
- }
- if (folderID == folderList.size() - 1) {
- Log.error("Find NO font in the LIST ... " + folderList);
- }
- }
// try to find the reference mode :
FontMode refMode = FontMode.Regular;
for (int iii = 3; iii >= 0; iii--) {
@@ -201,7 +133,7 @@ public class ResourceTexturedFont extends ResourceTexture2 {
continue;
}
Log.debug("Load FONT [" + iiiFontId + "] name : \"" + this.fileName[iiiFontId] + "\" == > size=" + this.size);
- this.font[iiiFontId] = ResourceFontFreeType.create(this.fileName[iiiFontId]);
+ this.font[iiiFontId] = ResourceFontSvg.create(this.fileName[iiiFontId]);
if (this.font[iiiFontId] == null) {
Log.debug("error in loading FONT [" + iiiFontId + "] name : \"" + this.fileName[iiiFontId] + "\" == > size=" + this.size);
}
@@ -215,13 +147,13 @@ public class ResourceTexturedFont extends ResourceTexture2 {
this.height[iiiFontId] = this.font[iiiFontId].getHeight(this.size);
// TODO : basic font use 512 is better ... == > maybe estimate it with the dpi
// ???
- setImageSize(new Vector2i(256, 32));
- // now we can acces directly on the image
+ setImageSize(new Vector2i(FMath.nextP2(256 * this.size / 10), 32));
+ // now we can access directly on the image
this.data.clear();
}
// add error glyph
addGlyph((char) 0);
- // by default we set only the first AINSI char availlable
+ // by default we set only the first AINSI char available
for (int iii = 0x20; iii < 0x7F; iii++) {
Log.verbose("Add clyph :" + iii);
addGlyph((char) iii);
@@ -247,23 +179,22 @@ public class ResourceTexturedFont extends ResourceTexture2 {
continue;
}
// add the curent "char"
- final GlyphProperty tmpchar = new GlyphProperty();
- tmpchar.uVal = val;
+ final GlyphProperty tmpchar = this.font[iii].getGlyphProperty(this.size, val);
- if (this.font[iii].getGlyphProperty(this.size, tmpchar)) {
- // Log.debug("load char : '" + val + "'=" + val.get());
+ if (tmpchar != null && tmpchar.exist()) {
+ Log.debug("load char : '" + val + "'=" + (int) val);
hasChange = true;
// change line if needed ...
if (this.lastGlyphPos[iii].x() + tmpchar.sizeTexture.x() + 3 > this.data.getSize().x()) {
- this.lastGlyphPos[iii] = new Vector2i(1, this.lastRawHeigh[iii]);
+ this.lastGlyphPos[iii] = new Vector2i(1, this.lastGlyphPos[iii].y() + this.lastRawHeigh[iii]);
this.lastRawHeigh[iii] = 0;
}
+ Log.error("glyph texture size = " + tmpchar.sizeTexture + "last posY=" + this.lastGlyphPos[iii].y() + " out size=" + this.data.getSize());
while (this.lastGlyphPos[iii].y() + tmpchar.sizeTexture.y() + 3 > this.data.getSize().y()) {
this.data.resize(this.data.getSize().x(), this.data.getSize().y() * 2);
- // note : need to rework all the lyer due to the fact that the texture is used
- // by the faur type...
+ // note : need to rework all the layer due to the fact that the texture is used by the 4 type...
for (int kkk = 0; kkk < 4; kkk++) {
- // change the coordonate on the element in the texture
+ // change the coordinate on the element in the texture
for (int jjj = 0; jjj < this.listElement[kkk].size(); ++jjj) {
this.listElement[kkk].get(jjj).texturePosStart = this.listElement[kkk].get(jjj).texturePosStart.multiply(new Vector2f(1.0f, 0.5f));
this.listElement[kkk].get(jjj).texturePosSize = this.listElement[kkk].get(jjj).texturePosSize.multiply(new Vector2f(1.0f, 0.5f));
@@ -286,20 +217,13 @@ public class ResourceTexturedFont extends ResourceTexture2 {
this.lastGlyphPos[iii] = this.lastGlyphPos[iii].add(new Vector2i(tmpchar.sizeTexture.x() + 1, 0));
} else {
Log.warning("Did not find char : '" + val + "'=" + val);
- tmpchar.setNotExist();
}
this.listElement[iii].add(tmpchar);
- // this.font[iii].display;
- // generate the kerning for all the characters :
- if (tmpchar.exist()) {
- // TODO : set the kerning back ...
- // this.font[iii].generateKerning(this.size, this.listElement[iii]);
- }
}
if (hasChange) {
flush();
Ewol.getContext().forceRedrawAll();
- // egami::store(this.data, "fileFont.bmp"); // ==> for debug test only ...
+ //IOgami.storePNG(new Uri("file", "fileFont.png"), this.data); // ==> for debug test only ...
}
return hasChange;
}
@@ -367,11 +291,11 @@ public class ResourceTexturedFont extends ResourceTexture2 {
for (int iii = 0x80 - 0x20; iii < this.listElement[displayMode.getValue()].size(); iii++) {
// Log.debug("search : '" + charcode + "' =?= '" +
// (this.listElement[displayMode])[iii].UVal + "'");
- if (charcode == this.listElement[displayMode.getValue()].get(iii).uVal) {
+ if (charcode == this.listElement[displayMode.getValue()].get(iii).getUnicodeValue()) {
// Log.debug("search : '" + charcode + "'");
if (this.listElement[displayMode.getValue()].get(iii).exist()) {
// Log.debug("return " + iii);
- return iii;
+ return charcode;
}
return 0;
}
diff --git a/src/org/atriasoft/ewol/resource/font/FontBase.java b/src/org/atriasoft/ewol/resource/font/FontBase.java
deleted file mode 100644
index 95b1dd8..0000000
--- a/src/org/atriasoft/ewol/resource/font/FontBase.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/** @file
- * @author Edouard DUPIN
- * @copyright 2011, Edouard DUPIN, all right reserved
- * @license MPL v2.0 (see license file)
- */
-package org.atriasoft.ewol.resource.font;
-
-import java.util.List;
-
-import org.atriasoft.egami.Image;
-import org.atriasoft.egami.ImageMono;
-import org.atriasoft.etk.Uri;
-import org.atriasoft.etk.math.Vector2f;
-import org.atriasoft.etk.math.Vector2i;
-import org.atriasoft.gale.resource.Resource;
-
-// https://developer.mozilla.org/fr/docs/Web/SVG/Tutorial/SVGfonts
-// https://convertio.co/fr/ttf-svg/
-
-public abstract class FontBase extends Resource {
- public FontBase(final Uri uri) {
- super(uri);
- }
-
- @Override
- public void cleanUp() {
- // TODO Auto-generated method stub
-
- }
-
- public void display() {}
-
- public abstract boolean drawGlyph(final Image imageOut, final int fontSize, final Vector2i glyphPosition, GlyphProperty property, int posInImage);
-
- public boolean drawGlyph(final ImageMono imageOut, final int fontSize, final GlyphProperty property) {
- return drawGlyph(imageOut, fontSize, property, 0);
- }
-
- public abstract boolean drawGlyph(final ImageMono imageOut, final int fontSize, GlyphProperty property, int borderSize);
-
- public void generateKerning(final int fontSize, final List listGlyph) {}
-
- public abstract boolean getGlyphProperty(final int fontSize, GlyphProperty property);
-
- public abstract int getHeight(final int fontSize);
-
- public abstract Vector2f getSize(final int fontSize, final String unicodeString);
-
- public abstract float getSizeWithHeight(final float fontHeight);
-}
\ No newline at end of file
diff --git a/src/org/atriasoft/ewol/resource/font/GlyphProperty.java b/src/org/atriasoft/ewol/resource/font/GlyphProperty.java
index 2cc6461..193e77b 100644
--- a/src/org/atriasoft/ewol/resource/font/GlyphProperty.java
+++ b/src/org/atriasoft/ewol/resource/font/GlyphProperty.java
@@ -5,9 +5,8 @@
*/
package org.atriasoft.ewol.resource.font;
-import java.util.ArrayList;
-import java.util.List;
-
+import org.atriasoft.esvg.EsvgFont;
+import org.atriasoft.esvg.font.Glyph;
import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector2i;
@@ -18,10 +17,10 @@ import org.atriasoft.etk.math.Vector2i;
Y | | | |
^ |------------| |------------|
|
- advance.y:/-> |
+ advance.y: /-> |
| |
| |
- sizeTex.x/-> | | |------------| |------------|
+ sizeTex.x /-> | | |------------| |------------|
| | | | | | |
| | | | | | |
| | | | | | |
@@ -35,32 +34,38 @@ import org.atriasoft.etk.math.Vector2i;
/--> | |
\--> \-> |
bearing.y |
- |**>> X
-
-
- <-----------------------. : advance.x
-
- <-----------. : sizeTexture.x
-
- <--. : bearing.x
+ |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> X
+ <------------------------> : advance.x
+ <------------> : sizeTexture.x
+ <---> : bearing.x
*/
/**
* @notindoc
*/
public class GlyphProperty {
- public Vector2i advance = new Vector2i(10, 10); //!< space use in the display for this specific char
- public Vector2i bearing = new Vector2i(2, 2); //!< offset to display the data (can be negatif id the texture sise is bigger than the theoric places in the string)
- public boolean exist = true;
- public int glyphIndex = 0; //!< Glyph index in the system
- private final List kerning = new ArrayList<>(); //!< kerning values of link of all elements
+ private final int charcode;
+ private final int fontSize;
+ public Glyph glyph = null;
+ private final float scaleFactor;
public Vector2i sizeTexture = new Vector2i(10, 10); //!< size of the element to display
- public Vector2f texturePosSize = new Vector2f(0, 0); //!< Texture normalized position (SIZE)
- public Vector2f texturePosStart = new Vector2f(0, 0); //!< Texture normalized position (START)
- public Character uVal = 0; //!< Unicode value
+ public Vector2f texturePosSize = Vector2f.ZERO; //!< Texture normalized size (SIZE)
+ public Vector2f texturePosStart = Vector2f.ZERO; //!< Texture normalized position (START)
- public GlyphProperty() {
-
+ public GlyphProperty(final EsvgFont font, final Glyph glyph, final int fontSize) {
+ this.glyph = glyph;
+ this.charcode = this.glyph.getUnicodeValue();
+ this.fontSize = fontSize;
+ this.sizeTexture = font.calculateWidthRendering(glyph.getUnicodeValue(), fontSize);
+ this.scaleFactor = font.calculateSclaeFactor(fontSize);
+ }
+
+ public GlyphProperty(final EsvgFont font, final int charcode, final int fontSize) {
+ this.glyph = null;
+ this.charcode = charcode;
+ this.fontSize = fontSize;
+ //this.sizeTexture = null;
+ this.scaleFactor = 0;
}
/**
@@ -68,30 +73,25 @@ public class GlyphProperty {
* @return true if the char is availlable, false otherwise
*/
public boolean exist() {
- return this.exist;
+ return this.glyph != null;
}
- public void kerningAdd(final Character charcode, final float value) {
- this.kerning.add(new Kerning(charcode, value));
+ public float getAdvenceX() {
+ if (this.glyph == null) {
+ return 500 * this.scaleFactor;
+ }
+ return this.glyph.getHorizAdvX() * this.scaleFactor;
}
- public void kerningClear() {
- this.kerning.clear();
+ public int getUnicodeValue() {
+ return this.charcode;
}
public float kerningGet(final Character charcode) {
- for (int iii = 0; iii < this.kerning.size(); iii++) {
- if (this.kerning.get(iii).uVal == charcode) {
- return this.kerning.get(iii).value;
- }
+ if (this.glyph == null) {
+ return 0;
}
- return 0;
+ return this.glyph.getKerning(charcode) * this.scaleFactor;
}
- /**
- * set the element doen not exist !!!
- */
- public void setNotExist() {
- this.exist = false;
- }
}
diff --git a/src/org/atriasoft/ewol/resource/font/Kerning.java b/src/org/atriasoft/ewol/resource/font/Kerning.java
deleted file mode 100644
index 5be19fe..0000000
--- a/src/org/atriasoft/ewol/resource/font/Kerning.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/** @file
- * @author Edouard DUPIN
- * @copyright 2011, Edouard DUPIN, all right reserved
- * @license MPL v2.0 (see license file)
- */
-package org.atriasoft.ewol.resource.font;
-
-/**
- * @notindoc
- * Kerning properties of one specific Glyph with an other
- *
- * Without Kerning :
- * [pre]
- *
- * \ / /\
- * \ / / \
- * \ / / \
- * \ / /\
- * \ / / \
- * \/ / \
- * v v a a
- * [/pre]
- *
- * With Kerning :
- * [pre]
- *
- * \ / /\
- * \ / / \
- * \ / / \
- * \ / /\
- * \ / / \
- * \/ / \
- * v a v a
- * [/pre]
- *
- * @note The "Kerning" is the methode to provide a better display for some string like
- * the "VA" has 2 letter that overlap themself. This name Kerning
- */
-public class Kerning {
- public Character uVal; //!< unicode value (the previous character that must be before)
- public float value; //!< kerning real offset
-
- /**
- * Simple ructor that allow to allocate the List element
- */
- public Kerning() {
- this.uVal = 0;
- this.value = 0;
- }
-
- /**
- * Normal ructor
- * @param charcode The Unicode value of the coresponding character that might be before
- * @param value The Kerning value of the offset (nb pixel number)
- */
- public Kerning(final Character charcode, final float value) {
- this.uVal = charcode;
- this.value = value;
- }
-}
diff --git a/src/org/atriasoft/ewol/widget/Label.java b/src/org/atriasoft/ewol/widget/Label.java
index 39c4057..a12c9c4 100644
--- a/src/org/atriasoft/ewol/widget/Label.java
+++ b/src/org/atriasoft/ewol/widget/Label.java
@@ -6,6 +6,7 @@
package org.atriasoft.ewol.widget;
import org.atriasoft.esignal.SignalEmpty;
+import org.atriasoft.etk.Color;
import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.FMath;
import org.atriasoft.etk.math.Vector2f;
@@ -15,6 +16,7 @@ import org.atriasoft.etranslate.ETranslate;
import org.atriasoft.ewol.annotation.EwolDescription;
import org.atriasoft.ewol.annotation.EwolSignal;
import org.atriasoft.ewol.compositing.AlignMode;
+import org.atriasoft.ewol.compositing.CompositingDrawing;
import org.atriasoft.ewol.compositing.CompositingText;
import org.atriasoft.ewol.event.EventInput;
import org.atriasoft.ewol.internal.Log;
@@ -50,6 +52,7 @@ public class Label extends Widget {
public SignalEmpty signalPressed = new SignalEmpty();
protected CompositingText text = new CompositingText(); //!< Compositing text element.
protected String value = "";
+ protected CompositingDrawing vectorialDraw = new CompositingDrawing();
public Label() {
this.colorProperty = ResourceColorFile.create(new Uri("THEME", "/color/Label.json", "ewol"));
@@ -80,13 +83,13 @@ public class Label extends Widget {
public void calculateMinMaxSize() {
Vector2f tmpMax = this.propertyMaxSize.getPixel();
Vector2f tmpMin = this.propertyMinSize.getPixel();
- //Log.debug("[" + getId() + "] {" + getClass().getCanonicalName() + "} tmpMax : " + tmpMax);
+ Log.debug("[" + getId() + "] {" + getClass().getCanonicalName() + "} tmpMax : " + tmpMax);
if (tmpMax.x() <= 999999) {
this.text.setTextAlignment(0, tmpMax.x() - 4, AlignMode.alignLeft);
- //Log.debug("[" + getId() + "] {" + getClass().getCanonicalName() + "} forcez Alignement ");
+ Log.debug("[" + getId() + "] {" + getClass().getCanonicalName() + "} force Alignement ");
}
Vector3f minSize = this.text.calculateSizeDecorated(this.value);
- //Log.debug("[" + getId() + "] {" + getClass().getCanonicalName() + "} minSize : " + minSize);
+ Log.debug("[" + getId() + "] {" + getClass().getCanonicalName() + "} minSize : " + minSize);
this.minSize = new Vector2f(FMath.avg(tmpMin.x(), 4 + minSize.x(), tmpMax.x()), FMath.avg(tmpMin.y(), 4 + minSize.y(), tmpMax.y()));
Log.verbose("[" + getId() + "] {" + getClass().getCanonicalName() + "} Result min size : " + tmpMin + " < " + this.minSize + " < " + tmpMax);
@@ -119,6 +122,7 @@ public class Label extends Widget {
@Override
protected void onDraw() {
this.text.draw();
+ this.vectorialDraw.draw();
}
@Override
@@ -190,6 +194,14 @@ public class Label extends Widget {
this.text.setTextAlignment(tmpTextOrigin.x(), tmpTextOrigin.x() + localSize.x(), AlignMode.alignLeft);
this.text.setClipping(drawClippingPos, drawClippingSize);
this.text.printDecorated(this.value);
+
+ this.vectorialDraw.clear();
+ this.vectorialDraw.setColor(Color.ORANGE);
+ this.vectorialDraw.setPos(new Vector3f(-1024, -1024, 0));
+ this.vectorialDraw.rectangle(new Vector3f(1024, 1024, 0));
+
+ this.text.flush();
+ this.vectorialDraw.flush();
}
public void setPropertyAutoTranslate(final boolean propertyAutoTranslate) {
diff --git a/src/org/atriasoft/ewol/widget/Spacer.java b/src/org/atriasoft/ewol/widget/Spacer.java
index 32c7a9d..be44280 100644
--- a/src/org/atriasoft/ewol/widget/Spacer.java
+++ b/src/org/atriasoft/ewol/widget/Spacer.java
@@ -18,13 +18,13 @@ import org.atriasoft.exml.annotation.XmlProperty;
/**
* @ingroup ewolWidgetGroup
*/
-class Spacer extends Widget {
- private CompositingDrawing draw; //!< Compositing drawing element
+public class Spacer extends Widget {
+ private final CompositingDrawing draw = new CompositingDrawing(); //!< Compositing drawing element
@XmlManaged
@XmlProperty
@XmlName(value = "color")
@EwolDescription(value = "background of the spacer")
- protected Color propertyColor; //!< Background color
+ protected Color propertyColor = Color.GREEN; //!< Background color
/**
* Main ructer
@@ -45,6 +45,7 @@ class Spacer extends Widget {
@Override
public void onDraw() {
this.draw.draw();
+ this.draw.flush();
}
@Override
@@ -59,7 +60,13 @@ class Spacer extends Widget {
}
this.draw.setColor(this.propertyColor);
this.draw.setPos(Vector3f.ZERO);
- this.draw.rectangleWidth(new Vector3f(this.size.x(), this.size.y(), 0));
+ this.draw.setPos(new Vector3f(this.size.x() * 0.1f, this.size.y() * 0.1f, 0));
+ this.draw.rectangleWidth(new Vector3f(this.size.x() * 0.8f, this.size.y() * 0.8f, 0));
+
+ // this.draw.setColor(Color.RED);
+ // this.draw.setPos(new Vector3f(-1024, -1024, 0));
+ // this.draw.rectangleWidth(new Vector3f(2048, 2048, 0));
+ this.draw.flush();
}
public void setPropertyTextColorBgOn(final Color propertyColor) {
diff --git a/src/org/atriasoft/ewol/widget/Widget.java b/src/org/atriasoft/ewol/widget/Widget.java
index dde031f..a0d961f 100644
--- a/src/org/atriasoft/ewol/widget/Widget.java
+++ b/src/org/atriasoft/ewol/widget/Widget.java
@@ -39,6 +39,7 @@ import org.atriasoft.gale.context.ClipboardList;
import org.atriasoft.gale.context.Cursor;
import org.atriasoft.gale.key.KeyKeyboard;
import org.atriasoft.gale.key.KeySpecial;
+import org.lwjgl.opengl.GL11;
/**
* Widget class is the main widget interface, it has so me generic properties:
@@ -864,37 +865,37 @@ public class Widget extends EwolObject {
}
/**
- * {SYSTEM} extern interface to request a draw ... (called by the drawing thread [Android, X11, ...])
- * This function generate a clipping with the view-port openGL system. Like this a widget draw can not draw over an other widget
- * @note This function is for the scrolled widget, and the more complicated openGL widget
- * @param displayProp properties of the current display
- * @note : INTERNAL EWOL SYSTEM
- /-. displayProp.this.windowsSize
- *------------------------------------------------------*
- | |
- | this.size |
- | / |
- | *-----------------------* |
- | ' ' |
- | ' displayProp.this.size ' |
- | Viewport ' / ' |
- | o---------'---------o ' |
- | | ' | ' |
- | | ' | ' |
- | | ' | ' |
- | | ' | ' |
- | | *-----------------------* |
- | | / | |
- | | this.offset | |
- | | | |
- | o-------------------o |
- | / |
- | displayProp.this.origin |
- | |
- *------------------------------------------------------*
- /
- (0,0)
- */
+ * {SYSTEM} extern interface to request a draw ... (called by the drawing thread [Android, X11, ...])
+ * This function generate a clipping with the view-port openGL system. Like this a widget draw can not draw over an other widget
+ * @note This function is for the scrolled widget, and the more complicated openGL widget
+ * @param displayProp properties of the current display
+ * @note : INTERNAL EWOL SYSTEM
+ /-. displayProp.this.windowsSize
+ *------------------------------------------------------*
+ | |
+ | this.size |
+ | / |
+ | *-----------------------* |
+ | ' ' |
+ | ' displayProp.this.size ' |
+ | Viewport ' / ' |
+ | o---------'---------o ' |
+ | | ' | ' |
+ | | ' | ' |
+ | | ' | ' |
+ | | ' | ' |
+ | | *-----------------------* |
+ | | / | |
+ | |this.offset | |
+ | | | |
+ | o-------------------o |
+ | / |
+ |displayProp.this.origin |
+ | |
+ *------------------------------------------------------*
+ /
+ (0,0)
+ */
public void systemDraw(final DrawProperty displayProp) {
//Log.info("[" + getId() + "] Draw : [" + propertyName + "] t=" + getObjectType() + " o=" + this.origin + " s=" << this.size << " hide=" << propertyHide);
if (this.propertyHide) {
@@ -913,15 +914,20 @@ public class Widget extends EwolObject {
if (tmpSize.size().x() <= 0 || tmpSize.size().y() <= 0) {
return;
}
+ Log.info("setViewport(" + tmpSize.origin() + ", " + tmpSize.size() + ")");
OpenGL.setViewPort(tmpSize.origin(), tmpSize.size());
// special case, when origin < display origin, we need to cut the display :
Vector2i downOffset = new Vector2i((int) (this.origin.x() - tmpSize.origin().x()), (int) (this.origin.y() - tmpSize.origin().y()));
downOffset = Vector2i.min(downOffset, Vector2i.ZERO);
-
+ Log.info("translate : (" + (new Vector3f(-tmpSize.size().x() / 2 + this.offset.x() + downOffset.x(), -tmpSize.size().y() / 2 + this.offset.y() + downOffset.y(), -1.0f)).clipInteger());
+ // translate the display to have a Gui 0,0 position on the Left button angle
final Matrix4f tmpTranslate = Matrix4f
.createMatrixTranslate((new Vector3f(-tmpSize.size().x() / 2 + this.offset.x() + downOffset.x(), -tmpSize.size().y() / 2 + this.offset.y() + downOffset.y(), -1.0f)).clipInteger());
+ //final Matrix4f tmpTranslate = Matrix4f.createMatrixTranslate(new Vector3f(0, 0, 1.0f));
+ // Scale if needed (feature not validate)
final Matrix4f tmpScale = Matrix4f.createMatrixScale(this.zoom, this.zoom, 1.0f);
- final Matrix4f tmpProjection = Matrix4f.createMatrixOrtho((-tmpSize.size().x()) >> 1, (tmpSize.size().x()) >> 1, (-tmpSize.size().y()) >> 1, (tmpSize.size().y()) >> 1, (-1), (1));
+ // create orthogonal projection for GUI ==> simple to manage staking
+ Matrix4f tmpProjection = Matrix4f.createMatrixOrtho(-tmpSize.size().x() / 2, tmpSize.size().x() / 2, -tmpSize.size().y() / 2, tmpSize.size().y() / 2, -50, 50);
Matrix4f tmpMat = tmpProjection.multiply(tmpScale).multiply(tmpTranslate);
OpenGL.push();
@@ -930,6 +936,7 @@ public class Widget extends EwolObject {
//long startTime = ewol::getTime();
onDraw();
OpenGL.pop();
+ GL11.glFinish();
}
/**
@@ -939,8 +946,7 @@ public class Widget extends EwolObject {
* @return false if the event has not been used
*/
public boolean systemEventEntry(final EntrySystem event) {
- final Widget up = (Widget) this.parent.get();
- if (up != null) {
+ if (this.parent != null && this.parent.get() != null && this.parent.get() instanceof Widget up) {
if (up.systemEventEntry(event)) {
return true;
}
@@ -948,13 +954,12 @@ public class Widget extends EwolObject {
return onEventEntry(event.event());
}
- // event section:
/**
- * {SYSTEM} system event input (only meta widget might overwrite this function).
- * @param event Event properties
- * @return true the event is used
- * @return false the event is not used
- */
+ * {SYSTEM} system event input (only meta widget might overwrite this function).
+ * @param event Event properties
+ * @return true the event is used
+ * @return false the event is not used
+ */
public boolean systemEventInput(final InputSystem event) {
final Widget up = (Widget) this.parent.get();
if (up != null) {
diff --git a/src/org/atriasoft/ewol/widget/Windows.java b/src/org/atriasoft/ewol/widget/Windows.java
index 0f4d583..142ec80 100644
--- a/src/org/atriasoft/ewol/widget/Windows.java
+++ b/src/org/atriasoft/ewol/widget/Windows.java
@@ -16,6 +16,7 @@ import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.ewol.DrawProperty;
import org.atriasoft.ewol.annotation.EwolDescription;
+import org.atriasoft.ewol.compositing.CompositingDrawing;
import org.atriasoft.ewol.context.EwolContext;
import org.atriasoft.ewol.internal.Log;
import org.atriasoft.ewol.object.EwolObject;
@@ -47,9 +48,11 @@ public class Windows extends Widget {
protected ResourceColorFile resourceColor = null; //!< theme color property (name of file in @ref propertyColorConfiguration)
+ protected Widget subWidget;
+
// internal event at ewol system:
- protected Widget subWidget;
+ protected CompositingDrawing vectorialDraw = new CompositingDrawing();
protected Windows() {
this.propertyCanFocus = true;
@@ -279,8 +282,10 @@ public class Windows extends Widget {
OpenGL.disable(OpenGL.Flag.flag_fog);
OpenGL.disable(OpenGL.Flag.flag_texture2D);
OpenGL.disable(OpenGL.Flag.flag_depthTest);
+ OpenGL.disable(OpenGL.Flag.flag_cullFace);
OpenGL.enable(OpenGL.Flag.flag_blend);
+ //OpenGL.enable(OpenGL.Flag.flag_cullFace);
OpenGL.blendFuncAuto();
// clear the matrix system :
@@ -300,14 +305,17 @@ public class Windows extends Widget {
colorBg = this.resourceColor.get(this.colorBg);
}
OpenGL.clearColor(colorBg);
+ OpenGL.clearColor(Color.PURPLE);
OpenGL.clear(OpenGL.ClearFlag.clearFlag_colorBuffer);
OpenGL.clear(OpenGL.ClearFlag.clearFlag_depthBuffer);
+
//Log.warning(" WINDOWS draw on " + this.currentDrawId);
// first display the windows on the display
if (this.subWidget != null) {
this.subWidget.systemDraw(displayProp);
//Log.debug("Draw Windows");
}
+
// second display the pop-up
for (Widget it : this.popUpWidgetList) {
if (it != null) {