diff --git a/.classpath b/.classpath
index bd70087..3de4651 100644
--- a/.classpath
+++ b/.classpath
@@ -5,28 +5,15 @@
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -36,10 +23,40 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/freetype-jni.jar b/lib/freetype-jni.jar
new file mode 100644
index 0000000..1156985
Binary files /dev/null and b/lib/freetype-jni.jar differ
diff --git a/lib/libfreetype-jni.so b/lib/libfreetype-jni.so
new file mode 100755
index 0000000..e0db50b
Binary files /dev/null and b/lib/libfreetype-jni.so differ
diff --git a/resources/data/color.frag b/resources/data/color.frag
new file mode 100644
index 0000000..cb8e54c
--- /dev/null
+++ b/resources/data/color.frag
@@ -0,0 +1,10 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+varying vec4 f_color;
+
+void main(void) {
+ gl_FragColor = f_color;
+}
diff --git a/resources/data/color.prog b/resources/data/color.prog
new file mode 100644
index 0000000..0a98668
--- /dev/null
+++ b/resources/data/color.prog
@@ -0,0 +1,2 @@
+color.vert
+color.frag
\ No newline at end of file
diff --git a/resources/data/color.vert b/resources/data/color.vert
new file mode 100644
index 0000000..977e7f5
--- /dev/null
+++ b/resources/data/color.vert
@@ -0,0 +1,18 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+// Input :
+attribute vec2 EW_coord2d;
+attribute vec4 EW_color;
+uniform mat4 EW_MatrixTransformation;
+
+// output :
+varying vec4 f_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;
+}
diff --git a/resources/data/color3.frag b/resources/data/color3.frag
new file mode 100644
index 0000000..0d43917
--- /dev/null
+++ b/resources/data/color3.frag
@@ -0,0 +1,10 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+varying vec4 f_color;
+
+void main(void) {
+ gl_FragColor = f_color;
+}
diff --git a/resources/data/color3.prog b/resources/data/color3.prog
new file mode 100644
index 0000000..3b4f341
--- /dev/null
+++ b/resources/data/color3.prog
@@ -0,0 +1,2 @@
+color3.vert
+color3.frag
\ No newline at end of file
diff --git a/resources/data/color3.vert b/resources/data/color3.vert
new file mode 100644
index 0000000..d12c73b
--- /dev/null
+++ b/resources/data/color3.vert
@@ -0,0 +1,18 @@
+#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;
+
+// output :
+varying vec4 f_color;
+
+void main(void) {
+ gl_Position = EW_MatrixTransformation * EW_MatrixPosition * vec4(EW_coord3d, 1.0);
+ f_color = EW_color;
+}
diff --git a/resources/data/ewol-gui-file-chooser.xml b/resources/data/ewol-gui-file-chooser.xml
new file mode 100644
index 0000000..6dde4b3
--- /dev/null
+++ b/resources/data/ewol-gui-file-chooser.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/data/fonts/FreeMono.svg b/resources/data/fonts/FreeMono.svg
new file mode 100644
index 0000000..88c79e9
--- /dev/null
+++ b/resources/data/fonts/FreeMono.svg
@@ -0,0 +1,9874 @@
+
+
+
diff --git a/resources/data/fonts/FreeMonoBold.svg b/resources/data/fonts/FreeMonoBold.svg
new file mode 100644
index 0000000..e8009c3
--- /dev/null
+++ b/resources/data/fonts/FreeMonoBold.svg
@@ -0,0 +1,5443 @@
+
+
+
diff --git a/resources/data/fonts/FreeMonoBoldOblique.svg b/resources/data/fonts/FreeMonoBoldOblique.svg
new file mode 100644
index 0000000..e1dd340
--- /dev/null
+++ b/resources/data/fonts/FreeMonoBoldOblique.svg
@@ -0,0 +1,5198 @@
+
+
+
diff --git a/resources/data/fonts/FreeMonoOblique.svg b/resources/data/fonts/FreeMonoOblique.svg
new file mode 100644
index 0000000..ba8f4bc
--- /dev/null
+++ b/resources/data/fonts/FreeMonoOblique.svg
@@ -0,0 +1,6389 @@
+
+
+
diff --git a/resources/data/fonts/FreeSans.svg b/resources/data/fonts/FreeSans.svg
new file mode 100644
index 0000000..efdc01e
--- /dev/null
+++ b/resources/data/fonts/FreeSans.svg
@@ -0,0 +1,15542 @@
+
+
+
diff --git a/resources/data/fonts/FreeSansBold.svg b/resources/data/fonts/FreeSansBold.svg
new file mode 100644
index 0000000..d16c8bd
--- /dev/null
+++ b/resources/data/fonts/FreeSansBold.svg
@@ -0,0 +1,8052 @@
+
+
+
diff --git a/resources/data/fonts/FreeSansBoldOblique.svg b/resources/data/fonts/FreeSansBoldOblique.svg
new file mode 100644
index 0000000..842491c
--- /dev/null
+++ b/resources/data/fonts/FreeSansBoldOblique.svg
@@ -0,0 +1,7236 @@
+
+
+
diff --git a/resources/data/fonts/FreeSansOblique.svg b/resources/data/fonts/FreeSansOblique.svg
new file mode 100644
index 0000000..8b8c84d
--- /dev/null
+++ b/resources/data/fonts/FreeSansOblique.svg
@@ -0,0 +1,9376 @@
+
+
+
diff --git a/resources/data/fonts/FreeSerif.svg b/resources/data/fonts/FreeSerif.svg
new file mode 100644
index 0000000..9f717de
--- /dev/null
+++ b/resources/data/fonts/FreeSerif.svg
@@ -0,0 +1,34749 @@
+
+
+
diff --git a/resources/data/icon.svg b/resources/data/icon.svg
new file mode 100644
index 0000000..5553afd
--- /dev/null
+++ b/resources/data/icon.svg
@@ -0,0 +1,67 @@
+
+
+
+
diff --git a/resources/data/simple3D.frag b/resources/data/simple3D.frag
new file mode 100644
index 0000000..cb8e54c
--- /dev/null
+++ b/resources/data/simple3D.frag
@@ -0,0 +1,10 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+varying vec4 f_color;
+
+void main(void) {
+ gl_FragColor = f_color;
+}
diff --git a/resources/data/simple3D.prog b/resources/data/simple3D.prog
new file mode 100644
index 0000000..9106c32
--- /dev/null
+++ b/resources/data/simple3D.prog
@@ -0,0 +1,2 @@
+simple3D.vert
+simple3D.frag
\ No newline at end of file
diff --git a/resources/data/simple3D.vert b/resources/data/simple3D.vert
new file mode 100644
index 0000000..cdc691a
--- /dev/null
+++ b/resources/data/simple3D.vert
@@ -0,0 +1,18 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+// Input :
+attribute vec3 EW_coord3d;
+uniform vec4 EW_color;
+uniform mat4 EW_MatrixTransformation;
+
+// output :
+varying vec4 f_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;
+}
diff --git a/resources/data/text.frag b/resources/data/text.frag
new file mode 100644
index 0000000..32a55e5
--- /dev/null
+++ b/resources/data/text.frag
@@ -0,0 +1,41 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+// Input :
+uniform sampler2D EW_texID;
+
+varying vec2 f_texcoord;
+varying vec4 f_color;
+/*
+void main(void) {
+ gl_FragColor = f_color;
+ vec2 tmpCoord = f_texcoord;
+ tmpCoord = mod(tmpCoord, 1.0);
+ vec4 map = texture2D(EW_texID, tmpCoord);
+ if (f_texcoord.x<1.0) {
+ // normal font :
+ gl_FragColor.a = gl_FragColor.a*map.a;
+ } else if (f_texcoord.x<2.0) {
+ // Italic font :
+ gl_FragColor.a = gl_FragColor.a*map.r;
+ } else if (f_texcoord.x<3.0) {
+ // Bold font :
+ gl_FragColor.a = gl_FragColor.a*map.g;
+ } else {
+ // bold italic font :
+ gl_FragColor.a = gl_FragColor.a*map.b;
+ }
+}
+*/
+
+varying vec4 f_patern;
+
+void main(void) {
+ gl_FragColor = f_color;
+ vec4 map = texture2D(EW_texID, f_texcoord);
+ float alphaCoef = dot(map, f_patern);
+ gl_FragColor.a = gl_FragColor.a*alphaCoef;
+}
+
diff --git a/resources/data/text.prog b/resources/data/text.prog
new file mode 100644
index 0000000..6b0ff18
--- /dev/null
+++ b/resources/data/text.prog
@@ -0,0 +1,2 @@
+text.vert
+text.frag
\ No newline at end of file
diff --git a/resources/data/text.vert b/resources/data/text.vert
new file mode 100644
index 0000000..c06eb71
--- /dev/null
+++ b/resources/data/text.vert
@@ -0,0 +1,47 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+// Input :
+attribute vec3 EW_coord3d;
+attribute vec2 EW_texture2d;
+attribute vec4 EW_color;
+uniform mat4 EW_MatrixTransformation;
+
+// output :
+varying vec4 f_color;
+varying vec2 f_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);
+ // set texture output coord
+ f_texcoord = EW_texture2d;
+ // set output color :
+ f_color = EW_color;
+}
+*/
+varying vec4 f_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);
+ // set output color :
+ f_color = EW_color;
+ if (EW_texture2d.x<1.0) {
+ // normal font :
+ f_patern = vec4 (0.0, 0.0, 0.0, 1.0);
+ } else if (EW_texture2d.x<2.0) {
+ // Italic font :
+ f_patern = vec4 (1.0, 0.0, 0.0, 0.0);
+ } else if (EW_texture2d.x<3.0) {
+ // Bold font :
+ f_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);
+ }
+ // set texture output coord
+ f_texcoord = mod(EW_texture2d, 1.0);
+}
+
diff --git a/resources/data/textured.frag b/resources/data/textured.frag
new file mode 100644
index 0000000..50eea1c
--- /dev/null
+++ b/resources/data/textured.frag
@@ -0,0 +1,14 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+// Input :
+uniform sampler2D EW_texID;
+
+varying vec2 f_texcoord;
+varying vec4 f_color;
+
+void main(void) {
+ gl_FragColor = texture2D(EW_texID, f_texcoord) * f_color;
+}
diff --git a/resources/data/textured.prog b/resources/data/textured.prog
new file mode 100644
index 0000000..eb053e2
--- /dev/null
+++ b/resources/data/textured.prog
@@ -0,0 +1,2 @@
+textured.vert
+textured.frag
\ No newline at end of file
diff --git a/resources/data/textured.vert b/resources/data/textured.vert
new file mode 100644
index 0000000..d5ec23e
--- /dev/null
+++ b/resources/data/textured.vert
@@ -0,0 +1,22 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+// Input :
+attribute vec2 EW_coord2d;
+attribute vec2 EW_texture2d;
+attribute vec4 EW_color;
+uniform mat4 EW_MatrixTransformation;
+
+// output :
+varying vec4 f_color;
+varying vec2 f_texcoord;
+
+void main(void) {
+ gl_Position = EW_MatrixTransformation * vec4(EW_coord2d, 0.0, 1.0);
+ // set texture output coord
+ f_texcoord = EW_texture2d;
+ // set output color :
+ f_color = EW_color;
+}
diff --git a/resources/data/textured3D.frag b/resources/data/textured3D.frag
new file mode 100644
index 0000000..ce2a070
--- /dev/null
+++ b/resources/data/textured3D.frag
@@ -0,0 +1,15 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+// Input :
+uniform sampler2D EW_texID;
+
+varying vec2 f_texcoord;
+varying vec4 f_color;
+
+void main(void) {
+ gl_FragColor = texture2D(EW_texID, f_texcoord) * f_color;
+ //gl_FragColor = vec4(1.0,1.0,0.2,0.6);
+}
diff --git a/resources/data/textured3D.prog b/resources/data/textured3D.prog
new file mode 100644
index 0000000..35578b6
--- /dev/null
+++ b/resources/data/textured3D.prog
@@ -0,0 +1,2 @@
+textured3D.vert
+textured3D.frag
\ No newline at end of file
diff --git a/resources/data/textured3D.vert b/resources/data/textured3D.vert
new file mode 100644
index 0000000..65973c9
--- /dev/null
+++ b/resources/data/textured3D.vert
@@ -0,0 +1,21 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+// Input :
+attribute vec3 EW_coord3d;
+attribute vec2 EW_texture2d;
+attribute vec4 EW_color;
+uniform mat4 EW_MatrixTransformation;
+
+// output :
+varying vec4 f_color;
+varying vec2 f_texcoord;
+
+void main(void) {
+ gl_Position = EW_MatrixTransformation * vec4(EW_coord3d, 1.0);
+ // set texture output coord
+ f_texcoord = EW_texture2d;
+ // set output color :
+ f_color = EW_color;
+}
diff --git a/resources/data/textured3D2.frag b/resources/data/textured3D2.frag
new file mode 100644
index 0000000..f37bf8e
--- /dev/null
+++ b/resources/data/textured3D2.frag
@@ -0,0 +1,55 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+struct DirectionalLight {
+ vec3 direction;
+ vec3 halfplane;
+ vec4 ambientColor;
+ vec4 diffuseColor;
+ vec4 specularColor;
+};
+
+struct Material {
+ vec4 ambientFactor;
+ vec4 diffuseFactor;
+ vec4 specularFactor;
+ float shininess;
+};
+
+// Light
+uniform DirectionalLight EW_directionalLight;
+// Material
+uniform Material EW_material;
+
+// Input :
+uniform sampler2D EW_texID;
+
+varying vec2 f_texcoord;
+varying vec3 v_ecNormal;
+
+void main(void) {
+ vec4 tmpElementColor = texture2D(EW_texID, f_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));
+
+ // Calculate ambient light
+ vec4 ambientLight = EW_directionalLight.ambientColor * EW_material.ambientFactor;
+
+ // Calculate diffuse light
+ vec4 diffuseLight = ecNormalDotLightDirection * EW_directionalLight.diffuseColor * EW_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;
+ }
+ vec4 light = ambientLight + diffuseLight + specularLight;
+ gl_FragColor = tmpElementColor;// * light;
+}
diff --git a/resources/data/textured3D2.prog b/resources/data/textured3D2.prog
new file mode 100644
index 0000000..e7330f0
--- /dev/null
+++ b/resources/data/textured3D2.prog
@@ -0,0 +1,2 @@
+textured3D2.vert
+textured3D2.frag
\ No newline at end of file
diff --git a/resources/data/textured3D2.vert b/resources/data/textured3D2.vert
new file mode 100644
index 0000000..69ddada
--- /dev/null
+++ b/resources/data/textured3D2.vert
@@ -0,0 +1,25 @@
+#ifdef GL_ES
+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;
+
+// output :
+varying vec2 f_texcoord;
+varying vec3 v_ecNormal;
+
+void main(void) {
+ gl_Position = EW_MatrixTransformation * EW_MatrixPosition * vec4(EW_coord3d, 1.0);
+ // set texture output coord
+ f_texcoord = EW_texture2d;
+ mat4 MatrixPosition = EW_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) );
+}
diff --git a/resources/data/texturedDF.frag b/resources/data/texturedDF.frag
new file mode 100644
index 0000000..8a76bc7
--- /dev/null
+++ b/resources/data/texturedDF.frag
@@ -0,0 +1,25 @@
+#ifdef GL_ES
+#extension GL_OES_standard_derivatives : enable
+precision mediump float;
+precision mediump int;
+#endif
+
+// Input :
+uniform sampler2D EW_texID;
+uniform float EW_SoftEdgeMin;
+uniform float EW_SoftEdgeMax;
+uniform int EW_SoftEdge;
+
+varying vec2 f_texcoord;
+varying vec4 f_color;
+
+
+void main(void) {
+ vec4 color = texture2D(EW_texID, f_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);
+}
diff --git a/resources/data/texturedDF.vert b/resources/data/texturedDF.vert
new file mode 100644
index 0000000..1e8591b
--- /dev/null
+++ b/resources/data/texturedDF.vert
@@ -0,0 +1,22 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+// Input :
+attribute vec3 EW_coord3d;
+attribute vec2 EW_texture2d;
+attribute vec4 EW_color;
+uniform mat4 EW_MatrixTransformation;
+
+// output :
+varying vec4 f_color;
+varying vec2 f_texcoord;
+
+void main(void) {
+ gl_Position = EW_MatrixTransformation * vec4(EW_coord3d, 1.0);
+ // set texture output coord
+ f_texcoord = EW_texture2d;
+ // set output color :
+ f_color = EW_color;
+}
\ No newline at end of file
diff --git a/resources/data/texturedNoMaterial.frag b/resources/data/texturedNoMaterial.frag
new file mode 100644
index 0000000..b6c6e2a
--- /dev/null
+++ b/resources/data/texturedNoMaterial.frag
@@ -0,0 +1,13 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+// Input:
+uniform sampler2D EW_texID;
+
+varying vec2 f_texcoord;
+
+void main(void) {
+ gl_FragColor = texture2D(EW_texID, f_texcoord);
+}
diff --git a/resources/data/texturedNoMaterial.prog b/resources/data/texturedNoMaterial.prog
new file mode 100644
index 0000000..b9a1a8f
--- /dev/null
+++ b/resources/data/texturedNoMaterial.prog
@@ -0,0 +1,2 @@
+texturedNoMaterial.vert
+texturedNoMaterial.frag
\ No newline at end of file
diff --git a/resources/data/texturedNoMaterial.vert b/resources/data/texturedNoMaterial.vert
new file mode 100644
index 0000000..6ce4ff3
--- /dev/null
+++ b/resources/data/texturedNoMaterial.vert
@@ -0,0 +1,18 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+// Input:
+attribute vec3 EW_coord3d;
+attribute vec2 EW_texture2d;
+uniform mat4 EW_MatrixTransformation;
+uniform mat4 EW_MatrixPosition;
+
+// output:
+varying vec2 f_texcoord;
+
+void main(void) {
+ // set texture output coord
+ f_texcoord = EW_texture2d;
+ gl_Position = EW_MatrixTransformation * EW_MatrixPosition * vec4(EW_coord3d, 1.0);
+}
diff --git a/resources/data/theme/color/black/Button.json b/resources/data/theme/color/black/Button.json
new file mode 100644
index 0000000..337ef3d
--- /dev/null
+++ b/resources/data/theme/color/black/Button.json
@@ -0,0 +1,10 @@
+{
+ "color": [
+ { name:"EW_background", color:"#0000" },
+ { name:"EW_border", color:"#FFF" },
+ { name:"EW_foreground", color:"#000A" },
+ { name:"EW_foregroundHover", color:"#0066" },
+ { name:"EW_foregroundSelected", color:"#060A" },
+ { name:"EW_foregroundPressed", color:"#6006" },
+ ]
+}
diff --git a/resources/data/theme/color/black/CheckBox.json b/resources/data/theme/color/black/CheckBox.json
new file mode 100644
index 0000000..095a42a
--- /dev/null
+++ b/resources/data/theme/color/black/CheckBox.json
@@ -0,0 +1,10 @@
+{
+ "color": [
+ { name:"EW_background", color:"#0000" },
+ { name:"EW_border", color:"#FFF" },
+ { name:"EW_foreground", color:"#000A" },
+ { name:"EW_foregroundHover", color:"#0066" },
+ { name:"EW_foregroundSelected", color:"#FFFA" },
+ { name:"EW_foregroundPressed", color:"#6006" },
+ ]
+}
diff --git a/resources/data/theme/color/black/ContextMenu.json b/resources/data/theme/color/black/ContextMenu.json
new file mode 100644
index 0000000..81ee65a
--- /dev/null
+++ b/resources/data/theme/color/black/ContextMenu.json
@@ -0,0 +1,7 @@
+{
+ "color": [
+ { name:"EW_background", color:"#0000" },
+ { name:"EW_border", color:"#FFFF" },
+ { name:"EW_foreground", color:"#000A" },
+ ]
+}
diff --git a/resources/data/theme/color/black/Entry.json b/resources/data/theme/color/black/Entry.json
new file mode 100644
index 0000000..0c7a498
--- /dev/null
+++ b/resources/data/theme/color/black/Entry.json
@@ -0,0 +1,13 @@
+{
+ "color": [
+ { name:"EW_background", color:"#0000" },
+ { name:"EW_foreground", color:"#000A" },
+ { name:"EW_foregroundSelected", color:"#FFF3" },
+ { name:"EW_foregroundHover", color:"#0082" },
+ { name:"EW_border", color:"#FFFF" },
+ { name:"text-foreground", color:"#CCCF" },
+ { name:"text-background", color:"#0000" },
+ { name:"text-cursor", color:"#00AF" },
+ { name:"text-selection", color:"#0A0F" },
+ ]
+}
diff --git a/resources/data/theme/color/black/Image.json b/resources/data/theme/color/black/Image.json
new file mode 100644
index 0000000..566f0e1
--- /dev/null
+++ b/resources/data/theme/color/black/Image.json
@@ -0,0 +1,5 @@
+{
+ "color": [
+ { name:"foreground", color:"#FFFF" },
+ ]
+}
diff --git a/resources/data/theme/color/black/Label.json b/resources/data/theme/color/black/Label.json
new file mode 100644
index 0000000..14d16d3
--- /dev/null
+++ b/resources/data/theme/color/black/Label.json
@@ -0,0 +1,6 @@
+{
+ "color": [
+ { name:"background", color:"#0000" },
+ { name:"foreground", color:"#FFFF" }
+ ]
+}
diff --git a/resources/data/theme/color/black/ListFileSystem.json b/resources/data/theme/color/black/ListFileSystem.json
new file mode 100644
index 0000000..31c1587
--- /dev/null
+++ b/resources/data/theme/color/black/ListFileSystem.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ { name:"text", color:"#EEEF" },
+ { name:"background1", color:"#111F" },
+ { name:"background2", color:"#333F" },
+ { name:"selected", color:"#338F" },
+ ]
+}
\ No newline at end of file
diff --git a/resources/data/theme/color/black/PopUp.json b/resources/data/theme/color/black/PopUp.json
new file mode 100644
index 0000000..8071f8e
--- /dev/null
+++ b/resources/data/theme/color/black/PopUp.json
@@ -0,0 +1,7 @@
+{
+ "color": [
+ { name:"EW_background", color:"#000A" },
+ { name:"EW_foreground", color:"#000000F8" },
+ { name:"EW_border", color:"#FFFF" },
+ ]
+}
diff --git a/resources/data/theme/color/black/WidgetScrolled.json b/resources/data/theme/color/black/WidgetScrolled.json
new file mode 100644
index 0000000..a9b0de5
--- /dev/null
+++ b/resources/data/theme/color/black/WidgetScrolled.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ { name:"EW_background", color:"#0004" },
+ { name:"EW_border", color:"#FFF" },
+ { name:"EW_foreground", color:"#FFF9" },
+ { name:"EW_foregroundPressed", color:"#6006" },
+ ]
+}
diff --git a/resources/data/theme/color/black/Windows.json b/resources/data/theme/color/black/Windows.json
new file mode 100644
index 0000000..5d5d5bf
--- /dev/null
+++ b/resources/data/theme/color/black/Windows.json
@@ -0,0 +1,5 @@
+{
+ "color": [
+ { name:"background", color:"#222F" },
+ ]
+}
diff --git a/resources/data/theme/color/white/Button.json b/resources/data/theme/color/white/Button.json
new file mode 100644
index 0000000..a15c714
--- /dev/null
+++ b/resources/data/theme/color/white/Button.json
@@ -0,0 +1,10 @@
+{
+ "color": [
+ { name:"EW_background", color:"#0000" },
+ { name:"EW_border", color:"#000" },
+ { name:"EW_foreground", color:"#8884" },
+ { name:"EW_foregroundHover", color:"#00A6" },
+ { name:"EW_foregroundSelected", color:"#0A0A" },
+ { name:"EW_foregroundPressed", color:"#A006" },
+ ]
+}
diff --git a/resources/data/theme/color/white/CheckBox.json b/resources/data/theme/color/white/CheckBox.json
new file mode 100644
index 0000000..016f8d1
--- /dev/null
+++ b/resources/data/theme/color/white/CheckBox.json
@@ -0,0 +1,10 @@
+{
+ "color": [
+ { name:"EW_background", color:"#0000" },
+ { name:"EW_border", color:"#000" },
+ { name:"EW_foreground", color:"#8884" },
+ { name:"EW_foregroundHover", color:"#00A6" },
+ { name:"EW_foregroundSelected", color:"#000A" },
+ { name:"EW_foregroundPressed", color:"#000A" },
+ ]
+}
diff --git a/resources/data/theme/color/white/ContextMenu.json b/resources/data/theme/color/white/ContextMenu.json
new file mode 100644
index 0000000..c708fd3
--- /dev/null
+++ b/resources/data/theme/color/white/ContextMenu.json
@@ -0,0 +1,7 @@
+{
+ "color": [
+ { name:"EW_background", color:"#0000" },
+ { name:"EW_border", color:"#000F" },
+ { name:"EW_foreground", color:"#FFFA" },
+ ]
+}
diff --git a/resources/data/theme/color/white/Entry.json b/resources/data/theme/color/white/Entry.json
new file mode 100644
index 0000000..4619621
--- /dev/null
+++ b/resources/data/theme/color/white/Entry.json
@@ -0,0 +1,13 @@
+{
+ "color": [
+ { name:"EW_background", color:"#0000" },
+ { name:"EW_foreground", color:"#FFFA" },
+ { name:"EW_foregroundSelected", color:"#0005" },
+ { name:"EW_foregroundHover", color:"#55F5" },
+ { name:"EW_border", color:"#000F" },
+ { name:"text-foreground", color:"#222F" },
+ { name:"text-background", color:"#0000" },
+ { name:"text-cursor", color:"#00FF" },
+ { name:"text-selection", color:"#0A0F" },
+ ]
+}
diff --git a/resources/data/theme/color/white/Image.json b/resources/data/theme/color/white/Image.json
new file mode 100644
index 0000000..54f759b
--- /dev/null
+++ b/resources/data/theme/color/white/Image.json
@@ -0,0 +1,5 @@
+{
+ "color": [
+ { name:"foreground", color:"#000F" },
+ ]
+}
diff --git a/resources/data/theme/color/white/Label.json b/resources/data/theme/color/white/Label.json
new file mode 100644
index 0000000..fa813f0
--- /dev/null
+++ b/resources/data/theme/color/white/Label.json
@@ -0,0 +1,6 @@
+{
+ "color": [
+ { name:"background", color:"#0000" },
+ { name:"foreground", color:"#000F" }
+ ]
+}
diff --git a/resources/data/theme/color/white/ListFileSystem.json b/resources/data/theme/color/white/ListFileSystem.json
new file mode 100644
index 0000000..c9d7dc1
--- /dev/null
+++ b/resources/data/theme/color/white/ListFileSystem.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ { name:"text", color:"#111F" },
+ { name:"background1", color:"#EEEF" },
+ { name:"background2", color:"#BBBF" },
+ { name:"selected", color:"#88FF" },
+ ]
+}
\ No newline at end of file
diff --git a/resources/data/theme/color/white/PopUp.json b/resources/data/theme/color/white/PopUp.json
new file mode 100644
index 0000000..00cc22e
--- /dev/null
+++ b/resources/data/theme/color/white/PopUp.json
@@ -0,0 +1,7 @@
+{
+ "color": [
+ { name:"EW_background", color:"#888A" },
+ { name:"EW_foreground", color:"#FFFFFFF0" },
+ { name:"EW_border", color:"#000F" },
+ ]
+}
\ No newline at end of file
diff --git a/resources/data/theme/color/white/WidgetScrolled.json b/resources/data/theme/color/white/WidgetScrolled.json
new file mode 100644
index 0000000..01b6465
--- /dev/null
+++ b/resources/data/theme/color/white/WidgetScrolled.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ { name:"EW_background", color:"#FFF4" },
+ { name:"EW_border", color:"#000" },
+ { name:"EW_foreground", color:"#4449" },
+ { name:"EW_foregroundPressed", color:"#B006" },
+ ]
+}
diff --git a/resources/data/theme/color/white/Windows.json b/resources/data/theme/color/white/Windows.json
new file mode 100644
index 0000000..d645bb7
--- /dev/null
+++ b/resources/data/theme/color/white/Windows.json
@@ -0,0 +1,5 @@
+{
+ "color": [
+ { name:"background", color:"#888F" },
+ ]
+}
\ No newline at end of file
diff --git a/resources/data/theme/default/Add.svg b/resources/data/theme/default/Add.svg
new file mode 100644
index 0000000..562f893
--- /dev/null
+++ b/resources/data/theme/default/Add.svg
@@ -0,0 +1,7 @@
+
+
diff --git a/resources/data/theme/default/AtoZ.svg b/resources/data/theme/default/AtoZ.svg
new file mode 100644
index 0000000..781cd3c
--- /dev/null
+++ b/resources/data/theme/default/AtoZ.svg
@@ -0,0 +1,11 @@
+
+
diff --git a/resources/data/theme/default/Attache.svg b/resources/data/theme/default/Attache.svg
new file mode 100644
index 0000000..84be150
--- /dev/null
+++ b/resources/data/theme/default/Attache.svg
@@ -0,0 +1,7 @@
+
+
diff --git a/resources/data/theme/default/CaseSensitive.svg b/resources/data/theme/default/CaseSensitive.svg
new file mode 100644
index 0000000..5ef3f6c
--- /dev/null
+++ b/resources/data/theme/default/CaseSensitive.svg
@@ -0,0 +1,13 @@
+
diff --git a/resources/data/theme/default/ChevronLeft.svg b/resources/data/theme/default/ChevronLeft.svg
new file mode 100644
index 0000000..c9c0f37
--- /dev/null
+++ b/resources/data/theme/default/ChevronLeft.svg
@@ -0,0 +1,66 @@
+
+
+
+
\ No newline at end of file
diff --git a/resources/data/theme/default/ChevronLess.svg b/resources/data/theme/default/ChevronLess.svg
new file mode 100644
index 0000000..8546660
--- /dev/null
+++ b/resources/data/theme/default/ChevronLess.svg
@@ -0,0 +1,66 @@
+
+
+
+
\ No newline at end of file
diff --git a/resources/data/theme/default/ChevronMore.svg b/resources/data/theme/default/ChevronMore.svg
new file mode 100644
index 0000000..da17476
--- /dev/null
+++ b/resources/data/theme/default/ChevronMore.svg
@@ -0,0 +1,66 @@
+
+
+
+
\ No newline at end of file
diff --git a/resources/data/theme/default/ChevronRight.svg b/resources/data/theme/default/ChevronRight.svg
new file mode 100644
index 0000000..62d1acc
--- /dev/null
+++ b/resources/data/theme/default/ChevronRight.svg
@@ -0,0 +1,66 @@
+
+
+
+
\ No newline at end of file
diff --git a/resources/data/theme/default/Close.svg b/resources/data/theme/default/Close.svg
new file mode 100644
index 0000000..ef041c8
--- /dev/null
+++ b/resources/data/theme/default/Close.svg
@@ -0,0 +1,9 @@
+
+
diff --git a/resources/data/theme/default/Contact.svg b/resources/data/theme/default/Contact.svg
new file mode 100644
index 0000000..61e6b2d
--- /dev/null
+++ b/resources/data/theme/default/Contact.svg
@@ -0,0 +1,14 @@
+
+
+
diff --git a/resources/data/theme/default/Down.svg b/resources/data/theme/default/Down.svg
new file mode 100644
index 0000000..1e34f0d
--- /dev/null
+++ b/resources/data/theme/default/Down.svg
@@ -0,0 +1,14 @@
+
diff --git a/resources/data/theme/default/FavoriteDisable.svg b/resources/data/theme/default/FavoriteDisable.svg
new file mode 100644
index 0000000..5d9e376
--- /dev/null
+++ b/resources/data/theme/default/FavoriteDisable.svg
@@ -0,0 +1,7 @@
+
+
diff --git a/resources/data/theme/default/FavoriteEnable.svg b/resources/data/theme/default/FavoriteEnable.svg
new file mode 100644
index 0000000..804bb84
--- /dev/null
+++ b/resources/data/theme/default/FavoriteEnable.svg
@@ -0,0 +1,9 @@
+
+
diff --git a/resources/data/theme/default/FavoriteMiddle.svg b/resources/data/theme/default/FavoriteMiddle.svg
new file mode 100644
index 0000000..4a3a616
--- /dev/null
+++ b/resources/data/theme/default/FavoriteMiddle.svg
@@ -0,0 +1,9 @@
+
+
diff --git a/resources/data/theme/default/File.svg b/resources/data/theme/default/File.svg
new file mode 100644
index 0000000..9cdd5b9
--- /dev/null
+++ b/resources/data/theme/default/File.svg
@@ -0,0 +1,4 @@
+
diff --git a/resources/data/theme/default/Folder.svg b/resources/data/theme/default/Folder.svg
new file mode 100644
index 0000000..3f309e2
--- /dev/null
+++ b/resources/data/theme/default/Folder.svg
@@ -0,0 +1,7 @@
+
+
diff --git a/resources/data/theme/default/Forbidden.svg b/resources/data/theme/default/Forbidden.svg
new file mode 100644
index 0000000..fa523d0
--- /dev/null
+++ b/resources/data/theme/default/Forbidden.svg
@@ -0,0 +1,60 @@
+
+
diff --git a/resources/data/theme/default/Help.svg b/resources/data/theme/default/Help.svg
new file mode 100644
index 0000000..8dd63d7
--- /dev/null
+++ b/resources/data/theme/default/Help.svg
@@ -0,0 +1,7 @@
+
+
diff --git a/resources/data/theme/default/Home.svg b/resources/data/theme/default/Home.svg
new file mode 100644
index 0000000..4aa0a07
--- /dev/null
+++ b/resources/data/theme/default/Home.svg
@@ -0,0 +1,11 @@
+
+
diff --git a/resources/data/theme/default/Info.svg b/resources/data/theme/default/Info.svg
new file mode 100644
index 0000000..3c957ff
--- /dev/null
+++ b/resources/data/theme/default/Info.svg
@@ -0,0 +1,7 @@
+
+
diff --git a/resources/data/theme/default/List.svg b/resources/data/theme/default/List.svg
new file mode 100644
index 0000000..8f2414a
--- /dev/null
+++ b/resources/data/theme/default/List.svg
@@ -0,0 +1,11 @@
+
+
diff --git a/resources/data/theme/default/Load.svg b/resources/data/theme/default/Load.svg
new file mode 100644
index 0000000..926fb25
--- /dev/null
+++ b/resources/data/theme/default/Load.svg
@@ -0,0 +1,7 @@
+
+
diff --git a/resources/data/theme/default/Lock.svg b/resources/data/theme/default/Lock.svg
new file mode 100644
index 0000000..b4d88e6
--- /dev/null
+++ b/resources/data/theme/default/Lock.svg
@@ -0,0 +1,7 @@
+
+
diff --git a/resources/data/theme/default/Next.svg b/resources/data/theme/default/Next.svg
new file mode 100644
index 0000000..8ac2c93
--- /dev/null
+++ b/resources/data/theme/default/Next.svg
@@ -0,0 +1,7 @@
+
+
diff --git a/resources/data/theme/default/OpenMenu.svg b/resources/data/theme/default/OpenMenu.svg
new file mode 100644
index 0000000..7754b5e
--- /dev/null
+++ b/resources/data/theme/default/OpenMenu.svg
@@ -0,0 +1,9 @@
+
+
diff --git a/resources/data/theme/default/Parameter.svg b/resources/data/theme/default/Parameter.svg
new file mode 100644
index 0000000..5eeed26
--- /dev/null
+++ b/resources/data/theme/default/Parameter.svg
@@ -0,0 +1,61 @@
+
+
diff --git a/resources/data/theme/default/Previous.svg b/resources/data/theme/default/Previous.svg
new file mode 100644
index 0000000..08c79b5
--- /dev/null
+++ b/resources/data/theme/default/Previous.svg
@@ -0,0 +1,7 @@
+
+
diff --git a/resources/data/theme/default/Quit.svg b/resources/data/theme/default/Quit.svg
new file mode 100644
index 0000000..bc512d1
--- /dev/null
+++ b/resources/data/theme/default/Quit.svg
@@ -0,0 +1,9 @@
+
+
diff --git a/resources/data/theme/default/Redo.svg b/resources/data/theme/default/Redo.svg
new file mode 100644
index 0000000..a76f98c
--- /dev/null
+++ b/resources/data/theme/default/Redo.svg
@@ -0,0 +1,12 @@
+
+
diff --git a/resources/data/theme/default/Remove.svg b/resources/data/theme/default/Remove.svg
new file mode 100644
index 0000000..e4c4d79
--- /dev/null
+++ b/resources/data/theme/default/Remove.svg
@@ -0,0 +1,7 @@
+
+
diff --git a/resources/data/theme/default/Remove2.svg b/resources/data/theme/default/Remove2.svg
new file mode 100644
index 0000000..29be9c9
--- /dev/null
+++ b/resources/data/theme/default/Remove2.svg
@@ -0,0 +1,63 @@
+
+
diff --git a/resources/data/theme/default/Replace.svg b/resources/data/theme/default/Replace.svg
new file mode 100644
index 0000000..2d59c32
--- /dev/null
+++ b/resources/data/theme/default/Replace.svg
@@ -0,0 +1,15 @@
+
diff --git a/resources/data/theme/default/SDCard.svg b/resources/data/theme/default/SDCard.svg
new file mode 100644
index 0000000..1b434d3
--- /dev/null
+++ b/resources/data/theme/default/SDCard.svg
@@ -0,0 +1,7 @@
+
+
diff --git a/resources/data/theme/default/Save.svg b/resources/data/theme/default/Save.svg
new file mode 100644
index 0000000..138c8a4
--- /dev/null
+++ b/resources/data/theme/default/Save.svg
@@ -0,0 +1,16 @@
+
+
\ No newline at end of file
diff --git a/resources/data/theme/default/Search.svg b/resources/data/theme/default/Search.svg
new file mode 100644
index 0000000..272fb0b
--- /dev/null
+++ b/resources/data/theme/default/Search.svg
@@ -0,0 +1,49 @@
+
+
diff --git a/resources/data/theme/default/Trash.svg b/resources/data/theme/default/Trash.svg
new file mode 100644
index 0000000..c7765e9
--- /dev/null
+++ b/resources/data/theme/default/Trash.svg
@@ -0,0 +1,9 @@
+
+
diff --git a/resources/data/theme/default/Undo.svg b/resources/data/theme/default/Undo.svg
new file mode 100644
index 0000000..2cdc7f8
--- /dev/null
+++ b/resources/data/theme/default/Undo.svg
@@ -0,0 +1,12 @@
+
+
diff --git a/resources/data/theme/default/Up.svg b/resources/data/theme/default/Up.svg
new file mode 100644
index 0000000..273a0fe
--- /dev/null
+++ b/resources/data/theme/default/Up.svg
@@ -0,0 +1,14 @@
+
diff --git a/resources/data/theme/default/Update.svg b/resources/data/theme/default/Update.svg
new file mode 100644
index 0000000..67286a1
--- /dev/null
+++ b/resources/data/theme/default/Update.svg
@@ -0,0 +1,9 @@
+
+
diff --git a/resources/data/theme/default/Validate.svg b/resources/data/theme/default/Validate.svg
new file mode 100644
index 0000000..54e9f80
--- /dev/null
+++ b/resources/data/theme/default/Validate.svg
@@ -0,0 +1,7 @@
+
+
diff --git a/resources/data/theme/default/VolumeMax.svg b/resources/data/theme/default/VolumeMax.svg
new file mode 100644
index 0000000..181f34d
--- /dev/null
+++ b/resources/data/theme/default/VolumeMax.svg
@@ -0,0 +1,13 @@
+
+
diff --git a/resources/data/theme/default/VolumeMute.svg b/resources/data/theme/default/VolumeMute.svg
new file mode 100644
index 0000000..a28cefb
--- /dev/null
+++ b/resources/data/theme/default/VolumeMute.svg
@@ -0,0 +1,9 @@
+
+
diff --git a/resources/data/theme/default/Warning.svg b/resources/data/theme/default/Warning.svg
new file mode 100644
index 0000000..2e1cbd7
--- /dev/null
+++ b/resources/data/theme/default/Warning.svg
@@ -0,0 +1,7 @@
+
+
diff --git a/resources/data/theme/default/WhereAmI.svg b/resources/data/theme/default/WhereAmI.svg
new file mode 100644
index 0000000..80e6032
--- /dev/null
+++ b/resources/data/theme/default/WhereAmI.svg
@@ -0,0 +1,17 @@
+
+
diff --git a/resources/data/theme/default/WrapAround.svg b/resources/data/theme/default/WrapAround.svg
new file mode 100644
index 0000000..116be27
--- /dev/null
+++ b/resources/data/theme/default/WrapAround.svg
@@ -0,0 +1,13 @@
+
diff --git a/resources/data/theme/default/ZoomIn.svg b/resources/data/theme/default/ZoomIn.svg
new file mode 100644
index 0000000..25578fc
--- /dev/null
+++ b/resources/data/theme/default/ZoomIn.svg
@@ -0,0 +1,9 @@
+
+
diff --git a/resources/data/theme/shape/round/Button.frag b/resources/data/theme/shape/round/Button.frag
new file mode 100644
index 0000000..21e7245
--- /dev/null
+++ b/resources/data/theme/shape/round/Button.frag
@@ -0,0 +1,27 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+// transmit from the vertex shader
+varying vec2 v_propPos;
+varying vec4 v_colorTansition;
+
+uniform vec4 EW_border;
+uniform vec4 EW_background;
+
+void main(void) {
+ // vec2 circleMode = smoothstep(ratioLow, ratio, positionCenter)*(S_roundedRatio+S_sizePadding);
+ // Calculate the distance of the radius
+ float tmpDist = sqrt(dot(v_propPos,v_propPos));
+ // Generate the internal rampe for the the imput drawing
+ float tmpVal = smoothstep(0.6, 0.7, tmpDist);
+ // set Background
+ gl_FragColor = mix(v_colorTansition, EW_background, tmpVal);
+ // Generate the internal rampe for the the imput drawing
+ float tmpValBorder = 0.7 - abs(tmpDist - 0.7);
+ float tmpBorder = smoothstep(0.5, 0.7, tmpValBorder);
+ // set Border
+ gl_FragColor = mix(gl_FragColor, EW_border, tmpBorder);
+}
+
diff --git a/resources/data/theme/shape/round/Button.json b/resources/data/theme/shape/round/Button.json
new file mode 100644
index 0000000..8da1a6a
--- /dev/null
+++ b/resources/data/theme/shape/round/Button.json
@@ -0,0 +1,23 @@
+{
+ mode:3,
+ display-outside:false,
+
+ padding-out-left:1,
+ padding-out-right:1,
+ padding-out-top:1,
+ padding-out-buttom:1,
+
+ border-left:12,
+ border-right:12,
+ border-top:12,
+ border-buttom:12,
+
+ padding-in-left:1,
+ padding-in-right:1,
+ padding-in-top:1,
+ padding-in-buttom:1,
+
+ change-time:356,
+ program:"THEME_GUI:///Button.prog?lib=ewol",
+ color:"THEME_COLOR:///Button.json?lib=ewol"
+}
diff --git a/resources/data/theme/shape/round/Button.vert b/resources/data/theme/shape/round/Button.vert
new file mode 100644
index 0000000..f421b12
--- /dev/null
+++ b/resources/data/theme/shape/round/Button.vert
@@ -0,0 +1,51 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+struct widgetStateProperty {
+ int stateOld;
+ int stateNew;
+ float transition;
+};
+
+uniform widgetStateProperty EW_status;
+
+// Input :
+attribute vec2 EW_coord2d;
+attribute vec2 EW_widgetPropertyPos;
+uniform mat4 EW_MatrixTransformation;
+uniform vec4 EW_foreground;
+uniform vec4 EW_foregroundHover;
+uniform vec4 EW_foregroundSelected;
+uniform vec4 EW_foregroundPressed;
+
+// output :
+varying vec2 v_propPos;
+varying vec4 v_colorTansition;
+
+void main(void) {
+ gl_Position = EW_MatrixTransformation * vec4(EW_coord2d, 0.0, 1.0);
+ v_propPos = EW_widgetPropertyPos;
+
+ vec4 colorOld = EW_foreground;
+ if(EW_status.stateOld == 1) {
+ colorOld = EW_foregroundPressed;
+ } else if(EW_status.stateOld == 2) {
+ colorOld = EW_foregroundHover;
+ } else if(EW_status.stateOld == 3) {
+ colorOld = EW_foregroundSelected;
+ }
+ vec4 colorNew = EW_foreground;
+ if(EW_status.stateNew == 1) {
+ colorNew = EW_foregroundPressed;
+ } else if(EW_status.stateNew == 2) {
+ colorNew = EW_foregroundHover;
+ } else if(EW_status.stateNew == 3) {
+ colorNew = EW_foregroundSelected;
+ }
+
+ // note : int() is needed for the OpenGL ES platform
+ v_colorTansition = colorOld * (1.0 - EW_status.transition)
+ + colorNew * EW_status.transition;
+}
diff --git a/resources/data/theme/shape/round/CheckBox.frag b/resources/data/theme/shape/round/CheckBox.frag
new file mode 100644
index 0000000..a9df069
--- /dev/null
+++ b/resources/data/theme/shape/round/CheckBox.frag
@@ -0,0 +1,70 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+struct widgetStateProperty {
+ int activate;
+ int stateOld;
+ int stateNew;
+ float transition;
+};
+
+uniform widgetStateProperty EW_status;
+
+// transmit from the vertex shader
+varying vec2 v_position; // interpolated position ...
+varying vec2 v_propPos;
+varying vec4 v_colorTansition;
+varying vec4 v_colorBorder;
+varying vec4 v_colorBackground;
+varying vec4 v_colorInside;
+
+// internal static define
+float S_sizePadding = 3.0; // must not be NULL
+float S_sizeBorder = 1.0; //==> this id for 1 px border
+float S_roundedRatio = 10.0;
+
+
+void main(void) {
+ // position form center :
+ vec2 ratio = EW_widgetProperty.size / 2.0;
+
+ // prevent origin moving ...
+ vec2 position = v_position - EW_widgetProperty.origin;
+
+ /* generate a central simetry
+ ____ _____
+ \ /
+ \ /
+ \ /
+ -
+ */
+ vec2 positionCenter = abs(position-ratio);
+ // This is a clip to remove center of the display of the widget
+ vec2 ratioLow = ratio - (S_roundedRatio+S_sizePadding);
+ vec2 circleMode = smoothstep(ratioLow, ratio, positionCenter)*(S_roundedRatio+S_sizePadding);
+ // Calculate the distance of the radius
+ float tmpDist = float(int(sqrt(dot(circleMode,circleMode))));
+ // Generate the internal rampe for the the imput drawing
+ float tmpVal = smoothstep(S_roundedRatio - S_sizeBorder*1.5,
+ S_roundedRatio + S_sizeBorder*1.5,
+ tmpDist);
+ // set Background
+ gl_FragColor = v_colorBackground;
+ // set foreground
+ gl_FragColor = gl_FragColor*tmpVal + v_colorTansition*(1.0-tmpVal);
+ // set border
+ float tmpVal2 = abs(tmpVal-0.5)*2.0;
+ gl_FragColor = gl_FragColor*tmpVal2 + v_colorBorder*(1.0-tmpVal2);
+
+ // prevent origin moving ...
+ position = v_position - EW_widgetProperty.insidePos - EW_widgetProperty.insideSize*0.5;
+ position = position / EW_widgetProperty.insideSize;
+
+ if (sqrt(dot(position, position)) <= 1.0) {
+ gl_FragColor = v_colorInside;
+ }
+
+}
+
diff --git a/resources/data/theme/shape/round/CheckBox.json b/resources/data/theme/shape/round/CheckBox.json
new file mode 100644
index 0000000..cf8c21e
--- /dev/null
+++ b/resources/data/theme/shape/round/CheckBox.json
@@ -0,0 +1,11 @@
+
+ box-size:20,
+ box-inside:12,
+ padding-left:10,
+ padding-right:10,
+ padding-top:10,
+ padding-buttom:10,
+ change-time:356,
+ program:"THEME_GUI:///CheckBox.prog?lib=ewol",
+ color:"THEME_COLOR:///CheckBox.json?lib=ewol"
+}
diff --git a/resources/data/theme/shape/round/CheckBox.vert b/resources/data/theme/shape/round/CheckBox.vert
new file mode 100644
index 0000000..e1c5aae
--- /dev/null
+++ b/resources/data/theme/shape/round/CheckBox.vert
@@ -0,0 +1,63 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+struct widgetStateProperty {
+ int activate;
+ int stateOld;
+ int stateNew;
+ float transition;
+};
+
+uniform widgetStateProperty EW_status;
+
+// Input :
+attribute vec2 EW_coord2d;
+attribute vec2 EW_widgetPropertyPos;
+uniform mat4 EW_MatrixTransformation;
+uniform vec4 EW_border;
+uniform vec4 EW_background;
+uniform vec4 EW_foreground;
+uniform vec4 EW_foregroundHover;
+uniform vec4 EW_foregroundSelected;
+uniform vec4 EW_foregroundPressed;
+
+// output :
+varying vec2 v_position; // This will be passed into the fragment shader.
+varying vec2 v_propPos;
+varying vec4 v_colorTansition;
+varying vec4 v_colorBorder;
+varying vec4 v_colorBackground;
+varying vec4 v_colorInside;
+
+void main(void) {
+ gl_Position = EW_MatrixTransformation * vec4(EW_coord2d, 0.0, 1.0);
+ // transmit position of the curent element (intermolated ...)
+ v_position = EW_coord2d;
+ v_propPos = EW_widgetPropertyPos;
+
+ vec4 colorOld = EW_foreground;
+ if(EW_status.stateOld == 1) {
+ colorOld = EW_foregroundPressed;
+ } else if(EW_status.stateOld == 2) {
+ colorOld = EW_foregroundHover;
+ }
+ vec4 colorNew = EW_foreground;
+ if(EW_status.stateNew == 1) {
+ colorNew = EW_foregroundPressed;
+ } else if(EW_status.stateNew == 2) {
+ colorNew = EW_foregroundHover;
+ }
+
+ v_colorInside = EW_foreground;
+ if (EW_status.activate == 1) {
+ v_colorInside = EW_foregroundSelected;
+ }
+
+ // note : int() is needed for the OpenGL ES platform
+ v_colorTansition = colorOld * (1.0 - EW_status.transition)
+ + colorNew * EW_status.transition;
+ v_colorBorder = EW_border;
+ v_colorBackground = EW_background;
+}
diff --git a/resources/data/theme/shape/round/ContextMenu.frag b/resources/data/theme/shape/round/ContextMenu.frag
new file mode 100644
index 0000000..2c1052f
--- /dev/null
+++ b/resources/data/theme/shape/round/ContextMenu.frag
@@ -0,0 +1,26 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+uniform vec4 EW_background;
+uniform vec4 EW_foreground;
+uniform vec4 EW_border;
+
+varying vec2 v_propPos;
+
+void main(void) {
+ // vec2 circleMode = smoothstep(ratioLow, ratio, positionCenter)*(S_roundedRatio+S_sizePadding);
+ // Calculate the distance of the radius
+ float tmpDist = sqrt(dot(v_propPos,v_propPos));
+ // Generate the internal rampe for the the imput drawing
+ float tmpVal = smoothstep(0.6, 0.7, tmpDist);
+ // set Background
+ gl_FragColor = mix(EW_foreground, EW_background, tmpVal);
+ // Generate the internal rampe for the the imput drawing
+ float tmpValBorder = 0.7 - abs(tmpDist - 0.7);
+ float tmpBorder = smoothstep(0.5, 0.7, tmpValBorder);
+ // set Border
+ gl_FragColor = mix(gl_FragColor, EW_border, tmpBorder);
+}
+
diff --git a/resources/data/theme/shape/round/ContextMenu.json b/resources/data/theme/shape/round/ContextMenu.json
new file mode 100644
index 0000000..e8923b5
--- /dev/null
+++ b/resources/data/theme/shape/round/ContextMenu.json
@@ -0,0 +1,23 @@
+{
+ mode:3,
+ display-outside:false,
+
+ padding-out-left:1,
+ padding-out-right:1,
+ padding-out-top:1,
+ padding-out-buttom:1,
+
+ border-left:12,
+ border-right:12,
+ border-top:12,
+ border-buttom:12,
+
+ padding-in-left:1,
+ padding-in-right:1,
+ padding-in-top:1,
+ padding-in-buttom:1,
+
+ change-time:356,
+ program:"THEME_GUI:///ContextMenu.prog?lib=ewol",
+ color:"THEME_COLOR:///ContextMenu.json?lib=ewol"
+}
diff --git a/resources/data/theme/shape/round/ContextMenu.vert b/resources/data/theme/shape/round/ContextMenu.vert
new file mode 100644
index 0000000..d4da54e
--- /dev/null
+++ b/resources/data/theme/shape/round/ContextMenu.vert
@@ -0,0 +1,17 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+// Input :
+attribute vec2 EW_coord2d;
+attribute vec2 EW_widgetPropertyPos;
+uniform mat4 EW_MatrixTransformation;
+
+// output :
+varying vec2 v_propPos;
+
+void main(void) {
+ gl_Position = EW_MatrixTransformation * vec4(EW_coord2d, 0.0, 1.0);
+ v_propPos = EW_widgetPropertyPos;
+}
diff --git a/resources/data/theme/shape/round/Entry.frag b/resources/data/theme/shape/round/Entry.frag
new file mode 100644
index 0000000..8544ce8
--- /dev/null
+++ b/resources/data/theme/shape/round/Entry.frag
@@ -0,0 +1,28 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+
+// transmit from the vertex shader
+varying vec2 v_propPos;
+
+uniform vec4 EW_background;
+uniform vec4 EW_foreground;
+uniform vec4 EW_border;
+
+void main(void) {
+ // vec2 circleMode = smoothstep(ratioLow, ratio, positionCenter)*(S_roundedRatio+S_sizePadding);
+ // Calculate the distance of the radius
+ float tmpDist = sqrt(dot(v_propPos,v_propPos));
+ // Generate the internal rampe for the the imput drawing
+ float tmpVal = smoothstep(0.6, 0.7, tmpDist);
+ // set Background
+ gl_FragColor = mix(EW_foreground, EW_background, tmpVal);
+ // Generate the internal rampe for the the imput drawing
+ float tmpValBorder = 0.7 - abs(tmpDist - 0.7);
+ float tmpBorder = smoothstep(0.5, 0.7, tmpValBorder);
+ // set Border
+ gl_FragColor = mix(gl_FragColor, EW_border, tmpBorder);
+}
+
diff --git a/resources/data/theme/shape/round/Entry.json b/resources/data/theme/shape/round/Entry.json
new file mode 100644
index 0000000..d812b70
--- /dev/null
+++ b/resources/data/theme/shape/round/Entry.json
@@ -0,0 +1,23 @@
+{
+ mode:3,
+ display-outside:false,
+
+ padding-out-left:1,
+ padding-out-right:1,
+ padding-out-top:1,
+ padding-out-buttom:1,
+
+ border-left:12,
+ border-right:12,
+ border-top:12,
+ border-buttom:12,
+
+ padding-in-left:1,
+ padding-in-right:1,
+ padding-in-top:1,
+ padding-in-buttom:1,
+
+ change-time:356,
+ program:"THEME_GUI:///Entry.prog?lib=ewol",
+ color:"THEME_COLOR:///Entry.json?lib=ewol"
+}
diff --git a/resources/data/theme/shape/round/Entry.vert b/resources/data/theme/shape/round/Entry.vert
new file mode 100644
index 0000000..d4da54e
--- /dev/null
+++ b/resources/data/theme/shape/round/Entry.vert
@@ -0,0 +1,17 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+// Input :
+attribute vec2 EW_coord2d;
+attribute vec2 EW_widgetPropertyPos;
+uniform mat4 EW_MatrixTransformation;
+
+// output :
+varying vec2 v_propPos;
+
+void main(void) {
+ gl_Position = EW_MatrixTransformation * vec4(EW_coord2d, 0.0, 1.0);
+ v_propPos = EW_widgetPropertyPos;
+}
diff --git a/resources/data/theme/shape/round/PopUp.frag b/resources/data/theme/shape/round/PopUp.frag
new file mode 100644
index 0000000..cdf00b2
--- /dev/null
+++ b/resources/data/theme/shape/round/PopUp.frag
@@ -0,0 +1,26 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+// transmit from the vertex shader
+varying vec2 v_propPos;
+
+uniform vec4 EW_background;
+uniform vec4 EW_foreground;
+uniform vec4 EW_border;
+
+void main(void) {
+ // vec2 circleMode = smoothstep(ratioLow, ratio, positionCenter)*(S_roundedRatio+S_sizePadding);
+ // Calculate the distance of the radius
+ float tmpDist = sqrt(dot(v_propPos,v_propPos));
+ // Generate the internal rampe for the the imput drawing
+ float tmpVal = smoothstep(0.6, 0.7, tmpDist);
+ // set Background
+ gl_FragColor = mix(EW_foreground, EW_background, tmpVal);
+ // Generate the internal rampe for the the imput drawing
+ float tmpValBorder = 0.7 - abs(tmpDist - 0.7);
+ float tmpBorder = smoothstep(0.5, 0.7, tmpValBorder);
+ // set Border
+ gl_FragColor = mix(gl_FragColor, EW_border, tmpBorder);
+}
\ No newline at end of file
diff --git a/resources/data/theme/shape/round/PopUp.json b/resources/data/theme/shape/round/PopUp.json
new file mode 100644
index 0000000..1a570f9
--- /dev/null
+++ b/resources/data/theme/shape/round/PopUp.json
@@ -0,0 +1,23 @@
+{
+ mode:3,
+ display-outside:false,
+
+ padding-out-left:1,
+ padding-out-right:1,
+ padding-out-top:1,
+ padding-out-buttom:1,
+
+ border-left:12,
+ border-right:12,
+ border-top:12,
+ border-buttom:12,
+
+ padding-in-left:1,
+ padding-in-right:1,
+ padding-in-top:1,
+ padding-in-buttom:1,
+
+ change-time:356,
+ program:"THEME_GUI:///PopUp.prog?lib=ewol,
+ color:"THEME_COLOR:///PopUp.json?lib=ewol"
+}
diff --git a/resources/data/theme/shape/round/PopUp.vert b/resources/data/theme/shape/round/PopUp.vert
new file mode 100644
index 0000000..399e312
--- /dev/null
+++ b/resources/data/theme/shape/round/PopUp.vert
@@ -0,0 +1,20 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+// Input :
+attribute vec2 EW_coord2d;
+attribute vec2 EW_widgetPropertyPos;
+uniform mat4 EW_MatrixTransformation;
+
+// output :
+varying vec2 v_position; // This will be passed into the fragment shader.
+varying vec2 v_propPos;
+
+void main(void) {
+ gl_Position = EW_MatrixTransformation * vec4(EW_coord2d, 0.0, 1.0);
+ // transmit position of the curent element (intermolated ...)
+ v_position = EW_coord2d;
+ v_propPos = EW_widgetPropertyPos;
+}
diff --git a/resources/data/theme/shape/round/WidgetScrolled.frag b/resources/data/theme/shape/round/WidgetScrolled.frag
new file mode 100644
index 0000000..7c788f6
--- /dev/null
+++ b/resources/data/theme/shape/round/WidgetScrolled.frag
@@ -0,0 +1,60 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+struct widgetStateProperty {
+ int stateOld;
+ int stateNew;
+ float transition;
+};
+
+uniform widgetStateProperty EW_status;
+
+// transmit from the vertex shader
+varying vec2 v_position; // interpolated position ...
+varying vec2 v_propPos;
+varying vec4 v_colorTansition;
+varying vec4 v_colorBorder;
+varying vec4 v_colorBackground;
+
+// internal static define
+float S_sizePadding = 2.0; // must not be NULL
+float S_sizeBorder = 1.3; //==> this id for 1 px border
+float S_roundedRatio = 6.0;
+
+
+void main(void) {
+ // position form center :
+ vec2 ratio = EW_widgetProperty.insideSize / 2.0;
+
+ // prevent origin moving ...
+ vec2 position = v_position - EW_widgetProperty.insidePos;
+
+ /* generate a central simetry
+ ____ _____
+ \ /
+ \ /
+ \ /
+ -
+ */
+ vec2 positionCenter = abs(position-ratio);
+ // This is a clip to remove center of the display of the widget
+ vec2 ratioLow = ratio - (S_roundedRatio+S_sizePadding);
+ vec2 circleMode = smoothstep(ratioLow, ratio, positionCenter)*(S_roundedRatio+S_sizePadding);
+ // Calculate the distance of the radius
+ float tmpDist = float(int(sqrt(dot(circleMode,circleMode))));
+ // Generate the internal rampe for the the imput drawing
+ float tmpVal = smoothstep(S_roundedRatio - S_sizeBorder*1.5,
+ S_roundedRatio + S_sizeBorder*1.5,
+ tmpDist);
+ // set Background
+ gl_FragColor = v_colorBackground;
+ // set foreground
+ gl_FragColor = gl_FragColor*tmpVal + v_colorTansition*(1.0-tmpVal);
+ // set border
+ float tmpVal2 = abs(tmpVal-0.5)*2.0;
+ gl_FragColor = gl_FragColor*tmpVal2 + v_colorBorder*(1.0-tmpVal2);
+
+}
+
diff --git a/resources/data/theme/shape/round/WidgetScrolled.json b/resources/data/theme/shape/round/WidgetScrolled.json
new file mode 100644
index 0000000..52bb594
--- /dev/null
+++ b/resources/data/theme/shape/round/WidgetScrolled.json
@@ -0,0 +1,9 @@
+{
+ padding-left:16,
+ padding-right:16,
+ padding-top:16,
+ padding-buttom:16,
+ change-time:200,
+ program:"THEME_GUI:///WidgetScrolled.prog?lib=ewol",
+ color:"THEME_COLOR:///WidgetScrolled.json?lib=ewol"
+}
diff --git a/resources/data/theme/shape/round/WidgetScrolled.vert b/resources/data/theme/shape/round/WidgetScrolled.vert
new file mode 100644
index 0000000..615f188
--- /dev/null
+++ b/resources/data/theme/shape/round/WidgetScrolled.vert
@@ -0,0 +1,50 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+struct widgetStateProperty {
+ int stateOld;
+ int stateNew;
+ float transition;
+};
+
+uniform widgetStateProperty EW_status;
+
+// Input :
+attribute vec2 EW_coord2d;
+attribute vec2 EW_widgetPropertyPos;
+uniform mat4 EW_MatrixTransformation;
+uniform vec4 EW_border;
+uniform vec4 EW_background;
+uniform vec4 EW_foreground;
+uniform vec4 EW_foregroundPressed;
+
+// output :
+varying vec2 v_position; // This will be passed into the fragment shader.
+varying vec2 v_propPos;
+varying vec4 v_colorTansition;
+varying vec4 v_colorBorder;
+varying vec4 v_colorBackground;
+
+void main(void) {
+ gl_Position = EW_MatrixTransformation * vec4(EW_coord2d, 0.0, 1.0);
+ // transmit position of the curent element (intermolated ...)
+ v_position = EW_coord2d;
+ v_propPos = EW_widgetPropertyPos;
+
+ vec4 colorOld = EW_foreground;
+ if(EW_status.stateOld == 1) {
+ colorOld = EW_foregroundPressed;
+ }
+ vec4 colorNew = EW_foreground;
+ if(EW_status.stateNew == 1) {
+ colorNew = EW_foregroundPressed;
+ }
+
+ // note : int() is needed for the OpenGL ES platform
+ v_colorTansition = colorOld * (1.0 - EW_status.transition)
+ + colorNew * EW_status.transition;
+ v_colorBorder = EW_border;
+ v_colorBackground = EW_background;
+}
diff --git a/resources/data/theme/shape/square/Button.frag b/resources/data/theme/shape/square/Button.frag
new file mode 100644
index 0000000..d8e7a96
--- /dev/null
+++ b/resources/data/theme/shape/square/Button.frag
@@ -0,0 +1,26 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+// transmit from the vertex shader
+varying vec2 v_propPos;
+varying vec4 v_colorTansition;
+uniform vec4 EW_border;
+uniform vec4 EW_background;
+
+
+void main(void) {
+ // prevent origin moving ...
+ gl_FragColor = vec4(v_propPos.y, v_propPos.x, 1.0, 1.0);
+ if( v_propPos.x == 1.0
+ && v_propPos.y == 1.0) {
+ gl_FragColor = v_colorTansition;
+ } else if ( v_propPos.x == 0.0
+ || v_propPos.y == 0.0) {
+ gl_FragColor = EW_background;
+ } else {
+ gl_FragColor = EW_border;
+ }
+}
+
diff --git a/resources/data/theme/shape/square/Button.json b/resources/data/theme/shape/square/Button.json
new file mode 100644
index 0000000..b2a5ce8
--- /dev/null
+++ b/resources/data/theme/shape/square/Button.json
@@ -0,0 +1,23 @@
+{
+ mode:2,
+ display-outside:false,
+
+ padding-out-left:1,
+ padding-out-right:1,
+ padding-out-top:1,
+ padding-out-buttom:1,
+
+ border-left:1,
+ border-right:1,
+ border-top:1,
+ border-buttom:1,
+
+ padding-in-left:1,
+ padding-in-right:1,
+ padding-in-top:1,
+ padding-in-buttom:1,
+
+ change-time:356,
+ program:"THEME_GUI:///Button.prog?lib=ewol",
+ color:"THEME_COLOR:///Button.json?lib=ewol"
+}
diff --git a/resources/data/theme/shape/square/Button.vert b/resources/data/theme/shape/square/Button.vert
new file mode 100644
index 0000000..7c66c3c
--- /dev/null
+++ b/resources/data/theme/shape/square/Button.vert
@@ -0,0 +1,52 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+struct widgetStateProperty {
+ int stateOld;
+ int stateNew;
+ float transition;
+};
+
+uniform widgetStateProperty EW_status;
+
+// Input :
+attribute vec2 EW_coord2d;
+attribute vec2 EW_widgetPropertyPos;
+uniform mat4 EW_MatrixTransformation;
+uniform vec4 EW_foreground;
+uniform vec4 EW_foregroundHover;
+uniform vec4 EW_foregroundSelected;
+uniform vec4 EW_foregroundPressed;
+
+// output :
+varying vec2 v_propPos;
+varying vec4 v_colorTansition;
+
+void main(void) {
+ gl_Position = EW_MatrixTransformation * vec4(EW_coord2d, 0.0, 1.0);
+ // transmit position of the curent element (intermolated ...)
+ v_propPos = EW_widgetPropertyPos;
+
+ vec4 colorOld = EW_foreground;
+ if(EW_status.stateOld == 1) {
+ colorOld = EW_foregroundPressed;
+ } else if(EW_status.stateOld == 2) {
+ colorOld = EW_foregroundHover;
+ } else if(EW_status.stateOld == 3) {
+ colorOld = EW_foregroundSelected;
+ }
+ vec4 colorNew = EW_foreground;
+ if(EW_status.stateNew == 1) {
+ colorNew = EW_foregroundPressed;
+ } else if(EW_status.stateNew == 2) {
+ colorNew = EW_foregroundHover;
+ } else if(EW_status.stateNew == 3) {
+ colorNew = EW_foregroundSelected;
+ }
+
+ // note : int() is needed for the OpenGL ES platform
+ v_colorTansition = colorOld * (1.0 - EW_status.transition)
+ + colorNew * EW_status.transition;
+}
diff --git a/resources/data/theme/shape/square/CheckBox.frag b/resources/data/theme/shape/square/CheckBox.frag
new file mode 100644
index 0000000..3c11e09
--- /dev/null
+++ b/resources/data/theme/shape/square/CheckBox.frag
@@ -0,0 +1,28 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+
+// transmit from the vertex shader
+varying vec2 v_position; // interpolated position ...
+varying vec2 v_propPos;
+varying vec4 v_colorTansition;
+varying vec4 v_colorBorder;
+varying vec4 v_colorBackground;
+varying vec4 v_colorInside;
+
+void main(void) {
+ // prevent origin moving ...
+ gl_FragColor = vec4(v_propPos.y, v_propPos.x, 1.0, 1.0);
+ if( v_propPos.x == 1.0
+ && v_propPos.y == 1.0) {
+ gl_FragColor = v_colorTansition;
+ } else if ( v_propPos.x == 0.0
+ || v_propPos.y == 0.0) {
+ gl_FragColor = v_colorBackground;
+ } else {
+ gl_FragColor = v_colorBorder;
+ }
+}
+
diff --git a/resources/data/theme/shape/square/CheckBox.json b/resources/data/theme/shape/square/CheckBox.json
new file mode 100644
index 0000000..589e187
--- /dev/null
+++ b/resources/data/theme/shape/square/CheckBox.json
@@ -0,0 +1,25 @@
+{
+ mode:2,
+ display-outside:false,
+
+ padding-out-left:1,
+ padding-out-right:1,
+ padding-out-top:1,
+ padding-out-buttom:1,
+
+ border-left:1,
+ border-right:1,
+ border-top:1,
+ border-buttom:1,
+
+ padding-in-left:1,
+ padding-in-right:1,
+ padding-in-top:1,
+ padding-in-buttom:1,
+
+ box-size:20,
+ box-inside:12,
+ change-time:356,
+ program:"THEME_GUI:///CheckBox.prog?lib=ewol",
+ color:"THEME_COLOR:///CheckBox.json?lib=ewol"
+}
\ No newline at end of file
diff --git a/resources/data/theme/shape/square/CheckBox.vert b/resources/data/theme/shape/square/CheckBox.vert
new file mode 100644
index 0000000..50900e2
--- /dev/null
+++ b/resources/data/theme/shape/square/CheckBox.vert
@@ -0,0 +1,71 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+struct widgetStateProperty {
+ int activate;
+ int stateOld;
+ int stateNew;
+ float transition;
+};
+
+uniform widgetStateProperty EW_status;
+
+// Input :
+attribute vec2 EW_coord2d;
+attribute vec2 EW_widgetPropertyPos;
+uniform mat4 EW_MatrixTransformation;
+uniform vec4 EW_border;
+uniform vec4 EW_background;
+uniform vec4 EW_foreground;
+uniform vec4 EW_foregroundHover;
+uniform vec4 EW_foregroundSelected;
+uniform vec4 EW_foregroundPressed;
+
+// output :
+varying vec2 v_position; // This will be passed into the fragment shader.
+varying vec2 v_propPos;
+varying vec4 v_colorTansition;
+varying vec4 v_colorBorder;
+varying vec4 v_colorBackground;
+varying vec4 v_colorInside;
+
+void main(void) {
+ gl_Position = EW_MatrixTransformation * vec4(EW_coord2d, 0.0, 1.0);
+ // transmit position of the curent element (intermolated ...)
+ v_position = EW_coord2d;
+ v_propPos = EW_widgetPropertyPos;
+
+ vec4 colorOld = EW_foreground;
+ if(EW_status.stateOld == 1) {
+ colorOld = EW_foregroundPressed;
+ } else if(EW_status.stateOld == 2) {
+ colorOld = EW_foregroundHover;
+ } else if(EW_status.stateOld == 3) {
+ colorOld = EW_foregroundSelected;
+ }
+ vec4 colorNew = EW_foreground;
+ if(EW_status.stateNew == 1) {
+ colorNew = EW_foregroundPressed;
+ } else if(EW_status.stateNew == 2) {
+ colorNew = EW_foregroundHover;
+ } else if(EW_status.stateNew == 3) {
+ colorNew = EW_foregroundSelected;
+ }
+
+ v_colorInside = EW_foreground;
+ if (EW_status.activate == 1) {
+ v_colorInside = EW_foregroundSelected;
+ }
+
+ // note : int() is needed for the OpenGL ES platform
+ v_colorTansition = colorOld * (1.0 - EW_status.transition)
+ + colorNew * EW_status.transition;
+ // for test ... TODO : Remove
+ if (EW_status.activate == 1) {
+ v_colorTansition = EW_foregroundSelected;
+ }
+ v_colorBorder = EW_border;
+ v_colorBackground = EW_background;
+}
diff --git a/resources/data/theme/shape/square/ContextMenu.frag b/resources/data/theme/shape/square/ContextMenu.frag
new file mode 100644
index 0000000..8363c53
--- /dev/null
+++ b/resources/data/theme/shape/square/ContextMenu.frag
@@ -0,0 +1,27 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+uniform vec4 EW_background;
+uniform vec4 EW_foreground;
+uniform vec4 EW_border;
+
+// transmit from the vertex shader
+varying vec2 v_position; // interpolated position ...
+varying vec2 v_propPos;
+
+void main(void) {
+ // prevent origin moving ...
+ gl_FragColor = vec4(v_propPos.y, v_propPos.x, 1.0, 1.0);
+ if( v_propPos.x == 1.0
+ && v_propPos.y == 1.0) {
+ gl_FragColor = EW_foreground;
+ } else if ( v_propPos.x == 0.0
+ || v_propPos.y == 0.0) {
+ gl_FragColor = EW_background;
+ } else {
+ gl_FragColor = EW_border;
+ }
+}
+
diff --git a/resources/data/theme/shape/square/ContextMenu.json b/resources/data/theme/shape/square/ContextMenu.json
new file mode 100644
index 0000000..29495b0
--- /dev/null
+++ b/resources/data/theme/shape/square/ContextMenu.json
@@ -0,0 +1,23 @@
+{
+ mode:2,
+ display-outside:false,
+
+ padding-out-left:2,
+ padding-out-right:2,
+ padding-out-top:2,
+ padding-out-buttom:2,
+
+ border-left:3,
+ border-right:3,
+ border-top:3,
+ border-buttom:3,
+
+ padding-in-left:2,
+ padding-in-right:2,
+ padding-in-top:2,
+ padding-in-buttom:2,
+
+ change-time:356,
+ program:"THEME_GUI:///ContextMenu.prog?lib=ewol",
+ color:"THEME_COLOR:///ContextMenu.json?lib=ewol"
+}
diff --git a/resources/data/theme/shape/square/ContextMenu.vert b/resources/data/theme/shape/square/ContextMenu.vert
new file mode 100644
index 0000000..a75f3e8
--- /dev/null
+++ b/resources/data/theme/shape/square/ContextMenu.vert
@@ -0,0 +1,28 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+struct widgetStateProperty {
+ int stateOld;
+ int stateNew;
+ float transition;
+};
+
+uniform widgetStateProperty EW_status;
+
+// Input :
+attribute vec2 EW_coord2d;
+attribute vec2 EW_widgetPropertyPos;
+uniform mat4 EW_MatrixTransformation;
+
+// output :
+varying vec2 v_position; // This will be passed into the fragment shader.
+varying vec2 v_propPos;
+
+void main(void) {
+ gl_Position = EW_MatrixTransformation * vec4(EW_coord2d, 0.0, 1.0);
+ // transmit position of the curent element (intermolated ...)
+ v_position = EW_coord2d;
+ v_propPos = EW_widgetPropertyPos;
+}
diff --git a/resources/data/theme/shape/square/Entry.frag b/resources/data/theme/shape/square/Entry.frag
new file mode 100644
index 0000000..bf5d7f2
--- /dev/null
+++ b/resources/data/theme/shape/square/Entry.frag
@@ -0,0 +1,27 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+uniform vec4 EW_background;
+uniform vec4 EW_border;
+
+
+// transmit from the vertex shader
+varying vec2 v_position; // interpolated position ...
+varying vec2 v_propPos;
+varying vec4 v_colorTansition;
+
+void main(void) {
+ // prevent origin moving ...
+ gl_FragColor = vec4(v_propPos.y, v_propPos.x, 1.0, 1.0);
+ if( v_propPos.x == 1.0
+ && v_propPos.y == 1.0) {
+ gl_FragColor = v_colorTansition;
+ } else if ( v_propPos.x == 0.0
+ || v_propPos.y == 0.0) {
+ gl_FragColor = EW_background;
+ } else {
+ gl_FragColor = EW_border;
+ }
+}
\ No newline at end of file
diff --git a/resources/data/theme/shape/square/Entry.json b/resources/data/theme/shape/square/Entry.json
new file mode 100644
index 0000000..79eedd2
--- /dev/null
+++ b/resources/data/theme/shape/square/Entry.json
@@ -0,0 +1,23 @@
+{
+ mode:2,
+ display-outside:false,
+
+ padding-out-left:2,
+ padding-out-right:2,
+ padding-out-top:2,
+ padding-out-buttom:2,
+
+ border-left:1,
+ border-right:1,
+ border-top:1,
+ border-buttom:1,
+
+ padding-in-left:2,
+ padding-in-right:2,
+ padding-in-top:2,
+ padding-in-buttom:2,
+
+ change-time:356,
+ program:"THEME_GUI:///Entry.prog?lib=ewol",
+ color:"THEME_COLOR:///Entry.json?lib=ewol"
+}
diff --git a/resources/data/theme/shape/square/Entry.vert b/resources/data/theme/shape/square/Entry.vert
new file mode 100644
index 0000000..d02de34
--- /dev/null
+++ b/resources/data/theme/shape/square/Entry.vert
@@ -0,0 +1,50 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+struct widgetStateProperty {
+ int stateOld;
+ int stateNew;
+ float transition;
+};
+
+// Input :
+attribute vec2 EW_coord2d;
+attribute vec2 EW_widgetPropertyPos;
+uniform mat4 EW_MatrixTransformation;
+uniform widgetStateProperty EW_status;
+uniform vec4 EW_foreground;
+uniform vec4 EW_foregroundSelected;
+uniform vec4 EW_foregroundHover;
+
+// output :
+varying vec2 v_position; // This will be passed into the fragment shader.
+varying vec2 v_propPos;
+varying vec4 v_colorTansition;
+
+void main(void) {
+
+ gl_Position = EW_MatrixTransformation * vec4(EW_coord2d, 0.0, 1.0);
+ // transmit position of the curent element (intermolated ...)
+ v_position = EW_coord2d;
+ v_propPos = EW_widgetPropertyPos;
+
+
+ vec4 colorOld = EW_foreground;
+ if(EW_status.stateOld==1) {
+ colorOld = EW_foregroundSelected;
+ } else if(EW_status.stateOld==2) {
+ colorOld = EW_foregroundHover;
+ }
+ vec4 colorNew = EW_foreground;
+ if(EW_status.stateNew==1) {
+ colorNew = EW_foregroundSelected;
+ } else if(EW_status.stateNew==2) {
+ colorNew = EW_foregroundHover;
+ }
+
+ // note : int() is needed for the OpenGL ES platform
+ v_colorTansition = colorOld*(1.0-EW_status.transition)
+ + colorNew*EW_status.transition;
+}
diff --git a/resources/data/theme/shape/square/PopUp.frag b/resources/data/theme/shape/square/PopUp.frag
new file mode 100644
index 0000000..02b2f8e
--- /dev/null
+++ b/resources/data/theme/shape/square/PopUp.frag
@@ -0,0 +1,27 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+uniform vec4 EW_background;
+uniform vec4 EW_foreground;
+uniform vec4 EW_border;
+
+
+// transmit from the vertex shader
+varying vec2 v_position; // interpolated position ...
+varying vec2 v_propPos;
+
+void main(void) {
+ // prevent origin moving ...
+ gl_FragColor = vec4(v_propPos.y, v_propPos.x, 1.0, 1.0);
+ if( v_propPos.x == 1.0
+ && v_propPos.y == 1.0) {
+ gl_FragColor = EW_foreground;
+ } else if ( v_propPos.x == 0.0
+ || v_propPos.y == 0.0) {
+ gl_FragColor = EW_background;
+ } else {
+ gl_FragColor = EW_border;
+ }
+}
+
diff --git a/resources/data/theme/shape/square/PopUp.json b/resources/data/theme/shape/square/PopUp.json
new file mode 100644
index 0000000..b033fb9
--- /dev/null
+++ b/resources/data/theme/shape/square/PopUp.json
@@ -0,0 +1,23 @@
+{
+ mode:2,
+ display-outside:false,
+
+ padding-out-left:2,
+ padding-out-right:2,
+ padding-out-top:2,
+ padding-out-buttom:2,
+
+ border-left:3,
+ border-right:3,
+ border-top:3,
+ border-buttom:3,
+
+ padding-in-left:2,
+ padding-in-right:2,
+ padding-in-top:2,
+ padding-in-buttom:2,
+
+ change-time:356,
+ program:"THEME_GUI:///PopUp.prog?lib=ewol",
+ color:"THEME_COLOR:///PopUp.json?lib=ewol"
+}
diff --git a/resources/data/theme/shape/square/PopUp.vert b/resources/data/theme/shape/square/PopUp.vert
new file mode 100644
index 0000000..d4da54e
--- /dev/null
+++ b/resources/data/theme/shape/square/PopUp.vert
@@ -0,0 +1,17 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+// Input :
+attribute vec2 EW_coord2d;
+attribute vec2 EW_widgetPropertyPos;
+uniform mat4 EW_MatrixTransformation;
+
+// output :
+varying vec2 v_propPos;
+
+void main(void) {
+ gl_Position = EW_MatrixTransformation * vec4(EW_coord2d, 0.0, 1.0);
+ v_propPos = EW_widgetPropertyPos;
+}
diff --git a/resources/data/theme/shape/square/Select.json b/resources/data/theme/shape/square/Select.json
new file mode 100644
index 0000000..655fd31
--- /dev/null
+++ b/resources/data/theme/shape/square/Select.json
@@ -0,0 +1,5 @@
+{
+ entry-shaper:"THEME_GUI:///SelectEntry.json?lib=ewol",
+ up-shaper:"THEME_GUI:///SelectBt.json?lib=ewol",
+ up-data:"",
+}
\ No newline at end of file
diff --git a/resources/data/theme/shape/square/SelectBt.json b/resources/data/theme/shape/square/SelectBt.json
new file mode 100644
index 0000000..41b4a94
--- /dev/null
+++ b/resources/data/theme/shape/square/SelectBt.json
@@ -0,0 +1,23 @@
+{
+ mode:2,
+ display-outside:false,
+
+ padding-out-left:0,
+ padding-out-right:1,
+ padding-out-top:1,
+ padding-out-buttom:1,
+
+ border-left:1,
+ border-right:1,
+ border-top:1,
+ border-buttom:1,
+
+ padding-in-left:1,
+ padding-in-right:1,
+ padding-in-top:1,
+ padding-in-buttom:1,
+
+ change-time:356,
+ program:"THEME_GUI:///Button.prog?lib=ewol",
+ color:"THEME_COLOR:///Button.json?lib=ewol"
+}
diff --git a/resources/data/theme/shape/square/SelectEntry.json b/resources/data/theme/shape/square/SelectEntry.json
new file mode 100644
index 0000000..2c31f26
--- /dev/null
+++ b/resources/data/theme/shape/square/SelectEntry.json
@@ -0,0 +1,23 @@
+{
+ mode:2,
+ display-outside:false,
+
+ padding-out-left:0,
+ padding-out-right:0,
+ padding-out-top:1,
+ padding-out-buttom:1,
+
+ border-left:1,
+ border-right:0,
+ border-top:1,
+ border-buttom:1,
+
+ padding-in-left:2,
+ padding-in-right:2,
+ padding-in-top:1,
+ padding-in-buttom:1,
+
+ change-time:356,
+ program:"THEME_GUI:///Entry.prog?lib=ewol",
+ color:"THEME_COLOR:///Entry.json?lib=ewol"
+}
diff --git a/resources/data/theme/shape/square/Spin.json b/resources/data/theme/shape/square/Spin.json
new file mode 100644
index 0000000..bc127f2
--- /dev/null
+++ b/resources/data/theme/shape/square/Spin.json
@@ -0,0 +1,7 @@
+{
+ entry-shaper:"THEME_GUI:///SpinEntry.json?lib=ewol",
+ up-shaper:"THEME_GUI:///SpinUp.json?lib=ewol",
+ up-data:"",
+ down-shaper:"THEME_GUI:///SpinDown.json?lib=ewol",
+ down-data:"",
+}
\ No newline at end of file
diff --git a/resources/data/theme/shape/square/SpinDown.json b/resources/data/theme/shape/square/SpinDown.json
new file mode 100644
index 0000000..4b8452c
--- /dev/null
+++ b/resources/data/theme/shape/square/SpinDown.json
@@ -0,0 +1,23 @@
+{
+ mode:2,
+ display-outside:false,
+
+ padding-out-left:0,
+ padding-out-right:0,
+ padding-out-top:1,
+ padding-out-buttom:1,
+
+ border-left:1,
+ border-right:0,
+ border-top:1,
+ border-buttom:1,
+
+ padding-in-left:1,
+ padding-in-right:1,
+ padding-in-top:1,
+ padding-in-buttom:1,
+
+ change-time:356,
+ program:"THEME_GUI:///Button.prog?lib=ewol",
+ color:"THEME_COLOR:///Button.json?lib=ewol"
+}
diff --git a/resources/data/theme/shape/square/SpinEntry.json b/resources/data/theme/shape/square/SpinEntry.json
new file mode 100644
index 0000000..2c31f26
--- /dev/null
+++ b/resources/data/theme/shape/square/SpinEntry.json
@@ -0,0 +1,23 @@
+{
+ mode:2,
+ display-outside:false,
+
+ padding-out-left:0,
+ padding-out-right:0,
+ padding-out-top:1,
+ padding-out-buttom:1,
+
+ border-left:1,
+ border-right:0,
+ border-top:1,
+ border-buttom:1,
+
+ padding-in-left:2,
+ padding-in-right:2,
+ padding-in-top:1,
+ padding-in-buttom:1,
+
+ change-time:356,
+ program:"THEME_GUI:///Entry.prog?lib=ewol",
+ color:"THEME_COLOR:///Entry.json?lib=ewol"
+}
diff --git a/resources/data/theme/shape/square/SpinUp.json b/resources/data/theme/shape/square/SpinUp.json
new file mode 100644
index 0000000..0159a01
--- /dev/null
+++ b/resources/data/theme/shape/square/SpinUp.json
@@ -0,0 +1,23 @@
+{
+ mode:2,
+ display-outside:false,
+
+ padding-out-left:0,
+ padding-out-right:0,
+ padding-out-top:1,
+ padding-out-buttom:1,
+
+ border-left:1,
+ border-right:1,
+ border-top:1,
+ border-buttom:1,
+
+ padding-in-left:1,
+ padding-in-right:1,
+ padding-in-top:1,
+ padding-in-buttom:1,
+
+ change-time:356,
+ program:"THEME_GUI:///Button.prog?lib=ewol",
+ color:"THEME_COLOR:///Button.json?lib=ewol"
+}
diff --git a/resources/data/theme/shape/square/WidgetScrolled.frag b/resources/data/theme/shape/square/WidgetScrolled.frag
new file mode 100644
index 0000000..2b6f3ad
--- /dev/null
+++ b/resources/data/theme/shape/square/WidgetScrolled.frag
@@ -0,0 +1,25 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+// transmit from the vertex shader
+varying vec2 v_position; // interpolated position ...
+varying vec2 v_propPos;
+varying vec4 v_colorTansition;
+varying vec4 v_colorBorder;
+varying vec4 v_colorBackground;
+
+void main(void) {
+ // prevent origin moving ...
+ gl_FragColor = vec4(v_propPos.y, v_propPos.x, 1.0, 1.0);
+ if( v_propPos.x == 1.0
+ && v_propPos.y == 1.0) {
+ gl_FragColor = v_colorTansition;
+ } else if ( v_propPos.x == 0.0
+ || v_propPos.y == 0.0) {
+ gl_FragColor = v_colorBackground;
+ } else {
+ gl_FragColor = v_colorBorder;
+ }
+}
diff --git a/resources/data/theme/shape/square/WidgetScrolled.json b/resources/data/theme/shape/square/WidgetScrolled.json
new file mode 100644
index 0000000..51b4ce9
--- /dev/null
+++ b/resources/data/theme/shape/square/WidgetScrolled.json
@@ -0,0 +1,23 @@
+{
+ mode:2,
+ display-outside:true,
+
+ padding-out-left:1,
+ padding-out-right:1,
+ padding-out-top:1,
+ padding-out-buttom:1,
+
+ border-left:1,
+ border-right:1,
+ border-top:1,
+ border-buttom:1,
+
+ padding-in-left:3,
+ padding-in-right:3,
+ padding-in-top:3,
+ padding-in-buttom:3,
+
+ change-time:200,
+ program:"THEME_GUI:///WidgetScrolled.prog?lib=ewol",
+ color:"THEME_COLOR:///WidgetScrolled.json?lib=ewol"
+}
diff --git a/resources/data/theme/shape/square/WidgetScrolled.vert b/resources/data/theme/shape/square/WidgetScrolled.vert
new file mode 100644
index 0000000..4606c18
--- /dev/null
+++ b/resources/data/theme/shape/square/WidgetScrolled.vert
@@ -0,0 +1,50 @@
+#ifdef GL_ES
+precision mediump float;
+precision mediump int;
+#endif
+
+struct widgetStateProperty {
+ int stateOld;
+ int stateNew;
+ float transition;
+};
+
+uniform widgetStateProperty EW_status;
+
+// Input :
+attribute vec2 EW_coord2d;
+attribute vec2 EW_widgetPropertyPos;
+uniform mat4 EW_MatrixTransformation;
+uniform vec4 EW_border;
+uniform vec4 EW_background;
+uniform vec4 EW_foreground;
+uniform vec4 EW_foregroundPressed;
+
+// output :
+varying vec2 v_position; // This will be passed into the fragment shader.
+varying vec2 v_propPos;
+varying vec4 v_colorTansition;
+varying vec4 v_colorBorder;
+varying vec4 v_colorBackground;
+
+void main(void) {
+ gl_Position = EW_MatrixTransformation * vec4(EW_coord2d, 0.0, 1.0);
+ // transmit position of the curent element (intermolated ...)
+ v_position = EW_coord2d;
+ v_propPos = EW_widgetPropertyPos;
+
+ vec4 colorOld = EW_foreground;
+ if(EW_status.stateOld == 1) {
+ colorOld = EW_foregroundPressed;
+ }
+ vec4 colorNew = EW_foreground;
+ if(EW_status.stateNew == 1) {
+ colorNew = EW_foregroundPressed;
+ }
+
+ // note : int() is needed for the OpenGL ES platform
+ v_colorTansition = colorOld * (1.0 - EW_status.transition)
+ + colorNew * EW_status.transition;
+ v_colorBorder = EW_border;
+ v_colorBackground = EW_background;
+}
diff --git a/resources/data/translate/EN.json b/resources/data/translate/EN.json
new file mode 100644
index 0000000..5d5d4a1
--- /dev/null
+++ b/resources/data/translate/EN.json
@@ -0,0 +1,6 @@
+{
+ "FileChooser":"File chooser ...",
+ "Cancel":"Cancel",
+ "Validate":"Validate",
+ "ShowHiddenFiles":"Show hiden files"
+}
\ No newline at end of file
diff --git a/resources/data/translate/FR.json b/resources/data/translate/FR.json
new file mode 100644
index 0000000..f0ec5f8
--- /dev/null
+++ b/resources/data/translate/FR.json
@@ -0,0 +1,6 @@
+{
+ "FileChooser":"Sélection d'un fichier ...",
+ "Cancel":"Annuler",
+ "Validate":"Valider",
+ "ShowHiddenFiles":"Afficher les fichiers cachés"
+}
\ No newline at end of file
diff --git a/src/module-info.java b/src/module-info.java
index 4e3001e..6ee81df 100644
--- a/src/module-info.java
+++ b/src/module-info.java
@@ -4,9 +4,12 @@
open module org.atriasoft.ewol {
exports org.atriasoft.ewol;
+ exports org.atriasoft.egami;
requires transitive org.atriasoft.gale;
requires transitive org.atriasoft.etk;
requires transitive org.atriasoft.exml;
+ requires transitive org.atriasoft.ejson;
requires transitive io.scenarium.logger;
+ requires freetype.jni;
}
diff --git a/src/org/atriasoft/echrono/Clock.java b/src/org/atriasoft/echrono/Clock.java
index 0f1f4af..5defcc4 100644
--- a/src/org/atriasoft/echrono/Clock.java
+++ b/src/org/atriasoft/echrono/Clock.java
@@ -4,8 +4,8 @@ package org.atriasoft.echrono;
* @brief Clock is a compleate virtual clock that is used to virtualize the urrent clock used (can be non real-time, ex:for simulation)
*/
public class Clock {
- public static Time now() {
- return new Time(System.nanoTime());
+ public static Clock now() {
+ return new Clock(System.nanoTime());
}
private final long data; //!< virtual clock
diff --git a/src/org/atriasoft/echrono/Duration.java b/src/org/atriasoft/echrono/Duration.java
index c75ef1f..f3d3cab 100644
--- a/src/org/atriasoft/echrono/Duration.java
+++ b/src/org/atriasoft/echrono/Duration.java
@@ -1,6 +1,10 @@
package org.atriasoft.echrono;
public class Duration {
+ public static Duration milliseconds(final long milli) {
+ return new Duration(milli / 1000.0);
+ }
+
private final long data; // stored in ns
public Duration() {
@@ -27,6 +31,11 @@ public class Duration {
return this.data;
}
+ public boolean isGreaterThan(final Duration sepatateTime) {
+ // TODO Auto-generated method stub
+ return this.data - sepatateTime.data > 0;
+ }
+
public float toSeconds() {
// TODO Auto-generated method stub
return (float) (this.data / 1000000000.0);
diff --git a/src/org/atriasoft/echrono/Steady.java b/src/org/atriasoft/echrono/Steady.java
index 80cc55b..e594435 100644
--- a/src/org/atriasoft/echrono/Steady.java
+++ b/src/org/atriasoft/echrono/Steady.java
@@ -4,6 +4,10 @@ package org.atriasoft.echrono;
* @brief Steady is a Program start time clock
*/
public class Steady {
+ public static Steady now() {
+ return new Steady(System.nanoTime());
+ }
+
private final long data; //!< Monotonic clock since computer start (ns)
public Steady() {
@@ -29,4 +33,9 @@ public class Steady {
public long get() {
return this.data;
}
+
+ public Duration less(final Steady other) {
+ // TODO Auto-generated method stub
+ return new Duration(this.data - other.data);
+ }
}
diff --git a/src/org/atriasoft/echrono/Time.java b/src/org/atriasoft/echrono/Time.java
index 5a887b5..734edb2 100644
--- a/src/org/atriasoft/echrono/Time.java
+++ b/src/org/atriasoft/echrono/Time.java
@@ -33,4 +33,8 @@ public class Time {
public long get() {
return this.data;
}
+
+ public Clock toClock() {
+ return new Clock(this.data);
+ }
}
diff --git a/src/org/atriasoft/egami/Image.java b/src/org/atriasoft/egami/Image.java
new file mode 100644
index 0000000..661a5ee
--- /dev/null
+++ b/src/org/atriasoft/egami/Image.java
@@ -0,0 +1,170 @@
+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
new file mode 100644
index 0000000..96cc071
--- /dev/null
+++ b/src/org/atriasoft/egami/ImageFloat.java
@@ -0,0 +1,159 @@
+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
new file mode 100644
index 0000000..73d9c61
--- /dev/null
+++ b/src/org/atriasoft/egami/ImageMono.java
@@ -0,0 +1,111 @@
+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/DrawProperty.cpp b/src/org/atriasoft/ewol/DrawProperty.cpp
deleted file mode 100644
index 43076be..0000000
--- a/src/org/atriasoft/ewol/DrawProperty.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-/** @file
- * @author Edouard DUPIN
- * @copyright 2011, Edouard DUPIN, all right reserved
- * @license MPL v2.0 (see license file)
- */
-
-#include
-#include
-
-#include
-ETK_DECLARE_TYPE(ewol::DrawProperty);
-
-etk::Stream ewol::operator +(etk::Stream _os, ewol::DrawProperty _obj) {
- _os + "{ windowsSize=" + _obj.this.windowsSize + " start=" + _obj.this.origin + " stop=" + (_obj.this.origin+_obj.this.size) + "}";
- return _os;
-}
-
-void ewol::DrawProperty::limit( Vector2f _origin, Vector2f _size) {
- this.size += this.origin;
- this.origin.setMax(_origin);
- this.size.setMin(_origin+_size);
- this.size -= this.origin;
-}
-
diff --git a/src/org/atriasoft/ewol/DrawProperty.java b/src/org/atriasoft/ewol/DrawProperty.java
index 8a5d8ec..57a074b 100644
--- a/src/org/atriasoft/ewol/DrawProperty.java
+++ b/src/org/atriasoft/ewol/DrawProperty.java
@@ -1,48 +1,68 @@
+package org.atriasoft.ewol;
+
+import org.atriasoft.etk.math.Vector2f;
+import org.atriasoft.etk.math.Vector2i;
+
/** @file
* @author Edouard DUPIN
* @copyright 2011, Edouard DUPIN, all right reserved
* @license MPL v2.0 (see license file)
*/
-#pragma once
-#include
-#include
-
-namespace ewol {
- /**
- * @not_in_doc
+public class DrawProperty {
+ /*
+ /-. windowsSize
+ *--------------------------------------------------*
+ | |
+ | |
+ | size |
+ | / |
+ | o-------------------o |
+ | | | |
+ | | | |
+ | | | |
+ | | | |
+ | | | |
+ | | | |
+ | | | |
+ | | | |
+ | o-------------------o |
+ | / |
+ | origin |
+ | |
+ *--------------------------------------------------*
+ /
+ (0,0)
*/
- class DrawProperty{
- /*
- /-. this.windowsSize
- *--------------------------------------------------*
- | g |
- | |
- | this.size |
- | / |
- | o-------------------o |
- | | | |
- | | | |
- | | | |
- | | | |
- | | | |
- | | | |
- | | | |
- | | | |
- | o-------------------o |
- | / |
- | this.origin |
- | |
- *--------------------------------------------------*
- /
- (0,0)
- */
- public :
- Vector2i this.windowsSize; //!< Windows compleate size
- Vector2i this.origin; //!< Windows clipping upper widget (can not be <0)
- Vector2i this.size; //!< Windows clipping upper widget (can not be <0 and >this.windowsSize)
- void limit( Vector2f _origin, Vector2f _size);
- };
- etk::Stream operator +(etk::Stream _os, ewol::DrawProperty _obj);
+ public Vector2i windowsSize = new Vector2i(0, 0); //!< Windows complete size
+ public Vector2i origin = new Vector2i(0, 0); //!< Windows clipping upper widget (can not be <0)
+ public Vector2i size = new Vector2i(0, 0); //!< Windows clipping upper widget (can not be <0 and >this.windowsSize)
+ public DrawProperty() {
+
+ }
+
+ public DrawProperty(final Vector2i windowsSize, final Vector2i origin, final Vector2i size) {
+ super();
+ this.windowsSize = windowsSize;
+ this.origin = origin;
+ this.size = size;
+ }
+
+ @Override
+ public DrawProperty clone() {
+ return new DrawProperty(this.windowsSize, this.origin, this.size);
+ }
+
+ public void limit(final Vector2f _origin, final Vector2f _size) {
+ this.size.add(this.origin);
+ this.origin.setMax((int) _origin.x, (int) _origin.y);
+ this.size.setMin((int) (_origin.x + _size.x), (int) (_origin.y + _size.y));
+ this.size.less(this.origin);
+ }
+
+ @Override
+ public String toString() {
+ return "DrawProperty [windowsSize=" + this.windowsSize + ", start=" + this.origin + ", stop=" + this.origin.addNew(this.size) + "]";
+ }
}
diff --git a/src/org/atriasoft/ewol/ewol.java b/src/org/atriasoft/ewol/Ewol.java
similarity index 89%
rename from src/org/atriasoft/ewol/ewol.java
rename to src/org/atriasoft/ewol/Ewol.java
index a14a0a6..2882e6f 100644
--- a/src/org/atriasoft/ewol/ewol.java
+++ b/src/org/atriasoft/ewol/Ewol.java
@@ -1,4 +1,6 @@
+package org.atriasoft.ewol;
+import org.atriasoft.etk.Uri;
/** @file
* @author Edouard DUPIN
* @copyright 2011, Edouard DUPIN, all right reserved
@@ -7,7 +9,11 @@
import org.atriasoft.ewol.context.EwolApplication;
import org.atriasoft.ewol.context.EwolContext;
-class Ewol {
+public class Ewol {
+ static {
+ Uri.addLibrary("ewol", Ewol.class);
+ }
+
public static EwolContext getContext() {
// TODO Auto-generated method stub
return EwolContext.getContext();
diff --git a/src/org/atriasoft/ewol/Gravity.java b/src/org/atriasoft/ewol/Gravity.java
index 23ddee8..1420a1e 100644
--- a/src/org/atriasoft/ewol/Gravity.java
+++ b/src/org/atriasoft/ewol/Gravity.java
@@ -5,6 +5,8 @@
*/
package org.atriasoft.ewol;
+import org.atriasoft.etk.math.Vector2f;
+
/**
* @brief Gravity of the widget property
*/
@@ -17,5 +19,29 @@ public enum Gravity {
topRight, //!< gravity is in top-right
topLeft, //!< gravity is in top-left
buttomRight, //!< gravity is in buttom-right
- buttomLeft, //!< gravity is in buttom-left
+ buttomLeft; //!< gravity is in buttom-left
+
+ Vector2f gravityGenerateDelta(final Gravity _gravity, final Vector2f _deltas) {
+ final Vector2f out = new Vector2f(0.0f, 0.0f);
+ if (_deltas.x > 0.0001f) {
+ if (_gravity == left || _gravity == buttomLeft || _gravity == topLeft) {
+ // nothing to do
+ } else if (_gravity == right || _gravity == buttomRight || _gravity == topRight) {
+ out.x = (int) (_deltas.x);
+ } else {
+ out.x = (int) (_deltas.x * 0.5f);
+ }
+ }
+ if (_deltas.y > 0.0001f) {
+ if (_gravity == buttom || _gravity == buttomLeft || _gravity == buttomRight) {
+ // nothing to do
+ } else if (_gravity == top || _gravity == topRight || _gravity == topLeft) {
+ out.y = (int) (_deltas.y);
+ } else {
+ out.y = (int) (_deltas.y * 0.5f);
+ }
+ }
+ return out;
+ }
+
}
diff --git a/src/org/atriasoft/ewol/Padding.cpp b/src/org/atriasoft/ewol/Padding.cpp
deleted file mode 100644
index 66e1af5..0000000
--- a/src/org/atriasoft/ewol/Padding.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/** @file
- * @author Edouard DUPIN
- * @copyright 2011, Edouard DUPIN, all right reserved
- * @license MPL v2.0 (see license file)
- */
-
-#include
-#include
-ETK_DECLARE_TYPE(ewol::Padding);
-
-ewol::Padding::Padding() {
- // nothing to do...
-}
-
-ewol::Padding::Padding(float _xl, float _yt, float _xr, float _yb) {
- setValue(_xl, _yt, _xr, _yb);
-}
-
-void ewol::Padding::setValue(float _xl, float _yt, float _xr, float _yb) {
- this.value[0] = _xl;
- this.value[1] = _yt;
- this.value[2] = _xr;
- this.value[3] = _yb;
-}
-
-float ewol::Padding::x() {
- return this.value[0] + this.value[2];
-}
-
-float ewol::Padding::y() {
- return this.value[1] + this.value[3];
-}
-
-float ewol::Padding::xLeft() {
- return this.value[0];
-}
-
-void ewol::Padding::setXLeft(float _val) {
- this.value[0] = _val;
-}
-
-float ewol::Padding::xRight() {
- return this.value[2];
-}
-
-void ewol::Padding::setXRight(float _val) {
- this.value[2] = _val;
-}
-
-float ewol::Padding::yTop() {
- return this.value[1];
-}
-
-void ewol::Padding::setYTop(float _val) {
- this.value[1] = _val;
-}
-
-float ewol::Padding::yButtom() {
- return this.value[3];
-}
-
-void ewol::Padding::setYButtom(float _val) {
- this.value[3] = _val;
-}
-
-ewol::Padding ewol::Padding::operator+=( Padding _v) {
- this.value[0] += _v.this.value[0];
- this.value[1] += _v.this.value[1];
- this.value[2] += _v.this.value[2];
- this.value[3] += _v.this.value[3];
- return *this;
-}
-
-ewol::Padding ewol::Padding::operator+( Padding _v) {
- return Padding(this.value[0] + _v.this.value[0],
- this.value[1] + _v.this.value[1],
- this.value[2] + _v.this.value[2],
- this.value[3] + _v.this.value[3]);
-}
-
-etk::Stream ewol::operator +(etk::Stream _os, ewol::Padding _obj) {
- _os + "{";
- _os + _obj.xLeft();
- _os + ",";
- _os + _obj.yTop();
- _os + ",";
- _os + _obj.xRight();
- _os + ",";
- _os + _obj.yButtom();
- _os + "}";
- return _os;
-}
-
diff --git a/src/org/atriasoft/ewol/Padding.java b/src/org/atriasoft/ewol/Padding.java
index a43057c..94239f8 100644
--- a/src/org/atriasoft/ewol/Padding.java
+++ b/src/org/atriasoft/ewol/Padding.java
@@ -3,41 +3,130 @@
* @copyright 2011, Edouard DUPIN, all right reserved
* @license MPL v2.0 (see license file)
*/
-#pragma once
-#include
-#include
-
-namespace ewol {
+/**
+ * @breif Simple class to abstarct the padding porperty.
+ */
+public class Padding {
+ private float xLeft;
+ private float yTop;
+ private float xRight;
+ private float yBottom; //!< this represent the 4 padding value Left top right buttom (like css)
+
+ public Padding() {
+ setValue();
+ }
+
+ public Padding(final float _xLeft) {
+ setValue(_xLeft);
+ }
+
+ public Padding(final float _xLeft, final float _yt) {
+ setValue(_xLeft, _yt);
+ }
+
+ public Padding(final float _xLeft, final float _yt, final float _xr) {
+ setValue(_xLeft, _yt, _xr);
+ }
+
+ public Padding(final float _xLeft, final float _yt, final float _xr, final float _yb) {
+ setValue(_xLeft, _yt, _xr, _yb);
+ }
+
/**
- * @breif Simple class to abstarct the padding porperty.
- */
- class Padding {
- private:
- float this.value[4]; //!< this represent the 4 padding value Left top right buttom (like css)
- public:
- Padding();
- Padding(float _xl, float _yt=0.0f, float _xr=0.0f, float _yb=0.0f);
- void setValue(float _xl, float _yt=0.0f, float _xr=0.0f, float _yb=0.0f);
- float x() ;
- float y() ;
- float xLeft() ;
- void setXLeft(float _val);
- float xRight() ;
- void setXRight(float _val);
- float yTop() ;
- void setYTop(float _val);
- float yButtom() ;
- void setYButtom(float _val);
- /**
* @brief Add a vector to this one
* @param _v The vector to add to this one
*/
- Padding operator+=( Padding _v);
- //! @previous
- Padding operator+( Padding _v);
-
- };
- etk::Stream operator +(etk::Stream _os, ewol::Padding _obj);
-};
-
+ public Padding add(final Padding _v) {
+ this.xLeft += _v.xLeft;
+ this.yTop += _v.yTop;
+ this.xRight += _v.xRight;
+ this.yBottom += _v.yBottom;
+ return this;
+ }
+
+ //! @previous
+ public Padding addNew(final Padding _v) {
+ return new Padding(this.xLeft + _v.xLeft, this.yTop + _v.yTop, this.xRight + _v.xRight, this.yBottom + _v.yBottom);
+ }
+
+ public void setValue() {
+ this.xLeft = 0;
+ this.yTop = 0;
+ this.xRight = 0;
+ this.yBottom = 0;
+ }
+
+ public void setValue(final float _xLeft) {
+ this.xLeft = _xLeft;
+ this.yTop = 0;
+ this.xRight = 0;
+ this.yBottom = 0;
+ }
+
+ public void setValue(final float _xLeft, final float _yt) {
+ this.xLeft = _xLeft;
+ this.yTop = _yt;
+ this.xRight = 0;
+ this.yBottom = 0;
+ }
+
+ public void setValue(final float _xLeft, final float _yt, final float _xr) {
+ this.xLeft = _xLeft;
+ this.yTop = _yt;
+ this.xRight = _xr;
+ this.yBottom = 0;
+ }
+
+ public void setValue(final float _xLeft, final float _yt, final float _xr, final float _yb) {
+ this.xLeft = _xLeft;
+ this.yTop = _yt;
+ this.xRight = _xr;
+ this.yBottom = _yb;
+ }
+
+ public void setXLeft(final float _val) {
+ this.xLeft = _val;
+ }
+
+ public void setXRight(final float _val) {
+ this.xRight = _val;
+ }
+
+ public void setYButtom(final float _val) {
+ this.yBottom = _val;
+ }
+
+ public void setYTop(final float _val) {
+ this.yTop = _val;
+ }
+
+ @Override
+ public String toString() {
+ return "{" + xLeft() + "," + yTop() + "," + xRight() + "," + yButtom() + "}";
+ }
+
+ public float x() {
+ return this.xLeft + this.xRight;
+ }
+
+ public float xLeft() {
+ return this.xLeft;
+ }
+
+ public float xRight() {
+ return this.xRight;
+ }
+
+ public float y() {
+ return this.yTop + this.yBottom;
+ }
+
+ public float yButtom() {
+ return this.yBottom;
+ }
+
+ public float yTop() {
+ return this.yTop;
+ }
+}
diff --git a/src/org/atriasoft/ewol/compositing/Area.cpp b/src/org/atriasoft/ewol/compositing/Area.cpp
deleted file mode 100644
index 276c065..0000000
--- a/src/org/atriasoft/ewol/compositing/Area.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-/** @file
- * @author Edouard DUPIN
- * @copyright 2011, Edouard DUPIN, all right reserved
- * @license MPL v2.0 (see license file)
- */
-
-#include
-#include
-#include
-ETK_DECLARE_TYPE(ewol::compositing::Area);
-
-// VBO table property:
- int ewol::compositing::Area::this.vboIdCoord(0);
- int ewol::compositing::Area::this.vboIdCoordText(1);
- int ewol::compositing::Area::this.vboIdColor(2);
-#define NB_VBO (3)
-
-ewol::compositing::Area::Area( Vector2i _size) :
- this.position(0.0, 0.0, 0.0),
- this.color(etk::color::white),
- this.GLprogram(null),
- this.GLPosition(-1),
- this.GLMatrix(-1),
- this.GLColor(-1),
- this.GLtexture(-1),
- this.GLtexID(-1),
- this.resource(null) {
- this.resource = ewol::resource::Texture::create();
- this.resource.setImageSize(_size);
- this.resource.flush();
- // Create the VBO:
- this.VBO = gale::resource::VirtualBufferObject::create(NB_VBO);
- if (this.VBO == null) {
- Log.error("can not instanciate VBO ...");
- return;
- }
- // TO facilitate some debugs we add a name of the VBO:
- this.VBO.setName("[VBO] of ewol::compositing::Area");
- loadProgram();
-}
-
-ewol::compositing::Area::~Area() {
-
-}
-
-void ewol::compositing::Area::loadProgram() {
- // get the shader resource :
- this.GLPosition = 0;
- this.GLprogram = gale::resource::Program::create(String("DATA:///textured3D.prog?lib=ewol"));
- if (this.GLprogram != null) {
- this.GLPosition = this.GLprogram.getAttribute("EW_coord3d");
- this.GLColor = this.GLprogram.getAttribute("EW_color");
- this.GLtexture = this.GLprogram.getAttribute("EW_texture2d");
- this.GLMatrix = this.GLprogram.getUniform("EW_MatrixTransformation");
- this.GLtexID = this.GLprogram.getUniform("EW_texID");
- }
-}
-
-void ewol::compositing::Area::draw(boolean _disableDepthTest) {
- if (this.VBO.bufferSize(this.vboIdCoord) <= 0) {
- //Log.warning("Nothink to draw...");
- return;
- }
- if (this.resource == null) {
- // this is a normale case ... the user can choice to have no image ...
- return;
- }
- if (this.GLprogram == null) {
- Log.error("No shader ...");
- return;
- }
- // set Matrix : translation/positionMatrix
- mat4 tmpMatrix = gale::openGL::getMatrix()*this.matrixApply;
- this.GLprogram.use();
- this.GLprogram.uniformMatrix(this.GLMatrix, tmpMatrix);
- // TextureID
- this.GLprogram.setTexture0(this.GLtexID, this.resource.getRendererId());
- // position:
- this.GLprogram.sendAttributePointer(this.GLPosition, this.VBO, this.vboIdCoord);
- // Texture:
- this.GLprogram.sendAttributePointer(this.GLtexture, this.VBO, this.vboIdColor);
- // color:
- this.GLprogram.sendAttributePointer(this.GLColor, this.VBO, this.vboIdCoordText);
- // Request the draw od the elements :
- gale::openGL::drawArrays(gale::openGL::renderMode::triangle, 0, this.VBO.bufferSize(this.vboIdCoord));
- this.GLprogram.unUse();
-}
-
-void ewol::compositing::Area::clear() {
- // call upper class
- ewol::Compositing::clear();
- // reset all VBOs:
- this.VBO.clear();
- // reset temporal variables :
- this.position = Vector3f(0.0, 0.0, 0.0);
-}
-
-void ewol::compositing::Area::print( Vector2i _size) {
- Vector3f point(0,0,0);
- Vector2f tex(0,1);
- point.setX(this.position.x());
- point.setY(this.position.y());
- this.VBO.pushOnBuffer(this.vboIdCoord, point);
- this.VBO.pushOnBuffer(this.vboIdColor, this.color);
- this.VBO.pushOnBuffer(this.vboIdCoordText, tex);
-
- tex.setValue(1,1);
- point.setX(this.position.x() + _size.x());
- point.setY(this.position.y());
- this.VBO.pushOnBuffer(this.vboIdCoord, point);
- this.VBO.pushOnBuffer(this.vboIdColor, this.color);
- this.VBO.pushOnBuffer(this.vboIdCoordText, tex);
-
- tex.setValue(1,0);
- point.setX(this.position.x() + _size.x());
- point.setY(this.position.y() + _size.y());
- this.VBO.pushOnBuffer(this.vboIdCoord, point);
- this.VBO.pushOnBuffer(this.vboIdColor, this.color);
- this.VBO.pushOnBuffer(this.vboIdCoordText, tex);
-
- this.VBO.pushOnBuffer(this.vboIdCoord, point);
- this.VBO.pushOnBuffer(this.vboIdColor, this.color);
- this.VBO.pushOnBuffer(this.vboIdCoordText, tex);
-
- tex.setValue(0,0);
- point.setX(this.position.x());
- point.setY(this.position.y() + _size.y());
- this.VBO.pushOnBuffer(this.vboIdCoord, point);
- this.VBO.pushOnBuffer(this.vboIdColor, this.color);
- this.VBO.pushOnBuffer(this.vboIdCoordText, tex);
-
- tex.setValue(0,1);
- point.setX(this.position.x());
- point.setY(this.position.y());
- this.VBO.pushOnBuffer(this.vboIdCoord, point);
- this.VBO.pushOnBuffer(this.vboIdColor, this.color);
- this.VBO.pushOnBuffer(this.vboIdCoordText, tex);
-
- this.VBO.flush();
-}
-
-
diff --git a/src/org/atriasoft/ewol/compositing/Area.java b/src/org/atriasoft/ewol/compositing/Area.java
deleted file mode 100644
index ec97617..0000000
--- a/src/org/atriasoft/ewol/compositing/Area.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/** @file
- * @author Edouard DUPIN
- * @copyright 2011, Edouard DUPIN, all right reserved
- * @license MPL v2.0 (see license file)
- */
-#pragma once
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-namespace ewol {
- namespace compositing {
- class Area : public ewol::Compositing {
- private:
- Vector3f this.position; //!< The current position to draw
- etk::Color this.color; //!< The text foreground color
- private:
- ememory::Ptr this.GLprogram; //!< pointer on the opengl display program
- int this.GLPosition; //!< openGL id on the element (vertex buffer)
- int this.GLMatrix; //!< openGL id on the element (transformation matrix)
- int this.GLColor; //!< openGL id on the element (color buffer)
- int this.GLtexture; //!< openGL id on the element (Texture position)
- int this.GLtexID; //!< openGL id on the element (texture ID)
- private:
- ememory::Ptr this.resource; //!< texture resources
- protected:
- static int this.vboIdCoord;
- static int this.vboIdCoordText;
- static int this.vboIdColor;
- ememory::Ptr this.VBO;
- private:
- /**
- * @brief load the openGL program and get all the ID needed
- */
- void loadProgram();
- public:
- /**
- * @brief generic ructor
- * @param[in] _size Basic size of the area.
- */
- Area( Vector2i _size);
- /**
- * @brief generic destructor
- */
- ~Area();
- public:
- /**
- * @brief draw All the refistered text in the current element on openGL
- */
- void draw(boolean _disableDepthTest=true);
- /**
- * @brief clear alll the registered element in the current element
- */
- void clear();
- /**
- * @brief get the current display position (sometime needed in the gui control)
- * @return the current position.
- */
- Vector3f getPos() {
- return this.position;
- };
- /**
- * @brief set position for the next text writen
- * @param[in] _pos Position of the text (in 3D)
- */
- void setPos( Vector3f _pos) {
- this.position = _pos;
- };
- void setPos( Vector2f _pos) {
- setPos(Vector3f(_pos.x(),_pos.y(),0));
- };
- /**
- * @brief set relative position for the next text writen
- * @param[in] _pos ofset apply of the text (in 3D)
- */
- void setRelPos( Vector3f _pos) {
- this.position += _pos;
- };
- void setRelPos( Vector2f _pos) {
- setRelPos(Vector3f(_pos.x(),_pos.y(),0));
- };
- /**
- * @brief add a compleate of the image to display with the requested size
- * @param[in] _size size of the output image
- */
- void print( Vector2i _size);
-
- egami::Image get() {
- return this.resource.get();
- };
- void flush() {
- this.resource.flush();
- };
- };
- };
-};
diff --git a/src/org/atriasoft/ewol/compositing/Compositing.cpp b/src/org/atriasoft/ewol/compositing/Compositing.cpp
deleted file mode 100644
index 26f620f..0000000
--- a/src/org/atriasoft/ewol/compositing/Compositing.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/** @file
- * @author Edouard DUPIN
- * @copyright 2011, Edouard DUPIN, all right reserved
- * @license MPL v2.0 (see license file)
- */
-
-#include
-#include
-
-#include
-#include
-#include
-ETK_DECLARE_TYPE(ewol::Compositing);
-
-ewol::Compositing::Compositing() {
- // nothing to do
-}
-
-
-void ewol::Compositing::resetMatrix() {
- this.matrixApply.identity();
-}
-
-
-void ewol::Compositing::translate( Vector3f _vect) {
- this.matrixApply *= etk::matTranslate(_vect);
-}
-
-
-void ewol::Compositing::rotate( Vector3f _vect, float _angle) {
- this.matrixApply *= etk::matRotate(_vect, _angle);
-}
-
-
-void ewol::Compositing::scale( Vector3f _vect) {
- this.matrixApply *= etk::matScale(_vect);
-}
-
-
-void ewol::Compositing::clear() {
- this.matrixApply.identity();
-}
-
-
-void ewol::Compositing::setMatrix( mat4 _mat) {
- this.matrixApply = _mat;
-}
diff --git a/src/org/atriasoft/ewol/compositing/Compositing.java b/src/org/atriasoft/ewol/compositing/Compositing.java
index c2a3dfa..f999a25 100644
--- a/src/org/atriasoft/ewol/compositing/Compositing.java
+++ b/src/org/atriasoft/ewol/compositing/Compositing.java
@@ -1,58 +1,67 @@
+import org.atriasoft.etk.math.Matrix4f;
+import org.atriasoft.etk.math.Vector3f;
+
/** @file
* @author Edouard DUPIN
* @copyright 2011, Edouard DUPIN, all right reserved
* @license MPL v2.0 (see license file)
*/
-#pragma once
-#include
-#include
-#include
-
-namespace ewol {
- class Compositing {
- protected:
- mat4 this.matrixApply;
- public:
- /**
- * @brief generic ructor
- */
- Compositing();
- /**
- * @brief Generic destructor
- */
- ~Compositing() = default;
- /**
- * @brief Virtal pure function that request the draw of all openGl elements
- */
- void draw(boolean _disableDepthTest = true) = 0;
- /**
- * @brief clear alll tre registered element in the current element
- */
- void clear();
- /**
- * @brief reset to the eye matrix the openGL mouving system
- */
- void resetMatrix();
- /**
- * @brief translate the current display of this element
- * @param[in] _vect The translation vector to apply at the transformation matrix
- */
- void translate( Vector3f _vect);
- /**
- * @brief rotate the curent display of this element
- * @param[in] _vect The rotation vector to apply at the transformation matrix
- */
- void rotate( Vector3f _vect, float _angle);
- /**
- * @brief scale the current diaplsy of this element
- * @param[in] _vect The scaling vector to apply at the transformation matrix
- */
- void scale( Vector3f _vect);
- /**
- * @brief set the transformation matrix
- * @param[in] _mat The new matrix.
- */
- void setMatrix( mat4 _mat);
- };
-};
+public abstract class Compositing {
+ protected Matrix4f matrixApply = Matrix4f.identity();
+
+ /**
+ * @brief clear alll tre registered element in the current element
+ */
+ public void clear() {
+ this.matrixApply.setIdentity();
+ }
+
+ /**
+ * @brief Virtal pure function that request the draw of all openGl elements
+ */
+ public void draw() {
+ draw(true);
+ }
+
+ public abstract void draw(final boolean _disableDepthTest);
+
+ /**
+ * @brief reset to the eye matrix the openGL mouving system
+ */
+ public void resetMatrix() {
+ this.matrixApply.setIdentity();
+ }
+
+ /**
+ * @brief rotate the curent display of this element
+ * @param[in] _vect The rotation vector to apply at the transformation matrix
+ */
+ public void rotate(final Vector3f _vect, final float _angle) {
+ this.matrixApply.multiply(Matrix4f.createMatrixRotate(_vect, _angle));
+ }
+
+ /**
+ * @brief scale the current diaplsy of this element
+ * @param[in] _vect The scaling vector to apply at the transformation matrix
+ */
+ public void scale(final Vector3f _vect) {
+ this.matrixApply.multiply(Matrix4f.createMatrixScale(_vect));
+ }
+
+ /**
+ * @brief set the transformation matrix
+ * @param[in] _mat The new matrix.
+ */
+ public void setMatrix(final Matrix4f _mat) {
+ this.matrixApply = _mat;
+ }
+
+ /**
+ * @brief translate the current display of this element
+ * @param[in] _vect The translation vector to apply at the transformation matrix
+ */
+ public void translate(final Vector3f _vect) {
+ this.matrixApply.multiply(Matrix4f.createMatrixTranslate(_vect));
+ }
+}
diff --git a/src/org/atriasoft/ewol/compositing/CompositingImage.java b/src/org/atriasoft/ewol/compositing/CompositingImage.java
new file mode 100644
index 0000000..c63ad00
--- /dev/null
+++ b/src/org/atriasoft/ewol/compositing/CompositingImage.java
@@ -0,0 +1,498 @@
+/** @file
+ * @author Edouard DUPIN
+ * @copyright 2011, Edouard DUPIN, all right reserved
+ * @license MPL v2.0 (see license file)
+ */
+package org.atriasoft.ewol.compositing;
+
+import org.atriasoft.egami.Image;
+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.Vector2i;
+import org.atriasoft.etk.math.Vector3f;
+import org.atriasoft.ewol.internal.Log;
+import org.atriasoft.ewol.resource.ResourceTexture2;
+import org.atriasoft.ewol.resource.ResourceTextureFile;
+import org.atriasoft.gale.backend3d.OpenGL;
+import org.atriasoft.gale.backend3d.OpenGL.RenderMode;
+import org.atriasoft.gale.resource.ResourceProgram;
+import org.atriasoft.gale.resource.ResourceVirtualBufferObject;
+
+class CompositingImage extends Compositing {
+ public static final int sizeAuto = 0;
+ // VBO table property:
+ public static final int vboIdCoord = 0;
+ public static final int vboIdCoordTex = 1;
+ public static final int vboIdColor = 2;
+ public static final int NB_VBO = 3;
+ private Uri filename;
+ private Vector2i requestSize = new Vector2i(2, 2);
+ private Vector3f position = new Vector3f(0, 0, 0); //!< The current position to draw
+ private Vector3f clippingPosStart = new Vector3f(0, 0, 0); //!< Clipping start position
+ private Vector3f clippingPosStop = new Vector3f(0, 0, 0); //!< Clipping stop position
+ private boolean clippingEnable = true; //!< true if the clipping must be activated
+
+ private Color color = new Color(1, 1, 1); //!< The text foreground color
+ private float angle = 0; //!< Angle to set at the axes
+ private ResourceProgram GLprogram = null; //!< pointer on the opengl display program
+ private int GLPosition = -1; //!< openGL id on the element (vertex buffer)
+ private int GLMatrix = -1; //!< openGL id on the element (transformation matrix)
+ private int GLColor = -1; //!< openGL id on the element (color buffer)
+ private int GLtexture = -1; //!< openGL id on the element (Texture position)
+ private int GLtexID = -1; //!< openGL id on the element (texture ID)
+
+ private ResourceTextureFile resource = null; //!< texture resources
+ private ResourceTexture2 resourceImage = null; //!< texture resources
+ private ResourceVirtualBufferObject VBO = null;
+
+ /**
+ * @brief generic ructor
+ * @param[in] _uri URI of the file that might be loaded
+ * @param[in] _df enable distance field mode
+ * @param[in] _size for the image when Verctorial image loading is requested
+ */
+ public CompositingImage() {
+ this(new Uri(""), sizeAuto);
+ }
+
+ public CompositingImage(final Uri _uri, final int _size) {
+ this.filename = _uri;
+ // Create the VBO:
+ this.VBO = ResourceVirtualBufferObject.create(NB_VBO);
+ if (this.VBO == null) {
+ Log.error("can not instanciate VBO ...");
+ return;
+ }
+ // TO facilitate some debugs we add a name of the VBO:
+ this.VBO.setName("[VBO] of ewol::compositing::Image");
+ setSource(_uri, _size);
+ loadProgram();
+ }
+
+ /**
+ * @brief clear alll tre registered element in the current element
+ */
+ @Override
+ public void clear() {
+ // call upper class
+ super.clear();
+ // reset Buffer :
+ this.VBO.clear();
+ // reset temporal variables :
+ this.position = new Vector3f(0, 0, 0);
+ this.clippingPosStart = new Vector3f(0, 0, 0);
+ this.clippingPosStop = new Vector3f(0, 0, 0);
+ this.clippingEnable = false;
+ this.color = Color.WHITE;
+ this.angle = 0;
+ }
+
+ /**
+ * @brief draw All the refistered text in the current element on openGL
+ * @param[in] _disableDepthTest disable the Depth test for display
+ */
+ @Override
+ public void draw(final boolean _disableDepthTest) {
+ /*
+ if (this.VBO.bufferSize(this.vboIdCoord) <= 0) {
+ //Log.warning("Nothink to draw...");
+ return;
+ }
+ */
+ if (this.resource == null && this.resourceImage == null) {
+ // this is a normale case ... the user can choice to have no image ...
+ return;
+ }
+ if (this.GLprogram == null) {
+ Log.error("No shader ...");
+ return;
+ }
+ //Log.warning("Display image : " + this.VBO.bufferSize(this.vboIdCoord));
+ if (_disableDepthTest == true) {
+ OpenGL.disable(OpenGL.Flag.flag_depthTest);
+ } else {
+ OpenGL.enable(OpenGL.Flag.flag_depthTest);
+ }
+ // set Matrix : translation/positionMatrix
+ final Matrix4f tmpMatrix = OpenGL.getMatrix().multiplyNew(this.matrixApply);
+ this.GLprogram.use();
+ this.GLprogram.uniformMatrix(this.GLMatrix, tmpMatrix);
+ // TextureID
+ if (this.resourceImage != null) {
+ this.resourceImage.bindForRendering(0);
+ } else if (this.resource != null) {
+ this.resource.bindForRendering(0);
+ } else {
+ Log.error("FONT type error Request normal and display distance field ...");
+ }
+ // position:
+ this.GLprogram.sendAttributePointer(this.GLPosition, this.VBO, CompositingImage.vboIdCoord);
+ // Texture:
+ this.GLprogram.sendAttributePointer(this.GLtexture, this.VBO, CompositingImage.vboIdCoordTex);
+ // color:
+ this.GLprogram.sendAttributePointer(this.GLColor, this.VBO, CompositingImage.vboIdColor);
+ // Request the draw of the elements:
+ OpenGL.drawArrays(RenderMode.triangle, 0, this.VBO.bufferSize(CompositingImage.vboIdCoord));
+
+ this.GLprogram.unUse();
+ }
+
+ /**
+ * @brief get the current display position (sometime needed in the gui control)
+ * @return the current position.
+ */
+ public Vector3f getPos() {
+ return this.position;
+ }
+
+ /**
+ * @brief get the source image registered size in the file (<0 when multiple size image)
+ * @return tre image registered size
+ */
+ public Vector2i getRealSize() {
+ if (this.resource == null && this.resourceImage == null) {
+ return new Vector2i(0, 0);
+ }
+ if (this.resource != null) {
+ return this.resource.getRealSize();
+ }
+ if (this.resourceImage != null) {
+ return this.resourceImage.getUsableSize();
+ }
+ return new Vector2i(0, 0);
+ };
+
+ /**
+ * @brief Sometimes the user declare an image but not allocate the ressources all the time, this is to know it ..
+ * @return the validity od the resources.
+ */
+ public boolean hasSources() {
+ return this.resource != null;
+ };
+
+ /**
+ * @brief load the openGL program and get all the ID needed
+ */
+ private void loadProgram() {
+ // get the shader resource:
+ this.GLPosition = 0;
+ this.GLprogram = ResourceProgram.create(new Uri("DATA", "textured3D.vert", "ewol"), new Uri("DATA", "textured3D.frag", "ewol"));
+ if (this.GLprogram != null) {
+ this.GLPosition = this.GLprogram.getAttribute("EW_coord3d");
+ this.GLColor = this.GLprogram.getAttribute("EW_color");
+ this.GLtexture = this.GLprogram.getAttribute("EW_texture2d");
+ this.GLMatrix = this.GLprogram.getUniform("EW_MatrixTransformation");
+ this.GLtexID = this.GLprogram.getUniform("EW_texID");
+ }
+ };
+
+ public void print(final Vector2f _size) {
+ printPart(_size, new Vector2f(0, 0), new Vector2f(1, 1));
+ }
+
+ /**
+ * @brief add a compleate of the image to display with the requested size
+ * @param[in] _size size of the output image
+ */
+ public void print(final Vector2i _size) {
+ print(new Vector2f(_size.x, _size.y));
+ };
+
+ /**
+ * @brief add a part of the image to display with the requested size
+ * @param[in] _size size of the output image
+ * @param[in] _sourcePosStart Start position in the image [0..1] (can be bigger but this repeate the image).
+ * @param[in] _sourcePosStop Stop position in the image [0..1] (can be bigger but this repeate the image).
+ */
+ public void printPart(final Vector2f _size, final Vector2f _sourcePosStart, final Vector2f _sourcePosStop) {
+ if (this.resource == null) {
+ return;
+ }
+ final Vector2f openGLSize = new Vector2f(this.resource.getOpenGlSize().x, this.resource.getOpenGlSize().y);
+ final Vector2i usefullSize = this.resource.getUsableSize();
+ final Vector2f ratio = new Vector2f(usefullSize.x / openGLSize.x, usefullSize.y / openGLSize.y);
+ final Vector2f sourcePosStart = _sourcePosStart.multiplyNew(ratio);
+ final Vector2f sourcePosStop = _sourcePosStop.multiplyNew(ratio);
+ Log.verbose(" openGLSize=" + openGLSize + " usableSize=" + usefullSize + " start=" + sourcePosStart + " stop=" + sourcePosStop);
+
+ if (this.angle == 0.0f) {
+ Vector3f point = this.position.clone();
+
+ 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;
+ indexElem++;
+
+ tex = new Vector2f(sourcePosStop.x, sourcePosStop.y);
+ point = point.clone();
+ point.setX(this.position.x + _size.x);
+ point.setY(this.position.y);
+ coords[indexElem] = point;
+ coordsTex[indexElem] = tex;
+ colors[indexElem] = this.color;
+ indexElem++;
+
+ tex = new Vector2f(sourcePosStop.x, sourcePosStart.y);
+ point = point.clone();
+ point.setX(this.position.x + _size.x);
+ point.setY(this.position.y + _size.y);
+ coords[indexElem] = point;
+ coordsTex[indexElem] = tex;
+ colors[indexElem] = this.color;
+ indexElem++;
+
+ coords[indexElem] = point;
+ coordsTex[indexElem] = tex;
+ colors[indexElem] = this.color;
+ indexElem++;
+
+ tex = new Vector2f(sourcePosStart.x, sourcePosStart.y);
+ point = point.clone();
+ point.setX(this.position.x);
+ point.setY(this.position.y + _size.y);
+ coords[indexElem] = point;
+ coordsTex[indexElem] = tex;
+ colors[indexElem] = this.color;
+ indexElem++;
+
+ tex = new Vector2f(sourcePosStart.x, sourcePosStop.y);
+ point = point.clone();
+ point.setX(this.position.x);
+ point.setY(this.position.y);
+ coords[indexElem] = point;
+ coordsTex[indexElem] = tex;
+ colors[indexElem] = this.color;
+ indexElem++;
+
+ this.VBO.setVboData(CompositingImage.vboIdCoord, coords);
+ this.VBO.setVboData(CompositingImage.vboIdCoordTex, coordsTex);
+ this.VBO.setVboData(CompositingImage.vboIdColor, colors);
+
+ this.VBO.flush();
+ return;
+ }
+
+ final Vector3f center = this.position.addNew(new Vector3f(_size.x, _size.y, 0)).divide(2.0f);
+
+ final Vector3f limitedSize = new Vector3f(_size.x * 0.5f, _size.y * 0.5f, 0.0f);
+
+ Vector3f point = new Vector3f(0, 0, 0);
+
+ 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;
+ 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;
+ 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;
+ indexElem++;
+
+ coords[indexElem] = point;
+ coordsTex[indexElem] = tex;
+ colors[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;
+ 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;
+ indexElem++;
+
+ this.VBO.setVboData(CompositingImage.vboIdCoord, coords);
+ this.VBO.setVboData(CompositingImage.vboIdCoordTex, coordsTex);
+ this.VBO.setVboData(CompositingImage.vboIdColor, colors);
+
+ this.VBO.flush();
+ };
+
+ /**
+ * @brief set a unique rotation of this element (not set in the rotate Generic system)
+ * @param[in] _angle Angle to set in radiant.
+ */
+ public void setAngle(final float _angleRad) {
+ this.angle = _angleRad;
+ };
+
+ void setClipping(final Vector2f _pos, final Vector2f _posEnd) {
+ setClipping(new Vector3f(_pos.x, _pos.y, 0), new Vector3f(_posEnd.x, _posEnd.y, 0));
+ };
+
+ /**
+ * @brief Request a clipping area for the text (next draw only)
+ * @param[in] _pos Start position of the clipping
+ * @param[in] _posEnd End position of the clipping
+ */
+ public void setClipping(final Vector3f _pos, final Vector3f _posEnd) {
+ // note the internal system all time request to have a bounding all time in the same order
+ if (_pos.x <= _posEnd.x) {
+ this.clippingPosStart.setX(_pos.x);
+ this.clippingPosStop.setX(_posEnd.x);
+ } else {
+ this.clippingPosStart.setX(_posEnd.x);
+ this.clippingPosStop.setX(_pos.x);
+ }
+ if (_pos.y <= _posEnd.y) {
+ this.clippingPosStart.setY(_pos.y);
+ this.clippingPosStop.setY(_posEnd.y);
+ } else {
+ this.clippingPosStart.setY(_posEnd.y);
+ this.clippingPosStop.setY(_pos.y);
+ }
+ if (_pos.z <= _posEnd.z) {
+ this.clippingPosStart.setZ(_pos.z);
+ this.clippingPosStop.setZ(_posEnd.z);
+ } else {
+ this.clippingPosStart.setZ(_posEnd.z);
+ this.clippingPosStop.setZ(_pos.z);
+ }
+ this.clippingEnable = true;
+ }
+
+ /**
+ * @brief enable/Disable the clipping (without lose the current clipping position)
+ * @brief _newMode The new status of the clipping
+ */
+ public void setClippingMode(final boolean _newMode) {
+ this.clippingEnable = _newMode;
+ };
+
+ public void setClippingWidth(final Vector2f _pos, final Vector2f _width) {
+ setClippingWidth(new Vector3f(_pos.x, _pos.y, 0), new Vector3f(_width.x, _width.y, 0));
+ };
+
+ /**
+ * @brief Request a clipping area for the text (next draw only)
+ * @param[in] _pos Start position of the clipping
+ * @param[in] _width Width size of the clipping
+ */
+ public void setClippingWidth(final Vector3f _pos, final Vector3f _width) {
+ setClipping(_pos, _pos.addNew(_width));
+ }
+
+ /**
+ * @brief set the Color of the current foreground font
+ * @param[in] _color Color to set on foreground (for next print)
+ */
+ public void setColor(final Color _color) {
+ this.color = _color;
+ };
+
+ public void setPos(final Vector2f _pos) {
+ setPos(new Vector3f(_pos.x, _pos.y, 0));
+ }
+
+ /**
+ * @brief set position for the next text writen
+ * @param[in] _pos Position of the text (in 3D)
+ */
+ public void setPos(final Vector3f _pos) {
+ this.position = _pos;
+ }
+
+ public void setRelPos(final Vector2f _pos) {
+ setRelPos(new Vector3f(_pos.x, _pos.y, 0));
+ }
+
+ /**
+ * @brief set relative position for the next text writen
+ * @param[in] _pos ofset apply of the text (in 3D)
+ */
+ public void setRelPos(final Vector3f _pos) {
+ this.position.add(_pos);
+ }
+
+ public void setSource(final Image _image) {
+ clear();
+ this.filename = null;
+ this.requestSize = _image.getSize();
+ this.resourceImage = new ResourceTexture2();
+ this.resourceImage.set(_image);
+ }
+
+ /**
+ * @brief change the image Source == > can not be done to display 2 images at the same time ...
+ * @param[in] _uri New file of the Image
+ * @param[in] _size for the image when Verctorial image loading is requested
+ */
+ public void setSource(final Uri _uri) {
+ setSource(_uri, 32);
+ }
+
+ public void setSource(final Uri _uri, final int _size) {
+ setSource(_uri, new Vector2i(_size, _size));
+ }
+
+ public void setSource(final Uri _uri, final Vector2i _size) {
+ clear();
+ if (this.filename == _uri && this.requestSize.x == _size.x && this.requestSize.y == _size.y) {
+ // Nothing to do ...
+ return;
+ }
+ final ResourceTextureFile resource = this.resource;
+ final ResourceTexture2 resourceTex = this.resourceImage;
+ this.filename = _uri;
+ this.requestSize = _size;
+ this.resource = null;
+ this.resourceImage = null;
+
+ final Vector2i tmpSize = new Vector2i(_size.x, _size.y);
+ // note that no image can be loaded...
+ if (_uri.isEmpty() == false) {
+ // link to new one
+ this.resource = ResourceTextureFile.create(this.filename, tmpSize);
+ if (this.resource == null) {
+ Log.error("Can not get Image resource");
+ }
+ }
+ if (this.resource == null && this.resourceImage == null) {
+ if (resource != null) {
+ Log.warning("Retrive previous resource");
+ this.resource = resource;
+ }
+ if (resourceTex != null) {
+ Log.warning("Retrive previous resource (image)");
+ this.resourceImage = resourceTex;
+ }
+ }
+ }
+
+}
diff --git a/src/org/atriasoft/ewol/compositing/Drawing.cpp b/src/org/atriasoft/ewol/compositing/Drawing.cpp
index 9c37acc..9d6ae1c 100644
--- a/src/org/atriasoft/ewol/compositing/Drawing.cpp
+++ b/src/org/atriasoft/ewol/compositing/Drawing.cpp
@@ -320,10 +320,10 @@ void ewol::compositing::Drawing::draw(boolean _disableDepthTest) {
return;
}
// set Matrix : translation/positionMatrix
- mat4 tmpMatrix = gale::openGL::getMatrix()*this.matrixApply;
+ Matrix4f tmpMatrix = gale::openGL::getMatrix()*this.matrixApply;
this.GLprogram.use();
this.GLprogram.uniformMatrix(this.GLMatrix, tmpMatrix);
- mat4 tmpMatrix2;
+ Matrix4f tmpMatrix2;
this.GLprogram.uniformMatrix(this.GLMatrixPosition, tmpMatrix2);
// position:
this.GLprogram.sendAttributePointer(this.GLPosition, this.VBO, this.vboIdCoord);
diff --git a/src/org/atriasoft/ewol/compositing/Drawing.java b/src/org/atriasoft/ewol/compositing/Drawing.java
index aa22d2f..c53283d 100644
--- a/src/org/atriasoft/ewol/compositing/Drawing.java
+++ b/src/org/atriasoft/ewol/compositing/Drawing.java
@@ -1,229 +1,275 @@
+
/** @file
* @author Edouard DUPIN
* @copyright 2011, Edouard DUPIN, all right reserved
* @license MPL v2.0 (see license file)
*/
-#pragma once
+package org.atriasoft.ewol.compositing;
-#include
+import org.atriasoft.etk.Color;
+import org.atriasoft.etk.math.Vector2f;
+import org.atriasoft.etk.math.Vector3f;
+import org.atriasoft.ewol.internal.Log;
+import org.atriasoft.gale.resource.ResourceProgram;
+import org.atriasoft.gale.resource.ResourceVirtualBufferObject;
-#include
-#include
-#include
-
-
-namespace ewol {
- namespace compositing {
- class Drawing : public ewol::Compositing {
- private:
- Vector3f this.position; //!< The current position to draw
- Vector3f this.clippingPosStart; //!< Clipping start position
- Vector3f this.clippingPosStop; //!< Clipping stop position
- boolean this.clippingEnable; //!< true if the clipping must be activated
- private:
- etk::Color<> this.color; //!< The text foreground color
- etk::Color<> this.colorBg; //!< The text background color
- private:
- ememory::Ptr this.GLprogram; //!< pointer on the opengl display program
- int this.GLPosition; //!< openGL id on the element (vertex buffer)
- int this.GLMatrix; //!< openGL id on the element (transformation matrix)
- int this.GLMatrixPosition; //!< position matrix
- int this.GLColor; //!< openGL id on the element (color buffer)
- protected:
- static int this.vboIdCoord;
- static int this.vboIdColor;
- ememory::Ptr this.VBO;
- public:
- /**
- * @brief Basic ructor
- */
- Drawing();
- /**
- * @brief Basic destructor
- */
- ~Drawing();
- private:
- /**
+class Drawing extends Compositing {
+
+ private Vector3f position = new Vector3f(0, 0, 0); //!< The current position to draw
+ private final Vector3f clippingPosStart = new Vector3f(0, 0, 0); //!< Clipping start position
+ private final Vector3f clippingPosStop = new Vector3f(0, 0, 0); //!< Clipping stop position
+ private boolean clippingEnable = false; //!< true if the clipping must be activated
+ private Color color = Color.BLACK.clone(); //!< The text foreground color
+ private Color colorBg = Color.NONE.clone(); //!< The text background color
+ private ResourceProgram GLprogram; //!< pointer on the opengl display program
+ private final int GLPosition = -1; //!< openGL id on the element (vertex buffer)
+ private final int GLMatrix = -1; //!< openGL id on the element (transformation matrix)
+ private final int GLMatrixPosition = -1; //!< position matrix
+ private final int GLColor = -1; //!< openGL id on the element (color buffer)
+ protected static int vboIdCoord = 0;
+ protected static int vboIdColor = 1;
+ protected ResourceVirtualBufferObject VBO;
+
+ /**
+ * @brief Basic ructor
+ */
+ public Drawing() {
+ loadProgram();
+ for (int iii = 0; iii < 3; iii++) {
+ this.triangle[iii] = this.position;
+ this.tricolor[iii] = this.color;
+ }
+ // Create the VBO:
+ this.VBO = ResourceVirtualBufferObject.create(4);
+ if (this.VBO == null) {
+ Log.error("can not instanciate VBO ...");
+ return;
+ }
+ // TO facilitate some debugs we add a name of the VBO:
+ this.VBO.setName("[VBO] of ewol::compositing::Area");
+ }
+
+ /**
* @brief load the openGL program and get all the ID needed
*/
- void loadProgram();
- /**
+ private void loadProgram();
+
+ /**
* @brief Un-Load the openGL program and get all the ID needed
*/
- void unLoadProgram();
- float this.thickness; //!< when drawing line and other things
- int this.triElement; //!< special counter of the single dot generated
- Vector3f this.triangle[3]; //!< Register every system with a combinaison of tiangle
- etk::Color this.tricolor[3]; //!< Register every the associated color foreground
- // internal API for the generation abstraction of triangles
- /**
+ private void unLoadProgram();
+
+ private final float thickness = 0; //!< when drawing line and other things
+ private final int triElement = 0; //!< special counter of the single dot generated
+ 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
+ // internal API for the generation abstraction of triangles
+
+ /**
* @brief Lunch the generation of triangle
*/
- void generateTriangle();
- /**
+ private void generateTriangle() {
+ this.triElement = 0;
+
+ this.VBO.pushOnBuffer(this.vboIdCoord, this.triangle[0]);
+ this.VBO.pushOnBuffer(this.vboIdColor, this.tricolor[0]);
+ this.VBO.pushOnBuffer(this.vboIdCoord, this.triangle[1]);
+ this.VBO.pushOnBuffer(this.vboIdColor, this.tricolor[1]);
+ this.VBO.pushOnBuffer(this.vboIdCoord, this.triangle[2]);
+ this.VBO.pushOnBuffer(this.vboIdColor, this.tricolor[2]);
+ };
+
+ /**
* @brief in case of some error the count can be reset
*/
- void resetCount();
- /**
+ private void resetCount();
+
+ /**
* @brief set the Color of the current triangle drawing
* @param[in] _color Color to current dots generated
*/
- void internalSetColor( etk::Color<> _color);
- /**
+ private void internalSetColor(Color _color);
+
+ /**
* @brief internal add of the specific point
* @param[in] _point The requeste dpoint to add
*/
- void setPoint( Vector3f point);
-
- public:
- /**
+ private void setPoint(Vector3f point);
+
+ /**
* @brief draw All the refistered text in the current element on openGL
*/
- void draw(boolean _disableDepthTest=true);
- /**
- * @brief clear alll tre registered element in the current element
- */
- void clear();
- /**
- * @brief get the current display position (sometime needed in the gui control)
- * @return the current position.
- */
- Vector3f getPos() {
- return this.position;
- };
- /**
- * @brief set position for the next text writen
- * @param[in] _pos Position of the text (in 3D)
- */
- void setPos( Vector3f _pos) {
- this.position = _pos;
- };
- void setPos( Vector2f _pos) {
- setPos(Vector3f(_pos.x(), _pos.y(), 0));
- };
- /**
- * @brief set relative position for the next text writen
- * @param[in] _pos ofset apply of the text (in 3D)
- */
- void setRelPos( Vector3f _pos) {
- this.position += _pos;
- };
- void setRelPos( Vector2f _pos) {
- setRelPos(Vector3f(_pos.x(), _pos.y(), 0));
- };
- /**
+ @Override
+ public void draw(final boolean _disableDepthTest=true);
+
+ /**
+ * @brief clear alll tre registered element in the current element
+ */
+ @Override
+ public void clear();
+
+ /**
+ * @brief get the current display position (sometime needed in the gui control)
+ * @return the current position.
+ */
+ public Vector3f getPos() {
+ return this.position;
+ };
+
+ /**
+ * @brief set position for the next text writen
+ * @param[in] _pos Position of the text (in 3D)
+ */
+ public void setPos(final Vector3f _pos) {
+ this.position = _pos;
+ };
+
+ public void setPos(final Vector2f _pos) {
+ setPos(Vector3f(_pos.x(), _pos.y(), 0));
+ };
+
+ /**
+ * @brief set relative position for the next text writen
+ * @param[in] _pos ofset apply of the text (in 3D)
+ */
+ public void setRelPos(final Vector3f _pos) {
+ this.position += _pos;
+ };
+
+ public void setRelPos(final Vector2f _pos) {
+ setRelPos(Vector3f(_pos.x(), _pos.y(), 0));
+ };
+
+ /**
* @brief set the Color of the current foreground font
* @param[in] _color Color to set on foreground (for next print)
*/
- void setColor( etk::Color<> _color) {
- this.color = _color;
- };
- /**
- * @brief Get the foreground color of the font.
- * @return Foreground color.
- */
- etk::Color<> getColor() {
- return this.color;
- };
- /**
+ public void setColor(final Color _color) {
+ this.color = _color;
+ };
+
+ /**
+ * @brief Get the foreground color of the font.
+ * @return Foreground color.
+ */
+ public Color getColor() {
+ return this.color;
+ };
+
+ /**
* @brief set the background color of the font (for selected Text (not the global BG))
* @param[in] _color Color to set on background (for next print)
*/
- void setColorBg( etk::Color<> _color) {
- this.colorBg = _color;
- };
- /**
- * @brief Get the background color of the font.
- * @return Background color.
- */
- etk::Color<> getColorBg() {
- return this.colorBg;
- };
- /**
- * @brief Request a clipping area for the text (next draw only)
- * @param[in]_ pos Start position of the clipping
- * @param[in] _width Width size of the clipping
- */
- void setClippingWidth( Vector3f _pos, Vector3f _width) {
- setClipping(_pos, _pos+_width);
- };
- void setClippingWidth( Vector2f _pos, Vector2f _width) {
- setClippingWidth(Vector3f(_pos.x(),_pos.y(),-1), Vector3f(_width.x(),_width.y(), 2));
- };
- /**
- * @brief Request a clipping area for the text (next draw only)
- * @param[in] _pos Start position of the clipping
- * @param[in] _posEnd End position of the clipping
- */
- void setClipping( Vector3f _pos, Vector3f _posEnd);
- void setClipping( Vector2f _pos, Vector2f _posEnd) {
- setClipping(Vector3f(_pos.x(),_pos.y(),-1), Vector3f(_posEnd.x(),_posEnd.y(), 1));
- };
- /**
- * @brief enable/Disable the clipping (without lose the current clipping position)
- * @brief _newMode The new status of the clipping
- */
- void setClippingMode(boolean _newMode) {
- this.clippingEnable = _newMode;
- };
- /**
- * @brief Specify the line thickness for the next elements
- * @param[in] _thickness The thickness disired for the next print
- */
- void setThickness(float _thickness);
- /**
- * @brief add a point reference at the current position (this is a vertex reference at the current position
- */
- void addVertex();
- /**
- * @brief draw a line to a specific position
- * @param[in] _dest Position of the end of the line.
- */
- void lineTo( Vector3f _dest);
- void lineTo( Vector2f _dest) {
- lineTo(Vector3f(_dest.x(), _dest.y(), 0));
- };
- /**
- * @brief Relative drawing a line (spacial vector)
- * @param[in] _vect Vector of the curent line.
- */
- void lineRel( Vector3f _vect) {
- lineTo(this.position+_vect);
- };
- void lineRel( Vector2f _vect) {
- lineRel(Vector3f(_vect.x(), _vect.y(), 0));
- };
- /**
- * @brief draw a 2D rectangle to the position requested.
- * @param[in] _dest Position the the end of the rectangle
- */
- void rectangle( Vector3f _dest);
- void rectangle( Vector2f _dest) {
- rectangle(Vector3f(_dest.x(), _dest.y(), 0));
- };
- /**
- * @brief draw a 2D rectangle to the requested size.
- * @param[in] _size size of the rectangle
- */
- void rectangleWidth( Vector3f _size) {
- rectangle(this.position+_size);
- };
- void rectangleWidth( Vector2f _size) {
- rectangleWidth(Vector3f(_size.x(), _size.y(), 0));
- };
- /**
- * @brief draw a 3D rectangle to the position requested.
- * @param[in] _dest Position the the end of the rectangle
- */
- void cube( Vector3f _dest);
- /**
+ public void setColorBg(final Color _color) {
+ this.colorBg = _color;
+ };
+
+ /**
+ * @brief Get the background color of the font.
+ * @return Background color.
+ */
+ public Color getColorBg() {
+ return this.colorBg;
+ };
+
+ /**
+ * @brief Request a clipping area for the text (next draw only)
+ * @param[in]_ pos Start position of the clipping
+ * @param[in] _width Width size of the clipping
+ */
+ public void setClippingWidth(final Vector3f _pos, final Vector3f _width) {
+ setClipping(_pos, _pos + _width);
+ };
+
+ public void setClippingWidth(final Vector2f _pos, final Vector2f _width) {
+ setClippingWidth(Vector3f(_pos.x(), _pos.y(), -1), Vector3f(_width.x(), _width.y(), 2));
+ };
+
+ /**
+ * @brief Request a clipping area for the text (next draw only)
+ * @param[in] _pos Start position of the clipping
+ * @param[in] _posEnd End position of the clipping
+ */
+ public void setClipping(Vector3f _pos, Vector3f _posEnd);
+
+ public void setClipping(final Vector2f _pos, final Vector2f _posEnd) {
+ setClipping(Vector3f(_pos.x(), _pos.y(), -1), Vector3f(_posEnd.x(), _posEnd.y(), 1));
+ };
+
+ /**
+ * @brief enable/Disable the clipping (without lose the current clipping position)
+ * @brief _newMode The new status of the clipping
+ */
+ public void setClippingMode(final boolean _newMode) {
+ this.clippingEnable = _newMode;
+ };
+
+ /**
+ * @brief Specify the line thickness for the next elements
+ * @param[in] _thickness The thickness disired for the next print
+ */
+ public void setThickness(float _thickness);
+
+ /**
+ * @brief add a point reference at the current position (this is a vertex reference at the current position
+ */
+ public void addVertex();
+
+ /**
+ * @brief draw a line to a specific position
+ * @param[in] _dest Position of the end of the line.
+ */
+ public void lineTo(Vector3f _dest);
+
+ public void lineTo(final Vector2f _dest) {
+ lineTo(new Vector3f(_dest.x, _dest.y, 0));
+ };
+
+ /**
+ * @brief Relative drawing a line (spacial vector)
+ * @param[in] _vect Vector of the curent line.
+ */
+ public void lineRel(final Vector3f _vect) {
+ lineTo(this.position.addNew(_vect));
+ };
+
+ public void lineRel(final Vector2f _vect) {
+ lineRel(new Vector3f(_vect.x, _vect.y, 0));
+ };
+
+ /**
+ * @brief draw a 2D rectangle to the position requested.
+ * @param[in] _dest Position the the end of the rectangle
+ */
+ public void rectangle(Vector3f _dest);
+
+ public void rectangle(final Vector2f _dest) {
+ rectangle(Vector3f(_dest.x(), _dest.y(), 0));
+ };
+
+ /**
+ * @brief draw a 2D rectangle to the requested size.
+ * @param[in] _size size of the rectangle
+ */
+ public void rectangleWidth(final Vector3f _size) {
+ rectangle(this.position + _size);
+ };
+
+ public void rectangleWidth(final Vector2f _size) {
+ rectangleWidth(Vector3f(_size.x(), _size.y(), 0));
+ };
+
+ /**
+ * @brief draw a 3D rectangle to the position requested.
+ * @param[in] _dest Position the the end of the rectangle
+ */
+ public void cube(Vector3f _dest);
+
+ /**
* @brief draw a 2D circle with the specify rafdius parameter.
* @param[in] _radius Distence to the dorder
* @param[in] _angleStart start angle of this circle ([0..2PI] otherwithe == > disable)
* @param[in] _angleStop stop angle of this circle ([0..2PI] otherwithe == > disable)
*/
- void circle(float _radius, float _angleStart = 0, float _angleStop = 2*M_PI);
- };
- };
-};
-
+ public void circle(final float _radius, final float _angleStart = 0, float _angleStop = 2*M_PI);
+ }
diff --git a/src/org/atriasoft/ewol/compositing/Image.cpp b/src/org/atriasoft/ewol/compositing/Image.cpp
deleted file mode 100644
index 37b13fc..0000000
--- a/src/org/atriasoft/ewol/compositing/Image.cpp
+++ /dev/null
@@ -1,364 +0,0 @@
-/** @file
- * @author Edouard DUPIN
- * @copyright 2011, Edouard DUPIN, all right reserved
- * @license MPL v2.0 (see license file)
- */
-
-#include
-#include
-#include
-ETK_DECLARE_TYPE(ewol::compositing::Image);
-
- int ewol::compositing::Image::sizeAuto(0);
-
-// VBO table property:
- int ewol::compositing::Image::this.vboIdCoord(0);
- int ewol::compositing::Image::this.vboIdCoordTex(1);
- int ewol::compositing::Image::this.vboIdColor(2);
-#define NB_VBO (3)
-
-ewol::compositing::Image::Image( etk::Uri _imageName,
- boolean _df,
- int _size) :
- this.filename(_imageName),
- this.requestSize(2,2),
- this.position(0.0, 0.0, 0.0),
- this.clippingPosStart(0.0, 0.0, 0.0),
- this.clippingPosStop(0.0, 0.0, 0.0),
- this.clippingEnable(false),
- this.color(etk::color::white),
- this.angle(0.0),
- this.GLprogram(null),
- this.GLPosition(-1),
- this.GLMatrix(-1),
- this.GLColor(-1),
- this.GLtexture(-1),
- this.GLtexID(-1),
- this.distanceFieldMode(_df),
- this.resource(null),
- this.resourceDF(null) {
- // Create the VBO:
- this.VBO = gale::resource::VirtualBufferObject::create(NB_VBO);
- if (this.VBO == null) {
- Log.error("can not instanciate VBO ...");
- return;
- }
- // TO facilitate some debugs we add a name of the VBO:
- this.VBO.setName("[VBO] of ewol::compositing::Image");
- setSource(_imageName, _size);
- loadProgram();
-}
-
-ewol::compositing::Image::~Image() {
-
-}
-
-void ewol::compositing::Image::loadProgram() {
- // get the shader resource:
- this.GLPosition = 0;
- this.GLprogram.reset();
- if (this.distanceFieldMode == true) {
- this.GLprogram = gale::resource::Program::create("DATA:///texturedDF.prog?lib=ewol");
- } else {
- this.GLprogram = gale::resource::Program::create("DATA:///textured3D.prog?lib=ewol");
- }
- if (this.GLprogram != null) {
- this.GLPosition = this.GLprogram.getAttribute("EW_coord3d");
- this.GLColor = this.GLprogram.getAttribute("EW_color");
- this.GLtexture = this.GLprogram.getAttribute("EW_texture2d");
- this.GLMatrix = this.GLprogram.getUniform("EW_MatrixTransformation");
- this.GLtexID = this.GLprogram.getUniform("EW_texID");
- }
-}
-
-void ewol::compositing::Image::draw(boolean _disableDepthTest) {
- if (this.VBO.bufferSize(this.vboIdCoord) <= 0) {
- //Log.warning("Nothink to draw...");
- return;
- }
- if ( this.resource == null
- LOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOM this.resourceDF == null
- LOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOM this.resourceImage == null) {
- // this is a normale case ... the user can choice to have no image ...
- return;
- }
- if (this.GLprogram == null) {
- Log.error("No shader ...");
- return;
- }
- //Log.warning("Display image : " + this.VBO.bufferSize(this.vboIdCoord));
- if (_disableDepthTest == true) {
- gale::openGL::disable(gale::openGL::flag_depthTest);
- } else {
- gale::openGL::enable(gale::openGL::flag_depthTest);
- }
- // set Matrix : translation/positionMatrix
- mat4 tmpMatrix = gale::openGL::getMatrix()*this.matrixApply;
- this.GLprogram.use();
- this.GLprogram.uniformMatrix(this.GLMatrix, tmpMatrix);
- // TextureID
- if (this.resourceImage != null) {
- this.GLprogram.setTexture0(this.GLtexID, this.resourceImage.getRendererId());
- } else if (this.resource != null) {
- if (this.distanceFieldMode == true) {
- Log.error("FONT type error Request distance field and display normal ...");
- }
- this.GLprogram.setTexture0(this.GLtexID, this.resource.getRendererId());
- } else {
- if (this.distanceFieldMode == false) {
- Log.error("FONT type error Request normal and display distance field ...");
- }
- this.GLprogram.setTexture0(this.GLtexID, this.resourceDF.getRendererId());
- }
- // position:
- this.GLprogram.sendAttributePointer(this.GLPosition, this.VBO, this.vboIdCoord);
- // Texture:
- this.GLprogram.sendAttributePointer(this.GLtexture, this.VBO, this.vboIdCoordTex);
- // color:
- this.GLprogram.sendAttributePointer(this.GLColor, this.VBO, this.vboIdColor);
- // Request the draw of the elements:
- gale::openGL::drawArrays(gale::openGL::renderMode::triangle, 0, this.VBO.bufferSize(this.vboIdCoord));
- this.GLprogram.unUse();
-}
-
-void ewol::compositing::Image::clear() {
- // call upper class
- ewol::Compositing::clear();
- // reset Buffer :
- this.VBO.clear();
- // reset temporal variables :
- this.position = Vector3f(0.0, 0.0, 0.0);
- this.clippingPosStart = Vector3f(0.0, 0.0, 0.0);
- this.clippingPosStop = Vector3f(0.0, 0.0, 0.0);
- this.clippingEnable = false;
- this.color = etk::color::white;
- this.angle = 0.0;
-}
-
-void ewol::compositing::Image::setClipping( Vector3f _pos, Vector3f _posEnd) {
- // note the internal system all time request to have a bounding all time in the same order
- if (_pos.x() <= _posEnd.x()) {
- this.clippingPosStart.setX(_pos.x());
- this.clippingPosStop.setX(_posEnd.x());
- } else {
- this.clippingPosStart.setX(_posEnd.x());
- this.clippingPosStop.setX(_pos.x());
- }
- if (_pos.y() <= _posEnd.y()) {
- this.clippingPosStart.setY(_pos.y());
- this.clippingPosStop.setY(_posEnd.y());
- } else {
- this.clippingPosStart.setY(_posEnd.y());
- this.clippingPosStop.setY(_pos.y());
- }
- if (_pos.z() <= _posEnd.z()) {
- this.clippingPosStart.setZ(_pos.z());
- this.clippingPosStop.setZ(_posEnd.z());
- } else {
- this.clippingPosStart.setZ(_posEnd.z());
- this.clippingPosStop.setZ(_pos.z());
- }
- this.clippingEnable = true;
-}
-
-void ewol::compositing::Image::setAngle(float _angle) {
- this.angle = _angle;
-}
-
-void ewol::compositing::Image::print( Vector2f _size) {
- printPart(_size, Vector2f(0,0), Vector2f(1.0,1.0));
-}
-
-void ewol::compositing::Image::printPart( Vector2f _size,
- Vector2f _sourcePosStart,
- Vector2f _sourcePosStop) {
- if (this.resource == null) {
- return;
- }
- Vector2f openGLSize = Vector2f(this.resource.getOpenGlSize().x(), this.resource.getOpenGlSize().y());
- Vector2f usefullSize = this.resource.getUsableSize();
- Vector2f ratio = usefullSize/openGLSize;
- _sourcePosStart *= ratio;
- _sourcePosStop *= ratio;
- Log.verbose(" openGLSize=" + openGLSize + " usableSize=" + usefullSize + " start=" + _sourcePosStart + " stop=" + _sourcePosStop);
-
- //Log.error("Debug image " + this.filename + " ==> " + this.position + " " + _size + " " + _sourcePosStart + " " << _sourcePosStop);
- if (this.angle == 0.0f) {
- Vector3f point = this.position;
- Vector2f tex(_sourcePosStart.x(),_sourcePosStop.y());
- this.VBO.pushOnBuffer(this.vboIdCoord, point);
- this.VBO.pushOnBuffer(this.vboIdCoordTex, tex);
- this.VBO.pushOnBuffer(this.vboIdColor, this.color);
-
- tex.setValue(_sourcePosStop.x(),_sourcePosStop.y());
- point.setX(this.position.x() + _size.x());
- point.setY(this.position.y());
- this.VBO.pushOnBuffer(this.vboIdCoord, point);
- this.VBO.pushOnBuffer(this.vboIdCoordTex, tex);
- this.VBO.pushOnBuffer(this.vboIdColor, this.color);
-
- tex.setValue(_sourcePosStop.x(),_sourcePosStart.y());
- point.setX(this.position.x() + _size.x());
- point.setY(this.position.y() + _size.y());
- this.VBO.pushOnBuffer(this.vboIdCoord, point);
- this.VBO.pushOnBuffer(this.vboIdCoordTex, tex);
- this.VBO.pushOnBuffer(this.vboIdColor, this.color);
-
- this.VBO.pushOnBuffer(this.vboIdCoord, point);
- this.VBO.pushOnBuffer(this.vboIdCoordTex, tex);
- this.VBO.pushOnBuffer(this.vboIdColor, this.color);
-
- tex.setValue(_sourcePosStart.x(),_sourcePosStart.y());
- point.setX(this.position.x());
- point.setY(this.position.y() + _size.y());
- this.VBO.pushOnBuffer(this.vboIdCoord, point);
- this.VBO.pushOnBuffer(this.vboIdCoordTex, tex);
- this.VBO.pushOnBuffer(this.vboIdColor, this.color);
-
- tex.setValue(_sourcePosStart.x(),_sourcePosStop.y());
- point.setX(this.position.x());
- point.setY(this.position.y());
- this.VBO.pushOnBuffer(this.vboIdCoord, point);
- this.VBO.pushOnBuffer(this.vboIdCoordTex, tex);
- this.VBO.pushOnBuffer(this.vboIdColor, this.color);
- this.VBO.flush();
- return;
- }
- Vector3f center = this.position + Vector3f(_size.x(),_size.y(),0)/2.0f;
- Vector3f limitedSize(_size.x()*0.5f, _size.y()*0.5f, 0.0f);
-
- Vector3f point(0,0,0);
- Vector2f tex(_sourcePosStart.x(),_sourcePosStop.y());
-
- point.setValue(-limitedSize.x(), -limitedSize.y(), 0);
- point = point.rotate(Vector3f(0,0,1), this.angle) + center;
- this.VBO.pushOnBuffer(this.vboIdCoord, point);
- this.VBO.pushOnBuffer(this.vboIdCoordTex, tex);
- this.VBO.pushOnBuffer(this.vboIdColor, this.color);
-
- tex.setValue(_sourcePosStop.x(),_sourcePosStop.y());
- point.setValue(limitedSize.x(), -limitedSize.y(), 0);
- point = point.rotate(Vector3f(0,0,1), this.angle) + center;
- this.VBO.pushOnBuffer(this.vboIdCoord, point);
- this.VBO.pushOnBuffer(this.vboIdCoordTex, tex);
- this.VBO.pushOnBuffer(this.vboIdColor, this.color);
-
- tex.setValue(_sourcePosStop.x(),_sourcePosStart.y());
- point.setValue(limitedSize.x(), limitedSize.y(), 0);
- point = point.rotate(Vector3f(0,0,1), this.angle) + center;
- this.VBO.pushOnBuffer(this.vboIdCoord, point);
- this.VBO.pushOnBuffer(this.vboIdCoordTex, tex);
- this.VBO.pushOnBuffer(this.vboIdColor, this.color);
-
- this.VBO.pushOnBuffer(this.vboIdCoord, point);
- this.VBO.pushOnBuffer(this.vboIdCoordTex, tex);
- this.VBO.pushOnBuffer(this.vboIdColor, this.color);
-
- tex.setValue(_sourcePosStart.x(),_sourcePosStart.y());
- point.setValue(-limitedSize.x(), limitedSize.y(), 0);
- point = point.rotate(Vector3f(0,0,1), this.angle) + center;
- this.VBO.pushOnBuffer(this.vboIdCoord, point);
- this.VBO.pushOnBuffer(this.vboIdCoordTex, tex);
- this.VBO.pushOnBuffer(this.vboIdColor, this.color);
-
- tex.setValue(_sourcePosStart.x(),_sourcePosStop.y());
- point.setValue(-limitedSize.x(), -limitedSize.y(), 0);
- point = point.rotate(Vector3f(0,0,1), this.angle) + center;
- this.VBO.pushOnBuffer(this.vboIdCoord, point);
- this.VBO.pushOnBuffer(this.vboIdCoordTex, tex);
- this.VBO.pushOnBuffer(this.vboIdColor, this.color);
-
- this.VBO.flush();
-}
-
-void ewol::compositing::Image::setSource( etk::Uri _uri, Vector2f _size) {
- clear();
- if ( this.filename == _uri
- LOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOM this.requestSize == _size) {
- // Nothing to do ...
- return;
- }
- ememory::Ptr resource = this.resource;
- ememory::Ptr resourceDF = this.resourceDF;
- ememory::Ptr resourceTex = this.resourceImage;
- this.filename = _uri;
- this.requestSize = _size;
- this.resource.reset();
- this.resourceDF.reset();
- this.resourceImage.reset();
- Vector2i tmpSize(_size.x(),_size.y());
- // note that no image can be loaded...
- if (_uri.isEmpty() == false) {
- // link to new one
- if (this.distanceFieldMode == false) {
- this.resource = ewol::resource::TextureFile::create(this.filename, tmpSize);
- if (this.resource == null) {
- Log.error("Can not get Image resource");
- }
- } else {
- this.resourceDF = ewol::resource::ImageDF::create(this.filename, tmpSize);
- if (this.resourceDF == null) {
- Log.error("Can not get Image resource DF");
- }
- }
- }
- if ( this.resource == null
- LOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOM this.resourceDF == null
- LOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOM this.resourceImage == null) {
- if (resource != null) {
- Log.warning("Retrive previous resource");
- this.resource = resource;
- }
- if (resourceDF != null) {
- Log.warning("Retrive previous resource (DF)");
- this.resourceDF = resourceDF;
- }
- if (resourceTex != null) {
- Log.warning("Retrive previous resource (image)");
- this.resourceImage = resourceTex;
- }
- }
-}
-void ewol::compositing::Image::setSource(egami::Image _image) {
- clear();
- this.filename = "direct image BUFFER";
- this.requestSize = _image.getSize();
- this.resourceImage = ewol::resource::Texture::create();
- this.resourceImage.set(etk::move(_image));
-}
-
-boolean ewol::compositing::Image::hasSources() {
- return this.resource != null
- || this.resourceDF != null;
-}
-
-
-Vector2f ewol::compositing::Image::getRealSize() {
- if ( this.resource == null
- LOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOM this.resourceDF == null
- LOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOM this.resourceImage == null) {
- return Vector2f(0,0);
- }
- if (this.resource != null) {
- return this.resource.getRealSize();
- }
- if (this.resourceDF != null) {
- return this.resourceDF.getRealSize();
- }
- if (this.resourceImage != null) {
- return this.resourceImage.getUsableSize();
- }
- return Vector2f(0,0);
-}
-
-
-
-void ewol::compositing::Image::setDistanceFieldMode(boolean _mode) {
- if (this.distanceFieldMode == _mode) {
- return;
- }
- this.distanceFieldMode = _mode;
- // Force reload input
- setSource(this.filename, this.requestSize);
- loadProgram();
-}
diff --git a/src/org/atriasoft/ewol/compositing/Image.java b/src/org/atriasoft/ewol/compositing/Image.java
deleted file mode 100644
index 18d2c60..0000000
--- a/src/org/atriasoft/ewol/compositing/Image.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/** @file
- * @author Edouard DUPIN
- * @copyright 2011, Edouard DUPIN, all right reserved
- * @license MPL v2.0 (see license file)
- */
-#pragma once
-
-#include
-#include
-#include
-#include
-#include
-
-namespace ewol {
- namespace compositing {
- class Image : public ewol::Compositing {
- public:
- static int sizeAuto;
- private:
- etk::Uri this.filename;
- Vector2i this.requestSize;
- Vector3f this.position; //!< The current position to draw
- Vector3f this.clippingPosStart; //!< Clipping start position
- Vector3f this.clippingPosStop; //!< Clipping stop position
- boolean this.clippingEnable; //!< true if the clipping must be activated
- private:
- etk::Color this.color; //!< The text foreground color
- float this.angle; //!< Angle to set at the axes
- private:
- ememory::Ptr this.GLprogram; //!< pointer on the opengl display program
- int this.GLPosition; //!< openGL id on the element (vertex buffer)
- int this.GLMatrix; //!< openGL id on the element (transformation matrix)
- int this.GLColor; //!< openGL id on the element (color buffer)
- int this.GLtexture; //!< openGL id on the element (Texture position)
- int this.GLtexID; //!< openGL id on the element (texture ID)
- private:
- boolean this.distanceFieldMode; //!< select distance field mode
- ememory::Ptr this.resource; //!< texture resources
- ememory::Ptr this.resourceImage; //!< texture resources
- ememory::Ptr this.resourceDF; //!< texture resources
- static int this.vboIdCoord;
- static int this.vboIdCoordTex;
- static int this.vboIdColor;
- ememory::Ptr this.VBO;
- private:
- /**
- * @brief load the openGL program and get all the ID needed
- */
- void loadProgram();
- public:
- /**
- * @brief generic ructor
- * @param[in] _uri URI of the file that might be loaded
- * @param[in] _df enable distance field mode
- * @param[in] _size for the image when Verctorial image loading is requested
- */
- Image( etk::Uri _uri="",
- boolean _df=false,
- int _size=ewol::compositing::Image::sizeAuto);
- /**
- * @brief generic destructor
- */
- ~Image();
- public:
- /**
- * @brief draw All the refistered text in the current element on openGL
- * @param[in] _disableDepthTest disable the Depth test for display
- */
- void draw(boolean _disableDepthTest=true);
- /**
- * @brief clear alll tre registered element in the current element
- */
- void clear();
- /**
- * @brief get the current display position (sometime needed in the gui control)
- * @return the current position.
- */
- Vector3f getPos() {
- return this.position;
- };
- /**
- * @brief set position for the next text writen
- * @param[in] _pos Position of the text (in 3D)
- */
- void setPos( Vector3f _pos) {
- this.position = _pos;
- };
- void setPos( Vector2f _pos) {
- setPos(Vector3f(_pos.x(),_pos.y(),0));
- };
- /**
- * @brief set relative position for the next text writen
- * @param[in] _pos ofset apply of the text (in 3D)
- */
- void setRelPos( Vector3f _pos) {
- this.position += _pos;
- };
- void setRelPos( Vector2f _pos) {
- setRelPos(Vector3f(_pos.x(),_pos.y(),0));
- };
- /**
- * @brief set the Color of the current foreground font
- * @param[in] _color Color to set on foreground (for next print)
- */
- void setColor( etk::Color<> _color) {
- this.color = _color;
- };
- /**
- * @brief Request a clipping area for the text (next draw only)
- * @param[in] _pos Start position of the clipping
- * @param[in] _width Width size of the clipping
- */
- void setClippingWidth( Vector3f _pos, Vector3f _width) {
- setClipping(_pos, _pos+_width);
- };
- void setClippingWidth( Vector2f _pos, Vector2f _width) {
- setClippingWidth(Vector3f(_pos.x(),_pos.y(),0), Vector3f(_width.x(),_width.y(),0));
- };
- /**
- * @brief Request a clipping area for the text (next draw only)
- * @param[in] _pos Start position of the clipping
- * @param[in] _posEnd End position of the clipping
- */
- void setClipping( Vector3f _pos, Vector3f _posEnd);
- void setClipping( Vector2f _pos, Vector2f _posEnd) {
- setClipping(Vector3f(_pos.x(),_pos.y(),0), Vector3f(_posEnd.x(),_posEnd.y(),0));
- };
- /**
- * @brief enable/Disable the clipping (without lose the current clipping position)
- * @brief _newMode The new status of the clipping
- */
- void setClippingMode(boolean _newMode) {
- this.clippingEnable = _newMode;
- };
- /**
- * @brief set a unique rotation of this element (not set in the rotate Generic system)
- * @param[in] _angle Angle to set in radiant.
- */
- void setAngle(float _angleRad);
- /**
- * @brief add a compleate of the image to display with the requested size
- * @param[in] _size size of the output image
- */
- void print( Vector2i _size) {
- print(Vector2f(_size.x(),_size.y()));
- };
- void print( Vector2f _size);
- /**
- * @brief add a part of the image to display with the requested size
- * @param[in] _size size of the output image
- * @param[in] _sourcePosStart Start position in the image [0..1] (can be bigger but this repeate the image).
- * @param[in] _sourcePosStop Stop position in the image [0..1] (can be bigger but this repeate the image).
- */
- void printPart( Vector2f _size,
- Vector2f _sourcePosStart,
- Vector2f _sourcePosStop);
- /**
- * @brief change the image Source == > can not be done to display 2 images at the same time ...
- * @param[in] _uri New file of the Image
- * @param[in] _size for the image when Verctorial image loading is requested
- */
- void setSource( etk::Uri _uri, int _size=32) {
- setSource(_uri, Vector2f(_size,_size));
- };
- void setSource( etk::Uri _uri, Vector2f _size);
- void setSource(egami::Image _image);
- /**
- * @brief Sometimes the user declare an image but not allocate the ressources all the time, this is to know it ..
- * @return the validity od the resources.
- */
- boolean hasSources();
- /**
- * @brief get the source image registered size in the file (<0 when multiple size image)
- * @return tre image registered size
- */
- Vector2f getRealSize();
- public:
- /**
- * @brief Set render mode of the image
- * @param[in] _mode Activation of distance field mode
- */
- void setDistanceFieldMode(boolean _mode);
- /**
- * @brief Get the render methode.
- * @return The render mode of the image.
- */
- boolean getDistanceFieldMode() {
- return this.distanceFieldMode;
- }
- };
- };
-};
-
diff --git a/src/org/atriasoft/ewol/compositing/Shaper.cpp b/src/org/atriasoft/ewol/compositing/Shaper.cpp
index a87ec62..a463fbd 100644
--- a/src/org/atriasoft/ewol/compositing/Shaper.cpp
+++ b/src/org/atriasoft/ewol/compositing/Shaper.cpp
@@ -192,7 +192,7 @@ void ewol::compositing::Shaper::draw(boolean _disableDepthTest) {
//glScalef(this.scaling.x, this.scaling.y, 1.0);
this.GLprogram.use();
// set Matrix : translation/positionMatrix
- mat4 tmpMatrix = gale::openGL::getMatrix();
+ Matrix4f tmpMatrix = gale::openGL::getMatrix();
this.GLprogram.uniformMatrix(this.GLMatrix, tmpMatrix);
// position:
this.GLprogram.sendAttributePointer(this.GLPosition, this.VBO, this.vboIdCoord);
@@ -641,8 +641,8 @@ boolean ewol::compositing::Shaper::hasSources() {
}
- etk::Color ewol::compositing::Shaper::getColor(int _id) {
- static etk::Color errorValue(0,0,0,0);
+ Color ewol::compositing::Shaper::getColor(int _id) {
+ static Color errorValue(0,0,0,0);
if (this.colorProperty == null) {
Log.warning("null of this.colorProperty ==> return #0000 for id " + _id);
return errorValue;
diff --git a/src/org/atriasoft/ewol/compositing/Shaper.java b/src/org/atriasoft/ewol/compositing/Shaper.java
index 33690c0..c134ad4 100644
--- a/src/org/atriasoft/ewol/compositing/Shaper.java
+++ b/src/org/atriasoft/ewol/compositing/Shaper.java
@@ -242,7 +242,7 @@ namespace ewol {
* @param[in] _id Id of the color
* @return the reference on the color
*/
- etk::Color getColor(int _id);
+ Color getColor(int _id);
public:
/**
* @brief Get an ID on the configuration instance element
diff --git a/src/org/atriasoft/ewol/compositing/Sprite.cpp b/src/org/atriasoft/ewol/compositing/Sprite.cpp
deleted file mode 100644
index 21114f9..0000000
--- a/src/org/atriasoft/ewol/compositing/Sprite.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/** @file
- * @author Edouard DUPIN
- * @copyright 2011, Edouard DUPIN, all right reserved
- * @license MPL v2.0 (see license file)
- */
-
-#include
-#include
-
-#include
-ETK_DECLARE_TYPE(ewol::compositing::Sprite);
-
-ewol::compositing::Sprite::Sprite( String _imageName, Vector2i _nbSprite, int _size) :
- ewol::compositing::Image(_imageName, false, _size),
- this.nbSprite(_nbSprite),
- this.unitarySpriteSize(0,0) {
- /*
- Vector2f imageSize = getRealSize();
- this.unitarySpriteSize.setValue(imageSize.x()/(float)this.nbSprite.x(),
- imageSize.y()/(float)this.nbSprite.y());
- */
- this.unitarySpriteSize.setValue(1.0/(float)this.nbSprite.x(),
- 1.0/(float)this.nbSprite.y());
-}
-
-
-void ewol::compositing::Sprite::printSprite( Vector2i _spriteID, Vector3f _size) {
- if( _spriteID.x()<0
- || _spriteID.y()<0
- || _spriteID.x() >= this.nbSprite.x()
- || _spriteID.y() >= this.nbSprite.y()) {
- return;
- }
- printPart(Vector2f(_size.x(),_size.y()),
- Vector2f((float)(_spriteID.x() )*this.unitarySpriteSize.x(), (float)(_spriteID.y() )*this.unitarySpriteSize.y()),
- Vector2f((float)(_spriteID.x()+1)*this.unitarySpriteSize.x(), (float)(_spriteID.y()+1)*this.unitarySpriteSize.y()));
-}
-
-
diff --git a/src/org/atriasoft/ewol/compositing/Sprite.java b/src/org/atriasoft/ewol/compositing/Sprite.java
deleted file mode 100644
index b834eed..0000000
--- a/src/org/atriasoft/ewol/compositing/Sprite.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/** @file
- * @author Edouard DUPIN
- * @copyright 2011, Edouard DUPIN, all right reserved
- * @license MPL v2.0 (see license file)
- */
-#pragma once
-
-#include
-#include
-
-namespace ewol {
- namespace compositing {
- class Sprite : public ewol::compositing::Image {
- protected:
- Vector2i this.nbSprite; //!< number of sprite in vertical and horizontal
- Vector2f this.unitarySpriteSize; //!< size of a unique sprite
- public:
- Sprite( String _imageName,
- Vector2i _nbSprite,
- int _size=ewol::compositing::Image::sizeAuto);
- ~Sprite() {};
- void printSprite( Vector2i _spriteID, Vector2f _size) {
- printSprite(_spriteID, Vector3f(_size.x(), _size.y(),0));
- };
- void printSprite( Vector2i _spriteID, Vector3f _size);
- };
- }
-}
-
diff --git a/src/org/atriasoft/ewol/compositing/Text.cpp b/src/org/atriasoft/ewol/compositing/Text.cpp
index 01ae569..611a2ae 100644
--- a/src/org/atriasoft/ewol/compositing/Text.cpp
+++ b/src/org/atriasoft/ewol/compositing/Text.cpp
@@ -21,7 +21,7 @@ ewol::compositing::Text::~Text() {
}
-void ewol::compositing::Text::drawMT( mat4 _transformationMatrix, boolean _enableDepthTest) {
+void ewol::compositing::Text::drawMT( Matrix4f _transformationMatrix, boolean _enableDepthTest) {
// draw BG in any case:
this.vectorialDraw.draw();
@@ -44,9 +44,9 @@ void ewol::compositing::Text::drawMT( mat4 _transformationMatrix, boolean _enabl
gale::openGL::enable(gale::openGL::flag_depthTest);
}
// set Matrix : translation/positionMatrix
- mat4 projMatrix = gale::openGL::getMatrix();
- mat4 camMatrix = gale::openGL::getCameraMatrix();
- mat4 tmpMatrix = projMatrix * camMatrix * _transformationMatrix;
+ Matrix4f projMatrix = gale::openGL::getMatrix();
+ Matrix4f camMatrix = gale::openGL::getCameraMatrix();
+ Matrix4f tmpMatrix = projMatrix * camMatrix * _transformationMatrix;
this.GLprogram.use();
this.GLprogram.uniformMatrix(this.GLMatrix, tmpMatrix);
// Texture:
@@ -85,7 +85,7 @@ void ewol::compositing::Text::drawD(boolean _disableDepthTest) {
return;
}
// set Matrix : translation/positionMatrix
- mat4 tmpMatrix = gale::openGL::getMatrix()*this.matrixApply;
+ Matrix4f tmpMatrix = gale::openGL::getMatrix()*this.matrixApply;
this.GLprogram.use();
this.GLprogram.uniformMatrix(this.GLMatrix, tmpMatrix);
// Texture :
diff --git a/src/org/atriasoft/ewol/compositing/Text.java b/src/org/atriasoft/ewol/compositing/Text.java
index 80f89e3..a56dd20 100644
--- a/src/org/atriasoft/ewol/compositing/Text.java
+++ b/src/org/atriasoft/ewol/compositing/Text.java
@@ -35,7 +35,7 @@ namespace ewol {
~Text();
public:
void drawD(boolean _disableDepthTest);
- void drawMT( mat4 _transformationMatrix, boolean _enableDepthTest);
+ void drawMT( Matrix4f _transformationMatrix, boolean _enableDepthTest);
protected:
float this.size;
public:
diff --git a/src/org/atriasoft/ewol/compositing/TextBase.java b/src/org/atriasoft/ewol/compositing/TextBase.java
index 15a8643..184a215 100644
--- a/src/org/atriasoft/ewol/compositing/TextBase.java
+++ b/src/org/atriasoft/ewol/compositing/TextBase.java
@@ -116,7 +116,7 @@ namespace ewol {
drawD(_disableDepthTest);
}
//! @previous
- void draw( mat4 _transformationMatrix, boolean _enableDepthTest=false) {
+ void draw( Matrix4f _transformationMatrix, boolean _enableDepthTest=false) {
drawMT(_transformationMatrix, _enableDepthTest);
}
/**
@@ -124,7 +124,7 @@ namespace ewol {
*/
void drawD(boolean _disableDepthTest) = 0;
//! @previous
- void drawMT( mat4 _transformationMatrix, boolean _enableDepthTest) = 0;
+ void drawMT( Matrix4f _transformationMatrix, boolean _enableDepthTest) = 0;
/**
* @brief clear all the registered element in the current element
*/
diff --git a/src/org/atriasoft/ewol/compositing/TextDF.cpp b/src/org/atriasoft/ewol/compositing/TextDF.cpp
deleted file mode 100644
index 0f97e22..0000000
--- a/src/org/atriasoft/ewol/compositing/TextDF.cpp
+++ /dev/null
@@ -1,407 +0,0 @@
-/** @file
- * @author Edouard DUPIN
- * @copyright 2011, Edouard DUPIN, all right reserved
- * @license MPL v2.0 (see license file)
- */
-
-#include
-#include
-#include
-#include
-#include
-ETK_DECLARE_TYPE(ewol::compositing::TextDF);
-
-ewol::compositing::TextDF::TextDF( String _fontName, int _fontSize) :
- ewol::compositing::TextBase("", false),
- this.fontDF(null),
- this.GLglyphLevel(-1),
- this.size(12.0) {
- setFont(_fontName, _fontSize);
- loadProgram("DATA:///fontDistanceField/font1.prog?lib=ewol");
-}
-
-ewol::compositing::TextDF::~TextDF() {
-
-}
-
-void ewol::compositing::TextDF::updateSizeToRender( Vector2f _size) {
- float minSize = etk::min(_size.x(), _size.y());
- if (this.fontDF != null) {
- setFontSize(this.fontDF.getSize(minSize));
- }
-}
-
-void ewol::compositing::TextDF::drawMT( mat4 _transformationMatrix, boolean _enableDepthTest) {
- // draw BG in any case:
- this.vectorialDraw.draw();
- if ( this.VBO.bufferSize(this.vboIdCoord) <= 0
- || this.fontDF == null) {
- //Log.warning("Nothink to draw...");
- return;
- }
- if (this.fontDF == null) {
- Log.warning("no font...");
- return;
- }
- if (this.GLprogram == null) {
- Log.error("No shader ...");
- return;
- }
- if (_enableDepthTest == true) {
- gale::openGL::enable(gale::openGL::flag_depthTest);
- }
- // set Matrix: translation/positionMatrix
- mat4 projMatrix = gale::openGL::getMatrix();
- mat4 camMatrix = gale::openGL::getCameraMatrix();
- mat4 tmpMatrix = projMatrix * camMatrix * _transformationMatrix;
- this.GLprogram.use();
- this.GLprogram.uniformMatrix(this.GLMatrix, tmpMatrix);
- // Texture:
- this.GLprogram.setTexture0(this.GLtexID, this.fontDF.getRendererId());
- this.GLprogram.uniform1i(this.GLtextWidth, this.fontDF.getOpenGlSize().x());
- this.GLprogram.uniform1i(this.GLtextHeight, this.fontDF.getOpenGlSize().x());
- this.GLprogram.sendAttributePointer(this.GLPosition, this.VBO, this.vboIdCoord);
- this.GLprogram.sendAttributePointer(this.GLtexture, this.VBO, this.vboIdCoordText);
- this.GLprogram.sendAttributePointer(this.GLColor, this.VBO, this.vboIdColor);
- this.GLprogram.sendAttributePointer(this.GLglyphLevel, this.VBO, this.vboIdGlyphLevel);
- // Request the draw od the elements:
- gale::openGL::drawArrays(gale::openGL::renderMode::triangle, 0, this.VBO.bufferSize(this.vboIdCoord));
- this.GLprogram.unUse();
- if (_enableDepthTest == true) {
- gale::openGL::disable(gale::openGL::flag_depthTest);
- }
-}
-
-
-void ewol::compositing::TextDF::drawD(boolean _disableDepthTest) {
- // draw BG in any case:
- this.vectorialDraw.draw();
-
- if ( this.VBO.bufferSize(this.vboIdCoord) <= 0
- || this.fontDF == null) {
- // TODO : Set it back
- //Log.warning("Nothink to draw...");
- return;
- }
- if (this.fontDF == null) {
- Log.warning("no font...");
- return;
- }
- if (this.GLprogram == null) {
- Log.error("No shader ...");
- return;
- }
- // set Matrix: translation/positionMatrix
- mat4 tmpMatrix = gale::openGL::getMatrix()*this.matrixApply;
- this.GLprogram.use();
- this.GLprogram.uniformMatrix(this.GLMatrix, tmpMatrix);
- // Texture:
- this.GLprogram.setTexture0(this.GLtexID, this.fontDF.getRendererId());
- this.GLprogram.uniform1i(this.GLtextWidth, this.fontDF.getOpenGlSize().x());
- this.GLprogram.uniform1i(this.GLtextHeight, this.fontDF.getOpenGlSize().x());
- this.GLprogram.sendAttributePointer(this.GLPosition, this.VBO, this.vboIdCoord);
- this.GLprogram.sendAttributePointer(this.GLtexture, this.VBO, this.vboIdCoordText);
- this.GLprogram.sendAttributePointer(this.GLColor, this.VBO, this.vboIdColor);
- this.GLprogram.sendAttributePointer(this.GLglyphLevel, this.VBO, this.vboIdGlyphLevel);
- // Request the draw od the elements:
- gale::openGL::drawArrays(gale::openGL::renderMode::triangle, 0, this.VBO.bufferSize(this.vboIdCoord));
- this.GLprogram.unUse();
-}
-
-void ewol::compositing::TextDF::loadProgram( String _shaderName) {
- ewol::compositing::TextBase::loadProgram(_shaderName);
- if (this.GLprogram != null) {
- this.GLglyphLevel = this.GLprogram.getAttribute("EW_glyphLevel");
- }
-}
-
-
-float ewol::compositing::TextDF::getHeight() {
- if (this.fontDF == null) {
- Log.warning("no font...");
- return 1;
- }
- return this.fontDF.getHeight(this.size);
-}
-
-ewol::GlyphProperty * ewol::compositing::TextDF::getGlyphPointer(Character _charcode) {
- if (this.fontDF == null) {
- Log.warning("no font...");
- return null;
- }
- return this.fontDF.getGlyphPointer(_charcode);
-}
-
-void ewol::compositing::TextDF::setFontSize(int _fontSize) {
- clear();
- Log.verbose("Set font Size: " + _fontSize);
- if (_fontSize <= 1) {
- this.size = ewol::getContext().getFontDefault().getSize();
- } else {
- this.size = _fontSize;
- }
-}
-
-void ewol::compositing::TextDF::setFontName( String _fontName) {
- clear();
- // remove old one
- ememory::Ptr previousFont = this.fontDF;
- String fontName;
- if (_fontName == "") {
- fontName = ewol::getContext().getFontDefault().getName();
- } else {
- fontName = _fontName;
- }
- Log.verbose("Set font name: '" + fontName + "'");
- // link to new one
- this.fontDF = ewol::resource::DistanceFieldFont::create(fontName);
- if (this.fontDF == null) {
- Log.error("Can not get find resource");
- this.fontDF = previousFont;
- }
-}
-
-void ewol::compositing::TextDF::setFont(String _fontName, int _fontSize) {
- setFontSize(_fontSize);
- setFontName(_fontName);
-}
-
-void ewol::compositing::TextDF::setFontMode(enum ewol::font::mode _mode) {
- this.mode = _mode;
-}
-
-//#define ANGLE_OF_ITALIC (tan(0.4))
-#define ANGLE_OF_ITALIC (0.00698143f)
-
-
-void ewol::compositing::TextDF::printChar( Character _charcode) {
- // get a pointer on the glyph property :
- ewol::GlyphProperty* myGlyph = getGlyphPointer(_charcode);
- if (null == myGlyph) {
- Log.error(" font does not really existed ...");
- return;
- }
- float fontSize = getSize();
- float fontHeigh = getHeight();
-
- float factorDisplay = this.fontDF.getDisplayRatio(fontSize);
-
- // get the kerning ofset :
- float kerningOffset = 0;
- if (true == this.kerning) {
- kerningOffset = myGlyph.kerningGet(this.previousCharcode);
- if (kerningOffset != 0) {
- //Log.debug("Kerning between : '" + this.previousCharcode + "''" + myGlyph.this.UVal + "' value : " + kerningOffset);
- }
- }
- // 0x01 == 0x20 == ' ';
- if ( _charcode != 0x01
- LOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOM _charcode != 0x20) {
- float glyphLevel = 0.5f;
- if ( this.mode == ewol::font::BoldItalic
- || this.mode == ewol::font::Bold) {
- glyphLevel = 0.41f;
- }
- float italicMove = 0.0f;
- if ( this.mode == ewol::font::BoldItalic
- || this.mode == ewol::font::Italic) {
- // This is a simple version of Italic mode, in theory we need to move the up and the down...
- italicMove = (float)myGlyph.this.sizeTexture.y() * factorDisplay * ANGLE_OF_ITALIC;
- // TODO : pb on the clipper...
- }
-
- /* Bitmap position
- * xA xB
- * yC *------*
- * | |
- * | |
- * yD *------*
- */
- #if 0
- float dxA = this.position.x() + (myGlyph.this.bearing.x() + kerningOffset) * factorDisplay;
- float dxB = dxA + myGlyph.this.sizeTexture.x() * factorDisplay;
- float dyC = this.position.y() + (myGlyph.this.bearing.y() + fontHeigh - fontSize) * factorDisplay;
- float dyD = dyC - myGlyph.this.sizeTexture.y() * factorDisplay;
- #else
- //Log.debug(" plop : fontHeigh" + fontHeigh + " fontSize=" + fontSize);
- float dxA = this.position.x() + ((float)myGlyph.this.bearing.x() + kerningOffset - (float)this.fontDF.getPixelBorderSize()*0.5f) * factorDisplay;
- float dxB = dxA + ((float)myGlyph.this.sizeTexture.x() + (float)this.fontDF.getPixelBorderSize()) * factorDisplay;
- float dyC = this.position.y() + (fontHeigh - fontSize + ((float)myGlyph.this.bearing.y() + (float)this.fontDF.getPixelBorderSize()*0.5f) * factorDisplay);
- float dyD = dyC - ((float)myGlyph.this.sizeTexture.y() + (float)this.fontDF.getPixelBorderSize()) * factorDisplay;
- #endif
-
- float tuA = myGlyph.this.texturePosStart.x();
- float tuB = tuA + myGlyph.this.texturePosSize.x();
- float tvC = myGlyph.this.texturePosStart.y();
- float tvD = tvC + myGlyph.this.texturePosSize.y();
- /*
- Vector3f drawingPos = this.vectorialDraw.getPos();
- etk::Color<> backColor = this.vectorialDraw.getColor();
-
- this.vectorialDraw.setPos(Vector2f(dxA, dyC));
-
- this.vectorialDraw.setColor(etk::Color<>(0.0,1.0,0.0,1.0));
- this.vectorialDraw.rectangle(Vector2f(dxB, dyD));
-
- this.vectorialDraw.setPos(drawingPos);
- this.vectorialDraw.setColor(backColor);
- */
- // Clipping and drawing area
- if( this.clippingEnable == true
- LOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOM ( dxB < this.clippingPosStart.x()
- || dxA > this.clippingPosStop.x()
- || dyC < this.clippingPosStart.y()
- || dyD > this.clippingPosStop.y() ) ) {
- // Nothing to diplay ...
- } else {
- if (this.clippingEnable == true) {
- // generata positions...
- float TexSizeX = tuB - tuA;
- if (dxA < this.clippingPosStart.x()) {
- // clip display
- float drawSize = this.clippingPosStart.x() - dxA;
- // update element start display
- dxA = this.clippingPosStart.x();
- float addElement = TexSizeX * drawSize / ((float)myGlyph.this.sizeTexture.x() * factorDisplay);
- // update texture start X Pos
- tuA += addElement;
- }
- if (dxB > this.clippingPosStop.x()) {
- // clip display
- float drawSize = dxB - this.clippingPosStop.x();
- // update element start display
- dxB = this.clippingPosStop.x();
- float addElement = TexSizeX * drawSize / ((float)myGlyph.this.sizeTexture.x() * factorDisplay);
- // update texture start X Pos
- tuB -= addElement;
- }
- float TexSizeY = tvC - tvD;
- if (dyC > this.clippingPosStop.y()) {
- // clip display
- float drawSize = dyC - this.clippingPosStop.y();
- // update element start display
- dyC = this.clippingPosStop.y();
- float addElement = TexSizeY * drawSize / ((float)myGlyph.this.sizeTexture.y() * factorDisplay);
- // update texture start X Pos
- tvC -= addElement;
- }
- if (dyD < this.clippingPosStart.y()) {
- // clip display
- float drawSize = this.clippingPosStart.y() - dyD;
- // update element start display
- dyD = this.clippingPosStart.y();
- float addElement = TexSizeY * drawSize / ((float)myGlyph.this.sizeTexture.y() * factorDisplay);
- // update texture start X Pos
- tvD += addElement;
- }
- }
- if( dxB <= dxA
- || dyD >= dyC) {
- // nothing to do ...
- } else {
- /* Bitmap position
- * 0------1
- * | |
- * | |
- * 3------2
- */
- if (this.needDisplay == true) {
- Vector3f bitmapDrawPos[4];
- bitmapDrawPos[0].setValue(dxA+italicMove, dyC, 0);
- bitmapDrawPos[1].setValue(dxB+italicMove, dyC, 0);
- bitmapDrawPos[2].setValue(dxB, dyD, 0);
- bitmapDrawPos[3].setValue(dxA, dyD, 0);
- /* texture Position :
- * 0------1
- * | |
- * | |
- * 3------2
- */
- Vector2f texturePos[4];
- texturePos[0].setValue(tuA+this.mode, tvC);
- texturePos[1].setValue(tuB+this.mode, tvC);
- texturePos[2].setValue(tuB+this.mode, tvD);
- texturePos[3].setValue(tuA+this.mode, tvD);
-
- // NOTE : Android does not support the Quads elements ...
- /* Step 1 :
- * ********
- * ******
- * ****
- * **
- *
- */
- // set texture coordonates :
- this.VBO.pushOnBuffer(this.vboIdCoordText, texturePos[0]);
- this.VBO.pushOnBuffer(this.vboIdCoordText, texturePos[1]);
- this.VBO.pushOnBuffer(this.vboIdCoordText, texturePos[2]);
- // set display positions :
- this.VBO.pushOnBuffer(this.vboIdCoord, bitmapDrawPos[0]);
- this.VBO.pushOnBuffer(this.vboIdCoord, bitmapDrawPos[1]);
- this.VBO.pushOnBuffer(this.vboIdCoord, bitmapDrawPos[2]);
- // set the color
- this.VBO.pushOnBuffer(this.vboIdColor, this.color);
- this.VBO.pushOnBuffer(this.vboIdColor, this.color);
- this.VBO.pushOnBuffer(this.vboIdColor, this.color);
- // set the bliph level
- this.VBO.pushOnBuffer(this.vboIdGlyphLevel, glyphLevel);
- this.VBO.pushOnBuffer(this.vboIdGlyphLevel, glyphLevel);
- this.VBO.pushOnBuffer(this.vboIdGlyphLevel, glyphLevel);
- /* Step 2 :
- *
- * **
- * ****
- * ******
- * ********
- */
- // set texture coordonates :
- this.VBO.pushOnBuffer(this.vboIdCoordText, texturePos[0]);
- this.VBO.pushOnBuffer(this.vboIdCoordText, texturePos[2]);
- this.VBO.pushOnBuffer(this.vboIdCoordText, texturePos[3]);
- // set display positions :
- this.VBO.pushOnBuffer(this.vboIdCoord, bitmapDrawPos[0]);
- this.VBO.pushOnBuffer(this.vboIdCoord, bitmapDrawPos[2]);
- this.VBO.pushOnBuffer(this.vboIdCoord, bitmapDrawPos[3]);
- // set the color
- this.VBO.pushOnBuffer(this.vboIdColor, this.color);
- this.VBO.pushOnBuffer(this.vboIdColor, this.color);
- this.VBO.pushOnBuffer(this.vboIdColor, this.color);
- // set the bliph level
- this.VBO.pushOnBuffer(this.vboIdGlyphLevel, glyphLevel);
- this.VBO.pushOnBuffer(this.vboIdGlyphLevel, glyphLevel);
- this.VBO.pushOnBuffer(this.vboIdGlyphLevel, glyphLevel);
- }
- }
- }
- }
- // move the position :
- //Log.debug(" 5 pos=" + this.position + " advance=" + myGlyph.this.advance.x() + " kerningOffset=" + kerningOffset);
- this.position.setX(this.position.x() + (myGlyph.this.advance.x() + kerningOffset) * factorDisplay);
- //Log.debug(" 6 print '" + charcode + "' : start=" + this.sizeDisplayStart + " stop=" + this.sizeDisplayStop + " pos=" + this.position);
- // Register the previous character
- this.previousCharcode = _charcode;
- this.VBO.flush();
- return;
-}
-
-
-Vector3f ewol::compositing::TextDF::calculateSizeChar( Character _charcode) {
- // get a pointer on the glyph property :
- ewol::GlyphProperty * myGlyph = getGlyphPointer(_charcode);
- int fontHeigh = getHeight();
-
- // get the kerning ofset :
- float kerningOffset = 0.0;
- if (true == this.kerning) {
- kerningOffset = myGlyph.kerningGet(this.previousCharcode);
- }
-
- Vector3f outputSize((float)(myGlyph.this.advance.x() + kerningOffset)*this.fontDF.getDisplayRatio(getSize()),
- (float)(fontHeigh),
- (float)(0.0));
- // Register the previous character
- this.previousCharcode = _charcode;
- return outputSize;
-}
-
-
diff --git a/src/org/atriasoft/ewol/compositing/TextDF.java b/src/org/atriasoft/ewol/compositing/TextDF.java
deleted file mode 100644
index 636e598..0000000
--- a/src/org/atriasoft/ewol/compositing/TextDF.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/** @file
- * @author Edouard DUPIN
- * @copyright 2011, Edouard DUPIN, all right reserved
- * @license MPL v2.0 (see license file)
- */
-#pragma once
-
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-namespace ewol {
- namespace compositing {
- class TextDF : public ewol::compositing::TextBase {
- protected:
- ememory::Ptr this.fontDF; //!< Font resources
- protected:
- int this.GLglyphLevel; //!< openGL Id on the glyph level display
- public:
- /**
- * @brief generic ructor
- * @param[in] _fontName Name of the font that might be loaded
- * @param[in] _fontSize size of the font that might be loaded
- */
- TextDF( String _fontName="", int _fontSize=-1);
- /**
- * @brief generic destructor
- */
- ~TextDF();
- public:
- /**
- * @brief Calculate size to be at the best size for a render in this special size.
- * @note special for Distance field mode.
- * @param[in] _size request dimention.
- */
- void updateSizeToRender( Vector2f _size);
- public:
- void drawD(boolean _disableDepthTest);
- void drawMT( mat4 _transformationMatrix, boolean _enableDepthTest);
- protected:
- float this.size;
- public:
- float getHeight();
- float getSize() {
- return this.size;
- }
- void setSize(float _size) {
- this.size = _size;
- }
- ewol::GlyphProperty * getGlyphPointer(Character _charcode);
-
- public:
- void loadProgram( String _shaderName);
- void setFontSize(int _fontSize);
- void setFontName( String _fontName);
- void setFont(String _fontName, int _fontSize);
- void setFontMode(enum ewol::font::mode _mode);
- void printChar( Character _charcode);
- Vector3f calculateSizeChar( Character _charcode);
- };
- }
-}
-
-
diff --git a/src/org/atriasoft/ewol/context/Application.cpp b/src/org/atriasoft/ewol/context/Application.cpp
deleted file mode 100644
index ff6843c..0000000
--- a/src/org/atriasoft/ewol/context/Application.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/** @file
- * @author Edouard DUPIN
- * @copyright 2011, Edouard DUPIN, all right reserved
- * @license MPL v2.0 (see license file)
- */
-
-#include
-#include
-#include
-
-#include
-ETK_DECLARE_TYPE(EwolApplication);
-
-EwolApplication::Application() {
-
-}
-
-EwolApplication::~Application() {
-
-}
-
-void EwolApplication::onCreate(EwolContext _context) {
-
-}
-
-void EwolApplication::onStart(EwolContext _context) {
-
-}
-
-void EwolApplication::onResume(EwolContext _context) {
-
-}
-
-void EwolApplication::onPause(EwolContext _context) {
-
-}
-
-void EwolApplication::onStop(EwolContext _context) {
-
-}
-
-void EwolApplication::onDestroy(EwolContext _context) {
-
-}
-
-void EwolApplication::onKillDemand(EwolContext _context) {
- _context.exit(0);
-}
-
diff --git a/src/org/atriasoft/ewol/context/ConfigFont.cpp b/src/org/atriasoft/ewol/context/ConfigFont.cpp
deleted file mode 100644
index c0aa5be..0000000
--- a/src/org/atriasoft/ewol/context/ConfigFont.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/** @file
- * @author Edouard DUPIN
- * @copyright 2011, Edouard DUPIN, all right reserved
- * @license MPL v2.0 (see license file)
- */
-
-#include
-#include
-#include
-ETK_DECLARE_TYPE(ConfigFont);
-
-ConfigFont::ConfigFont() :
- this.folder("DATA:///fonts?lib=ewol"),
- this.name("Arial;Helvetica"),
- this.size(10),
- this.useExternal(false) {
- #ifdef __TARGET_OS__Android
- this.name = "Roboto;DroidSans";
- #endif
- ewol::resource::freeTypeInit();
-}
-
-ConfigFont::~ConfigFont() {
- // UnInit FreeTypes
- ewol::resource::freeTypeUnInit();
-}
-
-void ConfigFont::set( String _fontName, int _size) {
- this.name = _fontName;
- this.size = _size;
- Log.debug("Set default Font : '" + this.name + "' size=" + this.size);
-}
-
-void ConfigFont::setSize(int _size) {
- this.size = _size;
- Log.debug("Set default Font : '" + this.name + "' size=" + this.size + " (change size only)");
-}
-
-void ConfigFont::setName( String _fontName) {
- this.name = _fontName;
- Log.debug("Set default Font : '" + this.name + "' size=" + this.size + " (change name only)");
-}
-
diff --git a/src/org/atriasoft/ewol/context/ConfigFont.java b/src/org/atriasoft/ewol/context/ConfigFont.java
index e3f2232..7d40638 100644
--- a/src/org/atriasoft/ewol/context/ConfigFont.java
+++ b/src/org/atriasoft/ewol/context/ConfigFont.java
@@ -1,92 +1,99 @@
+package org.atriasoft.ewol.context;
+
+import org.atriasoft.etk.Uri;
+import org.atriasoft.ewol.internal.Log;
+
/** @file
* @author Edouard DUPIN
* @copyright 2011, Edouard DUPIN, all right reserved
* @license MPL v2.0 (see license file)
*/
-#pragma once
-#include
-#include
-
-namespace ewol {
- namespace context {
- class ConfigFont {
- public:
- /**
- * Constructor / destructor
- */
- ConfigFont();
- ~ConfigFont();
- private:
- etk::Uri this.folder;
- public:
- /**
- * @brief Specify the default font folder for the Ewol search system (only needed when embended font)
- * @param[in] _folder basic folder of the font (ex: DATA:fonts)
- */
- void setFolder( etk::Uri _folder) {
- this.folder = _folder;
- };
- /**
- * @brief get the default font folder.
- * @return The default font folder.
- */
- etk::Uri getFolder() {
- return this.folder;
- };
- private:
- String this.name;
- int this.size;
- public:
- /**
- * @brief set the defaut font for all the widgets and basics display.
- * @param[in] _fontName The font name requested (not case sensitive) ex "Arial" or multiple separate by ';' ex : "Arial;Helvetica".
- * @param[in] _size The default size of the font default=10.
- */
- void set( String _fontName, int _size);
- /**
- * @brief get the current default font name
- * @raturn a reference on the font name string
- */
- String getName() {
- return this.name;
- };
- /**
- * @brief Set the current default font name
- * @param[in] _fontName The font name requested (not case sensitive) ex "Arial" or multiple separate by ';' ex : "Arial;Helvetica".
- */
- void setName( String _fontName);
- /**
- * @brief get the default font size.
- * @return the font size.
- */
- int getSize() {
- return this.size;
- };
- /**
- * @brief Set the default font size.
- * @param[in] _size new font size.
- */
- void setSize(int _size);
- private:
- boolean this.useExternal;
- public:
- /**
- * @brief set use of internal/external Font
- * @param[in] _val true to enable search of internal data.
- */
- void setUseExternal(boolean _val) {
- this.useExternal=_val;
- };
- /**
- * @brief get the use of internal/external Font
- * @return true to enable search of internal data.
- */
- boolean getUseExternal() {
- return this.useExternal;
- };
- };
+public class ConfigFont {
+ private Uri folder = new Uri("DATA:///fonts?lib=ewol");
+ private String name = "Arial;Helvetica";
+ private int size = 10;
+ private boolean useExternal = false;
+
+ /**
+ * Constructor
+ */
+ public ConfigFont() {}
+
+ /**
+ * @brief get the default font folder.
+ * @return The default font folder.
+ */
+ public Uri getFolder() {
+ return this.folder;
+ }
+
+ /**
+ * @brief get the current default font name
+ * @return a reference on the font name string
+ */
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * @brief get the default font size.
+ * @return the font size.
+ */
+ public int getSize() {
+ return this.size;
+ };
+
+ /**
+ * @brief get the use of internal/external Font
+ * @return true to enable search of internal data.
+ */
+ public boolean getUseExternal() {
+ return this.useExternal;
+ }
+
+ /**
+ * @brief set the defaut font for all the widgets and basics display.
+ * @param[in] _fontName The font name requested (not case sensitive) ex "Arial" or multiple separate by ';' ex : "Arial;Helvetica".
+ * @param[in] _size The default size of the font default=10.
+ */
+ public void set(final String _fontName, final int _size) {
+ this.name = _fontName;
+ this.size = _size;
+ Log.debug("Set default Font : '" + this.name + "' size=" + this.size);
+ };
+
+ /**
+ * @brief Specify the default font folder for the Ewol search system (only needed when embended font)
+ * @param[in] _folder basic folder of the font (ex: DATA:fonts)
+ */
+ public void setFolder(final Uri _folder) {
+ this.folder = _folder;
+ }
+
+ /**
+ * @brief Set the current default font name
+ * @param[in] _fontName The font name requested (not case sensitive) ex "Arial" or multiple separate by ';' ex : "Arial;Helvetica".
+ */
+ public void setName(final String _fontName) {
+ this.name = _fontName;
+ Log.debug("Set default Font : '" + this.name + "' size=" + this.size + " (change name only)");
+ }
+
+ /**
+ * @brief Set the default font size.
+ * @param[in] _size new font size.
+ */
+ public void setSize(final int _size) {
+ this.size = _size;
+ Log.debug("Set default Font : '" + this.name + "' size=" + this.size + " (change size only)");
+ };
+
+ /**
+ * @brief set use of internal/external Font
+ * @param[in] _val true to enable search of internal data.
+ */
+ public void setUseExternal(final boolean _val) {
+ this.useExternal = _val;
};
};
-
-
diff --git a/src/org/atriasoft/ewol/context/Context.cpp b/src/org/atriasoft/ewol/context/Context.cpp
deleted file mode 100644
index eafca84..0000000
--- a/src/org/atriasoft/ewol/context/Context.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
-void EwolContext::onClipboardEvent(enum gale::context::clipBoard::clipboardListe _clipboardId)
-
-EwolContext::Context(EwolApplication* _application) :
-EwolContext::~Context() {
- // nothing to do ...
-}
-
-void EwolContext::requestUpdateSize() {
- Context context = gale::getContext();
- context.requestUpdateSize();
-}
-
-void EwolContext::onPeriod( echrono::Clock _time) {
- this.objectManager.timeCall(_time);
-}
-
-void EwolContext::resetIOEvent() {
- this.input.newLayerSet();
-}
-
-void EwolContext::setWindows( ewol::widget::WindowsShared _windows) {
- Log.info("set New windows");
- // remove current focus :
- this.widgetManager.focusSetDefault(null);
- this.widgetManager.focusRelease();
- // set the new pointer as windows system
- this.windowsCurrent = _windows;
- // set the new default focus:
- this.widgetManager.focusSetDefault(_windows);
- // display the title of the Windows:
- if (this.windowsCurrent != null) {
- setTitle(this.windowsCurrent.propertyTitle.get());
- }
- // request all the widget redrawing
- forceRedrawAll();
-}
-
-ewol::widget::WindowsShared EwolContext::getWindows() {
- return this.windowsCurrent;
-};
-void EwolContext::onResize( Vector2i _size) {
- Log.verbose("Resize: " + _size);
- forceRedrawAll();
-}
-
-void EwolContext::forceRedrawAll() {
- if (this.windowsCurrent == null) {
- return;
- }
- Vector2i size = getSize();
- this.windowsCurrent.setSize(Vector2f(size.x(), size.y()));
- this.windowsCurrent.onChangeSize();
-}
-
diff --git a/src/org/atriasoft/ewol/context/EwolContext.java b/src/org/atriasoft/ewol/context/EwolContext.java
index b8bc932..3249f9c 100644
--- a/src/org/atriasoft/ewol/context/EwolContext.java
+++ b/src/org/atriasoft/ewol/context/EwolContext.java
@@ -5,14 +5,21 @@
*/
package org.atriasoft.ewol.context;
+import org.atriasoft.echrono.Clock;
+import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.Vector2f;
+import org.atriasoft.etk.math.Vector2i;
+import org.atriasoft.ewol.event.EntrySystem;
import org.atriasoft.ewol.internal.Log;
import org.atriasoft.ewol.object.ObjectManager;
+import org.atriasoft.ewol.widget.Widget;
import org.atriasoft.ewol.widget.WidgetManager;
+import org.atriasoft.ewol.widget.Windows;
import org.atriasoft.gale.Application;
import org.atriasoft.gale.Gale;
import org.atriasoft.gale.context.ClipboardList;
import org.atriasoft.gale.context.CommandLine;
+import org.atriasoft.gale.context.Context;
import org.atriasoft.gale.key.KeyKeyboard;
import org.atriasoft.gale.key.KeySpecial;
import org.atriasoft.gale.key.KeyStatus;
@@ -27,11 +34,11 @@ public abstract class EwolContext extends Application {
* @brief From everyware in the program, we can get the context inteface.
* @return current reference on the instance.
*/
- static EwolContext getContext() {
+ public static EwolContext getContext() {
return curentInterface;
}
- private final EwolApplication application; //!< Application handle
+ private EwolApplication application; //!< Application handle
public EwolApplication getApplication() {
return this.application;
@@ -74,11 +81,12 @@ public abstract class EwolContext extends Application {
private final InputManager input;
+ @Override
public void onCreate(final Context _context) {
Log.info(" == > Ewol system create (BEGIN)");
// Add basic ewol translation:
- etranslate::addPath("ewol", "DATA:///translate/ewol/?lib=ewol");
- etranslate::autoDetectLanguage();
+ //etranslate::addPath("ewol", "DATA:///translate/ewol/?lib=ewol");
+ //etranslate::autoDetectLanguage();
// By default we set 2 themes (1 color and 1 shape ...) :
etk::theme::setNameDefault("GUI", "shape/square/");
etk::theme::setNameDefault("COLOR", "color/black/");
@@ -87,10 +95,10 @@ public abstract class EwolContext extends Application {
if ( _context.getCmd().get(iii) == "-h"
|| _context.getCmd().get(iii) == "--help") {
Log.print("ewol - help : ");
- Log.print(" " + etk::getApplicationName() + " [options]");
+ Log.print(" xxxxxxxxxxxxx [options]");
Log.print(" -h/--help: Display this help");
Log.print(" example:");
- Log.print(" " + etk::getApplicationName() + " --help");
+ Log.print(" xxxxxxxxxxxxx --help");
// this is a global help system does not remove it
continue;
} else {
@@ -100,10 +108,13 @@ public abstract class EwolContext extends Application {
--iii;
}
- Log.info("EWOL v:" + ewol::getVersion());
+ //Log.info("EWOL v:" + ewol::getVersion());
// force a recalculation
/*
- requestUpdateSize();
+ requestUpdateSize(){
+ Context context = gale::getContext();
+ context.requestUpdateSize();
+ }
#if defined(__EWOL_ANDROID_ORIENTATION_LANDSCAPE__)
forceOrientation(ewol::screenLandscape);
#elif defined(__EWOL_ANDROID_ORIENTATION_PORTRAIT__)
@@ -112,40 +123,43 @@ public abstract class EwolContext extends Application {
forceOrientation(ewol::screenAuto);
#endif
*/
- EwolApplication appl = this.application;
+ final EwolApplication appl = this.application;
if (appl == null) {
Log.error(" == > Create without application");
return;
}
- appl.onCreate(*this);
+ appl.onCreate(this);
Log.info(" == > Ewol system create (END)");
}
- public abstract void onStart(final Context _context) {
+ @Override
+ public void onStart(final Context _context) {
Log.info(" == > Ewol system start (BEGIN)");
- EwolApplication appl = this.application;
+ final EwolApplication appl = this.application;
if (appl == null) {
// TODO : Request exit of the application .... with error ...
return;
}
- appl.onStart(*this);
+ appl.onStart(this);
Log.info(" == > Ewol system start (END)");
}
- public abstract void onResume(final Context _context){
+ @Override
+ public void onResume(final Context _context) {
Log.info(" == > Ewol system resume (BEGIN)");
- EwolApplication appl = this.application;
+ final EwolApplication appl = this.application;
if (appl == null) {
return;
}
- appl.onResume(*this);
+ appl.onResume(this);
Log.info(" == > Ewol system resume (END)");
}
- public abstract void onRegenerateDisplay(final Context _context) {
+ @Override
+ public void onRegenerateDisplay(final Context _context) {
//Log.info("REGENERATE_DISPLAY");
// check if the user selected a windows
- ewol::widget::WindowsShared window = this.windowsCurrent;
+ final Windows window = this.windowsCurrent;
if (window == null) {
Log.debug("No windows ...");
return;
@@ -158,49 +172,53 @@ public abstract class EwolContext extends Application {
//markDrawingIsNeeded();
}
- public abstract void onDraw(final Context _context) {
+ @Override
+ public void onDraw(final Context _context) {
//Log.info("DRAW");
// clean internal data...
this.objectManager.cleanInternalRemoved();
// real draw...
- ewol::widget::WindowsShared window = this.windowsCurrent;
+ final Windows window = this.windowsCurrent;
if (window == null) {
return;
}
window.sysDraw();
}
- public abstract void onPause(final Context _context){
+ @Override
+ public void onPause(final Context _context) {
Log.info(" == > Ewol system pause (BEGIN)");
- EwolApplication appl = this.application;
+ final EwolApplication appl = this.application;
if (appl == null) {
return;
}
- appl.onPause(*this);
+ appl.onPause(this);
Log.info(" == > Ewol system pause (END)");
}
- public abstract void onStop(final Context _context){
+ @Override
+ public void onStop(final Context _context) {
Log.info(" == > Ewol system stop (BEGIN)");
- EwolApplication appl = this.application;
+ final EwolApplication appl = this.application;
if (appl == null) {
return;
}
- appl.onStop(*this);
+ appl.onStop(this);
Log.info(" == > Ewol system stop (END)");
}
- public abstract void onDestroy(final Context _context){
+ @Override
+ public void onDestroy(final Context _context) {
Log.info(" == > Ewol system destroy (BEGIN)");
// Remove current windows
- this.windowsCurrent.reset();
+ this.windowsCurrent = null;
// clean all widget and sub widget with their resources:
this.objectManager.cleanInternalRemoved();
- EwolApplication appl = this.application;
+ final EwolApplication appl = this.application;
if (appl != null) {
// call application to uninit
- appl.onDestroy(*this);
- this.application.reset();
+ appl.onDestroy(this);
+ this.application = null;
}
// internal clean elements
this.objectManager.cleanInternalRemoved();
@@ -211,29 +229,30 @@ public abstract class EwolContext extends Application {
Log.info(" == > Ewol system destroy (END)");
}
- public abstract void onKillDemand(final Context _context){
+ @Override
+ public void onKillDemand(final Context _context) {
Log.info(" == > User demand a destroy (BEGIN)");
- EwolApplication appl = this.application;
+ final EwolApplication appl = this.application;
if (appl == null) {
exit(0);
return;
}
- appl.onKillDemand(*this);
+ appl.onKillDemand(this);
Log.info(" == > User demand a destroy (END)");
}
- public abstract void onPointer(final KeyType _type, final int _pointerID, final Vector2f _pos, final KeyStatus _state) {
+ public void onPointer(final KeyType _type, final int _pointerID, final Vector2f _pos, final KeyStatus _state) {
switch (_state) {
- case KeyStatus::move:
+ case move:
//Log.debug("Receive MSG : THREAD_INPUT_MOTION");
this.input.motion(_type, _pointerID, _pos);
break;
- case KeyStatus::down:
- case KeyStatus::downRepeate:
+ case down:
+ case downRepeate:
//Log.debug("Receive MSG : THREAD_INPUT_STATE");
this.input.state(_type, _pointerID, true, _pos);
break;
- case KeyStatus::up:
+ case up:
//Log.debug("Receive MSG : THREAD_INPUT_STATE");
this.input.state(_type, _pointerID, false, _pos);
break;
@@ -244,7 +263,7 @@ public abstract class EwolContext extends Application {
}
@Override
- public abstract void onKeyboard(final KeySpecial _special, final KeyKeyboard _type, final Character _value, final KeyStatus _state) {
+ public void onKeyboard(final KeySpecial _special, final KeyKeyboard _type, final Character _value, final KeyStatus _state) {
Log.verbose("event {" + _special + "} " + _type + " " + _value + " " + _state);
// store the keyboard special key status for mouse event...
this.input.setLastKeyboardSpecial(_special);
@@ -252,49 +271,38 @@ public abstract class EwolContext extends Application {
// No windows ...
return;
}
- boolean repeate = (_state == KeyStatus::downRepeate);
- boolean isDown = (_state == KeyStatus::downRepeate)
- || (_state == KeyStatus::down);
- if (this.windowsCurrent.onEventShortCut(_special,
- _value,
- _type,
- isDown) == true) {
+ final boolean repeate = (_state == KeyStatus.downRepeate);
+ final boolean isDown = (_state == KeyStatus.downRepeate) || (_state == KeyStatus.down);
+ if (this.windowsCurrent.onEventShortCut(_special, _value, _type, isDown) == true) {
// Keep a shortcut ...
return;
}
// get the current focused Widget :
- Widget tmpWidget = this.widgetManager.focusGet();
+ final Widget tmpWidget = this.widgetManager.focusGet();
if (tmpWidget == null) {
// no Widget ...
return;
}
// check if the widget allow repeating key events.
//Log.info("repeating test :" + repeate + " widget=" + tmpWidget.getKeyboardRepeate() + " state=" + isDown);
- if( repeate == false
- || ( repeate == true
- LOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOM tmpWidget.getKeyboardRepeat() == true) ) {
+ if (repeate == false || (repeate == true && tmpWidget.getKeyboardRepeat() == true)) {
// check Widget shortcut
- if (tmpWidget.onEventShortCut(_special,
- _value,
- _type,
- isDown) == false) {
+ if (tmpWidget.onEventShortCut(_special, _value, _type, isDown) == false) {
// generate the direct event ...
- if (_type == KeyKeyboard::character) {
- ewol::event::EntrySystem tmpEntryEvent(KeyKeyboard::character,
- KeyStatus::up,
- _special,
- _value);
- if(isDown == true) {
- tmpEntryEvent.this.event.setStatus(KeyStatus::down);
+ if (_type == KeyKeyboard.character) {
+ final EntrySystem tmpEntryEvent;
+ if (isDown == true) {
+ tmpEntryEvent = new EntrySystem(KeyKeyboard.character, KeyStatus.down, _special, _value);
+ } else {
+ tmpEntryEvent = new EntrySystem(KeyKeyboard.character, KeyStatus.up, _special, _value);
}
tmpWidget.systemEventEntry(tmpEntryEvent);
} else { // THREAD_KEYBORAD_MOVE
- ewol::event::EntrySystem tmpEntryEvent(_type,
- KeyStatus::up,
- _special,
- 0);
- if(isDown == true) {
- tmpEntryEvent.this.event.setStatus(KeyStatus::down);
+ final EntrySystem tmpEntryEvent;
+ if (isDown == true) {
+ tmpEntryEvent = new EntrySystem(KeyKeyboard.character, KeyStatus.down, _special, null);
+ } else {
+ tmpEntryEvent = new EntrySystem(KeyKeyboard.character, KeyStatus.up, _special, null);
}
tmpWidget.systemEventEntry(tmpEntryEvent);
}
@@ -319,7 +327,7 @@ public abstract class EwolContext extends Application {
this.input.newLayerSet();
}
- private final Windows windowsCurrent = null; //!< current displayed windows
+ private Windows windowsCurrent = null; //!< current displayed windows
/**
* @brief set the current windows to display :
@@ -336,7 +344,7 @@ public abstract class EwolContext extends Application {
this.widgetManager.focusSetDefault(_windows);
// display the title of the Windows:
if (this.windowsCurrent != null) {
- setTitle(this.windowsCurrent.propertyTitle.get());
+ setTitle(this.windowsCurrent.propertyTitle);
}
// request all the widget redrawing
forceRedrawAll();
@@ -357,8 +365,8 @@ public abstract class EwolContext extends Application {
if (this.windowsCurrent == null) {
return;
}
- final Vector2i size = getSize();
- this.windowsCurrent.setSize(Vector2f(size.x(), size.y()));
+ final Vector2f size = getSize();
+ this.windowsCurrent.setSize(new Vector2f((int) size.x, (int) size.y));
this.windowsCurrent.onChangeSize();
}
@@ -420,7 +428,7 @@ public abstract class EwolContext extends Application {
* @brief Request a display after call a resize
*/
public void requestUpdateSize() {
- final Context context = gale::getContext();
+ final Context context = Gale.getContext();
context.requestUpdateSize();
}
diff --git a/src/org/atriasoft/ewol/context/InputManager.cpp b/src/org/atriasoft/ewol/context/InputManager.cpp
deleted file mode 100644
index 40810b2..0000000
--- a/src/org/atriasoft/ewol/context/InputManager.cpp
+++ /dev/null
@@ -1,502 +0,0 @@
-/** @file
- * @author Edouard DUPIN
- * @copyright 2011, Edouard DUPIN, all right reserved
- * @license MPL v2.0 (see license file)
- */
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-ETK_DECLARE_TYPE(ewol::context::InputManager);
-
-#define EVENT_DEBUG EWOL_VERBOSE
-//#define EVENT_DEBUG EWOL_DEBUG
-
-void ewol::context::InputManager::calculateLimit() {
- this.eventInputLimit.sepatateTime = echrono::Duration(echrono::milliseconds(300));
- this.eventInputLimit.DpiOffset = this.dpi*100;
- this.eventMouseLimit.sepatateTime = echrono::Duration(echrono::milliseconds(300));
- this.eventMouseLimit.DpiOffset = float(this.dpi)*0.1f;
-}
-
-void ewol::context::InputManager::setDpi(int newDPI) {
- this.dpi = newDPI;
- // recalculate the DPI system ...
- calculateLimit();
-}
-
-boolean ewol::context::InputManager::localEventInput(KeyType _type,
- Widget _destWidget,
- int _IdInput,
- KeyStatus _status,
- Vector2f _pos) {
- if (_destWidget != null) {
- if ( _type == KeyType::mouse
- || _type == KeyType::finger) {
- // create the system Event :
- ewol::event::InputSystem tmpEventSystem(_type, _status, _IdInput, _pos, _destWidget, 0, this.specialKey); // TODO : set the real ID ...
- // generate the event :
- return _destWidget.systemEventInput(tmpEventSystem);
- } else {
- return false;
- }
- }
- return false;
-}
-
-void ewol::context::InputManager::abortElement(InputPoperty *_eventTable,
- int _idInput,
- KeyType _type) {
- if (_eventTable == null) {
- return;
- }
- if (_eventTable[_idInput].isUsed == true) {
- localEventInput(_type,
- _eventTable[_idInput].curentWidgetEvent.lock(),
- _eventTable[_idInput].destinationInputId,
- KeyStatus::abort,
- _eventTable[_idInput].posEvent);
- }
-}
-
-void ewol::context::InputManager::cleanElement(InputPoperty *_eventTable,
- int _idInput) {
- if (_eventTable == null) {
- return;
- }
- //Log.info("CleanElement[" + idInput + "] = @" + (long)eventTable);
- _eventTable[_idInput].isUsed = false;
- _eventTable[_idInput].destinationInputId = 0;
- _eventTable[_idInput].lastTimeEvent.reset();
- _eventTable[_idInput].curentWidgetEvent.reset();
- _eventTable[_idInput].origin.setValue(0,0);
- _eventTable[_idInput].size.setValue(99999999,99999999);
- _eventTable[_idInput].downStart.setValue(0,0);
- _eventTable[_idInput].isDown = false;
- _eventTable[_idInput].isInside = false;
- _eventTable[_idInput].nbClickEvent = 0;
- _eventTable[_idInput].posEvent.setValue(0,0);
-}
-
-void ewol::context::InputManager::transfertEvent(Widget _source, Widget _destination) {
- if( _source == null
- || _destination == null) {
- // prevent errors ...
- return;
- }
- for(int iii=0; iii" + this.eventInputSaved[iii].destinationInputId + " [EVENT_INPUT_TYPE_ABORT] " + this.eventInputSaved[iii].posEvent);
- localEventInput(KeyType::finger, tmpWidget, this.eventInputSaved[iii].destinationInputId, KeyStatus::abort, this.eventInputSaved[iii].posEvent);
- // set the new widget ...
- this.eventInputSaved[iii].curentWidgetEvent = _destination;
- // inform the widget that he receive the event property now...
- EVENT_DEBUG("GUI : Input ID=" + iii + " == >" + this.eventInputSaved[iii].destinationInputId + " [EVENT_INPUT_TYPE_TRANSFERT] " + this.eventInputSaved[iii].posEvent);
- localEventInput(KeyType::finger, _destination, this.eventInputSaved[iii].destinationInputId, KeyStatus::transfert, this.eventInputSaved[iii].posEvent);
- }
- tmpWidget = this.eventMouseSaved[iii].curentWidgetEvent.lock();
- if (tmpWidget == _source) {
- // inform the widget that it does not receive the event now
- EVENT_DEBUG("GUI : Input ID=" + iii + " == >" + this.eventMouseSaved[iii].destinationInputId + " [EVENT_INPUT_TYPE_ABORT] " + this.eventMouseSaved[iii].posEvent);
- localEventInput(KeyType::mouse, tmpWidget, this.eventMouseSaved[iii].destinationInputId, KeyStatus::abort, this.eventMouseSaved[iii].posEvent);
- // set the new widget ...
- this.eventMouseSaved[iii].curentWidgetEvent = _destination;
- // inform the widget that he receive the event property now...
- EVENT_DEBUG("GUI : Input ID=" + iii + " == >" + this.eventMouseSaved[iii].destinationInputId + " [EVENT_INPUT_TYPE_TRANSFERT] " + this.eventMouseSaved[iii].posEvent);
- localEventInput(KeyType::mouse, _destination, this.eventMouseSaved[iii].destinationInputId, KeyStatus::transfert, this.eventMouseSaved[iii].posEvent);
- }
- }
-}
-
-void ewol::context::InputManager::grabPointer(Widget _widget) {
- if(_widget == null) {
- return;
- }
- this.grabWidget = _widget;
- /* TODO :
- this.context.grabPointerEvents(true, _widget.getOrigin()
- + Vector2i(_widget.getSize().x()/2.0f,
- _widget.getSize().y()/2.0f) );
- */
-}
-
-void ewol::context::InputManager::unGrabPointer() {
- this.grabWidget.reset();
- // TODO: this.context.grabPointerEvents(false, Vector2f(0,0));
-}
-
-void ewol::context::InputManager::newLayerSet() {
- for(int iii=0; iii the it was finger event ...
-void ewol::context::InputManager::motion(KeyType _type,
- int _pointerID,
- Vector2f _pos) {
- EVENT_DEBUG("motion event : " + _type + " " + _pointerID + " " + _pos);
- if (MAX_MANAGE_INPUT <= _pointerID) {
- // reject pointer == > out of IDs...
- return;
- }
- InputPoperty *eventTable = null;
- if (_type == KeyType::mouse) {
- eventTable = this.eventMouseSaved;
- } else if (_type == KeyType::finger) {
- eventTable = this.eventInputSaved;
- } else {
- Log.error("Unknown type of event");
- return;
- }
- if( _pointerID > MAX_MANAGE_INPUT
- || _pointerID < 0) {
- // not manage input
- return;
- }
- ewol::widget::Windows tmpWindows = this.context.getWindows();
- // special case for the mouse event 0 that represent the hover event of the system :
- if ( _type == KeyType::mouse
- LOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOM _pointerID == 0) {
- // this event is all time on the good widget ... and manage the enter and leave ...
- // NOTE : the "layer widget" force us to get the widget at the specific position all the time :
- Widget tmpWidget;
- if (this.grabWidget.lock() != null) {
- // grab all events ...
- tmpWidget = this.grabWidget.lock();
- } else {
- if (tmpWindows != null) {
- tmpWidget = tmpWindows.getWidgetAtPos(_pos);
- }
- }
- if( tmpWidget != eventTable[_pointerID].curentWidgetEvent.lock()
- || ( eventTable[_pointerID].isInside == true
- LOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOM ( eventTable[_pointerID].origin.x() > _pos.x()
- || eventTable[_pointerID].origin.y() > _pos.y()
- || (eventTable[_pointerID].origin.x() + eventTable[_pointerID].size.x()) < _pos.x()
- || (eventTable[_pointerID].origin.y() + eventTable[_pointerID].size.y()) < _pos.y()) ) ) {
- eventTable[_pointerID].isInside = false;
- EVENT_DEBUG("GUI : Input ID=" + _pointerID + " == >" + eventTable[_pointerID].destinationInputId + " [LEAVE] " + _pos);
- eventTable[_pointerID].posEvent = _pos;
- localEventInput(_type,
- eventTable[_pointerID].curentWidgetEvent.lock(),
- eventTable[_pointerID].destinationInputId,
- KeyStatus::leave,
- _pos);
- }
- if (eventTable[_pointerID].isInside == false) {
- // set the element inside ...
- eventTable[_pointerID].isInside = true;
- // get destination widget :
- eventTable[_pointerID].curentWidgetEvent = tmpWidget;
- if (tmpWidget == null) {
- eventTable[_pointerID].isInside = false;
- } else {
- eventTable[_pointerID].origin = tmpWidget.getOrigin();
- eventTable[_pointerID].size = tmpWidget.getSize();
- }
- eventTable[_pointerID].destinationInputId = 0;
- EVENT_DEBUG("GUI : Input ID=" + _pointerID
- + " == >" + eventTable[_pointerID].destinationInputId
- + " [ENTER] " + _pos);
- eventTable[_pointerID].posEvent = _pos;
- localEventInput(_type,
- tmpWidget,
- eventTable[_pointerID].destinationInputId,
- KeyStatus::enter,
- _pos);
- }
- EVENT_DEBUG("GUI : Input ID=" + _pointerID
- + " == >" + eventTable[_pointerID].destinationInputId
- + " [MOVE] " + _pos);
- eventTable[_pointerID].posEvent = _pos;
- localEventInput(_type,
- tmpWidget,
- eventTable[_pointerID].destinationInputId,
- KeyStatus::move,
- _pos);
- } else if (eventTable[_pointerID].isUsed == true) {
- if (eventTable[_pointerID].isInside == true) {
- if( eventTable[_pointerID].origin.x() > _pos.x()
- || eventTable[_pointerID].origin.y() > _pos.y()
- || (eventTable[_pointerID].origin.x() + eventTable[_pointerID].size.x()) < _pos.x()
- || (eventTable[_pointerID].origin.y() + eventTable[_pointerID].size.y()) < _pos.y()) {
- eventTable[_pointerID].isInside = false;
- EVENT_DEBUG("GUI : Input ID=" + _pointerID
- + " == >" + eventTable[_pointerID].destinationInputId
- + " [LEAVE] " + _pos);
- eventTable[_pointerID].posEvent = _pos;
- localEventInput(_type,
- eventTable[_pointerID].curentWidgetEvent.lock(),
- eventTable[_pointerID].destinationInputId,
- KeyStatus::leave,
- _pos);
- }
- } else {
- if( ( eventTable[_pointerID].origin.x() <= _pos.x()
- LOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOM (eventTable[_pointerID].origin.x() + eventTable[_pointerID].size.x()) >= _pos.x() )
- LOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOM ( eventTable[_pointerID].origin.y() <= _pos.y()
- LOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOM (eventTable[_pointerID].origin.y() + eventTable[_pointerID].size.y()) >= _pos.y() ) ) {
- eventTable[_pointerID].isInside = true;
- EVENT_DEBUG("GUI : Input ID=" + _pointerID
- + " == >" + eventTable[_pointerID].destinationInputId
- + " [ENTER] " + _pos);
- eventTable[_pointerID].posEvent = _pos;
- localEventInput(_type,
- eventTable[_pointerID].curentWidgetEvent.lock(),
- eventTable[_pointerID].destinationInputId,
- KeyStatus::enter,
- _pos);
- }
- }
- EVENT_DEBUG("GUI : Input ID=" + _pointerID
- + " == >" + eventTable[_pointerID].destinationInputId
- + " [MOVE] " + _pos);
- eventTable[_pointerID].posEvent = _pos;
- localEventInput(_type,
- eventTable[_pointerID].curentWidgetEvent.lock(),
- eventTable[_pointerID].destinationInputId,
- KeyStatus::move,
- _pos);
- }
-}
-
-void ewol::context::InputManager::state(KeyType _type,
- int _pointerID,
- boolean _isDown,
- Vector2f _pos) {
- if (_pointerID >= MAX_MANAGE_INPUT) {
- // reject pointer == > out of IDs...
- return;
- }
- EVENT_DEBUG("event pointerId=" + _pointerID);
- // convert position in open-GL coordonates ...
- InputPoperty *eventTable = null;
- InputLimit localLimit;
- if (_type == KeyType::mouse) {
- eventTable = this.eventMouseSaved;
- localLimit = this.eventMouseLimit;
- } else if (_type == KeyType::finger) {
- eventTable = this.eventInputSaved;
- localLimit = this.eventInputLimit;
- } else {
- Log.error("Unknown type of event");
- return;
- }
- if( _pointerID > MAX_MANAGE_INPUT
- || _pointerID <= 0) {
- // not manage input
- return;
- }
- // get the curent time ...
- echrono::Clock currentTime = echrono::Clock::now();
- ewol::widget::Windows tmpWindows = this.context.getWindows();
-
- if (_isDown == true) {
- EVENT_DEBUG("GUI : Input ID=" + _pointerID
- + " == >" + eventTable[_pointerID].destinationInputId
- + " [DOWN] " + _pos);
- if(eventTable[_pointerID].isUsed == true) {
- // we have an event previously ... check delay between click and offset position
- if (currentTime - eventTable[_pointerID].lastTimeEvent > localLimit.sepatateTime) {
- cleanElement(eventTable, _pointerID);
- } else if( etk::abs(eventTable[_pointerID].downStart.x() - _pos.x()) >= localLimit.DpiOffset
- || etk::abs(eventTable[_pointerID].downStart.y() - _pos.y()) >= localLimit.DpiOffset ){
- cleanElement(eventTable, _pointerID);
- }
- }
- if(eventTable[_pointerID].isUsed == true) {
- // save start time
- eventTable[_pointerID].lastTimeEvent = currentTime;
- // generate DOWN Event
- EVENT_DEBUG("GUI : Input ID=" + _pointerID
- + " == >" + eventTable[_pointerID].destinationInputId
- + " [DOWN] " + _pos);
- eventTable[_pointerID].posEvent = _pos;
- localEventInput(_type,
- eventTable[_pointerID].curentWidgetEvent.lock(),
- eventTable[_pointerID].destinationInputId,
- KeyStatus::down,
- _pos);
- } else {
- // Mark it used :
- eventTable[_pointerID].isUsed = true;
- // Save current position :
- eventTable[_pointerID].downStart = _pos;
- // save start time
- eventTable[_pointerID].lastTimeEvent = currentTime;
- // set the element inside ...
- eventTable[_pointerID].isInside = true;
- Widget tmpWidget = this.grabWidget.lock();
- // get destination widget :
- if(tmpWindows != null) {
- if ( tmpWidget != null
- LOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOM _type == KeyType::mouse) {
- eventTable[_pointerID].curentWidgetEvent = tmpWidget;
- } else {
- tmpWidget = tmpWindows.getWidgetAtPos(_pos);
- eventTable[_pointerID].curentWidgetEvent = tmpWidget;
- if (tmpWidget != null) {
- EVENT_DEBUG("Get widget at pos=" + _pos + " type: " + tmpWidget.getObjectType());
- } else {
- EVENT_DEBUG("Get widget at pos=" + _pos + " NO WIDGET");
- }
- }
- } else {
- eventTable[_pointerID].curentWidgetEvent.reset();
- }
- tmpWidget = eventTable[_pointerID].curentWidgetEvent.lock();
- if (tmpWidget != null) {
- eventTable[_pointerID].origin = tmpWidget.getOrigin();
- eventTable[_pointerID].size = tmpWidget.getSize();
- eventTable[_pointerID].destinationInputId = localGetDestinationId(_type, tmpWidget, _pointerID);
- } else {
- eventTable[_pointerID].destinationInputId = -1;
- }
- // generate DOWN Event
- EVENT_DEBUG("GUI : Input ID=" + _pointerID
- + " == >" + eventTable[_pointerID].destinationInputId
- + " [DOWN] " + _pos);
- eventTable[_pointerID].posEvent = _pos;
- localEventInput(_type,
- tmpWidget,
- eventTable[_pointerID].destinationInputId,
- KeyStatus::down,
- _pos);
- }
- } else {
- EVENT_DEBUG("GUI : Input ID=" + _pointerID
- + " == >" + eventTable[_pointerID].destinationInputId
- + " [UP] " + _pos);
- Widget tmpWidget = eventTable[_pointerID].curentWidgetEvent.lock();
- if(eventTable[_pointerID].isUsed == false) {
- // bad case ... ???
- Log.debug("Up event without previous down ... ");
- // Mark it un-used :
- eventTable[_pointerID].isUsed = false;
- // revove the widget ...
- eventTable[_pointerID].curentWidgetEvent.reset();
- } else if (tmpWidget == null) {
- // The widget has been removed:
- EVENT_DEBUG(" Object Removed ...");
- // Mark it un-used :
- eventTable[_pointerID].isUsed = false;
- // revove the widget ...
- eventTable[_pointerID].curentWidgetEvent.reset();
- } else {
- // generate UP Event
- EVENT_DEBUG("GUI : Input ID=" + _pointerID
- + " == >" + eventTable[_pointerID].destinationInputId
- + " [UP] " + _pos);
- eventTable[_pointerID].posEvent = _pos;
- // send up event after the single event to prevent multiple widget getting elements
- localEventInput(_type,
- tmpWidget,
- _pointerID,
- KeyStatus::up,
- _pos);
- // generate event (single)
- if( etk::abs(eventTable[_pointerID].downStart.x() - _pos.x()) < localLimit.DpiOffset
- LOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOM etk::abs(eventTable[_pointerID].downStart.y() - _pos.y()) < localLimit.DpiOffset ){
- // Save current position :
- eventTable[_pointerID].downStart = _pos;
- // save start time
- eventTable[_pointerID].lastTimeEvent = currentTime;
- int nbClickMax = 0;
- if(tmpWidget != null) {
- nbClickMax = tmpWidget.getMouseLimit();
- if (nbClickMax>5) {
- nbClickMax = 5;
- }
- }
- // in grab mode the single to quinte event are not generated ....
- if( ( this.grabWidget.lock() == null
- || _type != KeyType::mouse )
- LOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOM eventTable[_pointerID].nbClickEvent < nbClickMax) {
- // generate event SINGLE :
- eventTable[_pointerID].nbClickEvent++;
- EVENT_DEBUG("GUI : Input ID=" + _pointerID
- + " == >" + eventTable[_pointerID].destinationInputId
- + " [" + eventTable[_pointerID].nbClickEvent + "] " + _pos);
- eventTable[_pointerID].posEvent = _pos;
- localEventInput(_type,
- tmpWidget,
- eventTable[_pointerID].destinationInputId,
- (KeyStatus)(uint(KeyStatus::pressSingle) + eventTable[_pointerID].nbClickEvent-1),
- _pos);
- if( eventTable[_pointerID].nbClickEvent >= nbClickMax) {
- eventTable[_pointerID].nbClickEvent = 0;
- }
- } else {
- eventTable[_pointerID].nbClickEvent = 0;
- }
- }
- // send up event after the single event to prevent multiple widget getting elements
- localEventInput(_type,
- tmpWidget,
- _pointerID,
- KeyStatus::upAfter,
- _pos);
- // specific for tuch event
- if (_type == KeyType::finger) {
- cleanElement(eventTable, _pointerID);
- }
- }
- }
-}
-
-
diff --git a/src/org/atriasoft/ewol/context/InputManager.java b/src/org/atriasoft/ewol/context/InputManager.java
index c6dd671..4e2ea31 100644
--- a/src/org/atriasoft/ewol/context/InputManager.java
+++ b/src/org/atriasoft/ewol/context/InputManager.java
@@ -3,118 +3,465 @@
* @copyright 2011, Edouard DUPIN, all right reserved
* @license MPL v2.0 (see license file)
*/
-#pragma once
-#include
+package org.atriasoft.ewol.context;
-#define MAX_MANAGE_INPUT (15)
+import java.lang.ref.WeakReference;
-namespace ewol {
- namespace context {
- /**
- * @brief internal structure
- * @not_in_doc
- */
- class InputPoperty {
- public:
- boolean isUsed;
- int destinationInputId;
- echrono::Clock lastTimeEvent;
- WeakReference curentWidgetEvent;
- Vector2f origin;
- Vector2f size;
- Vector2f downStart;
- Vector2f posEvent;
- boolean isDown;
- boolean isInside;
- int nbClickEvent; // 0 .. 1 .. 2 .. 3
- };
-
- /**
- * @brief internal structure
- * @not_in_doc
- */
- class InputLimit {
- public:
- echrono::Duration sepatateTime;
- int DpiOffset;
- };
- class Context;
- class InputManager{
- // special grab pointer mode :
- private:
- WeakReference this.grabWidget; //!< widget that grab the curent pointer.
- private:
- int this.dpi;
- InputLimit this.eventInputLimit;
- InputLimit this.eventMouseLimit;
- void calculateLimit();
- InputPoperty this.eventInputSaved[MAX_MANAGE_INPUT];
- InputPoperty this.eventMouseSaved[MAX_MANAGE_INPUT];
- void abortElement(InputPoperty* _eventTable, int _idInput, KeyType _type);
- void cleanElement(InputPoperty* _eventTable, int _idInput);
- /**
- * @brief generate the event on the destinated widget.
- * @param[in] _type Type of the event that might be sended.
- * @param[in] _destWidget Pointer on the requested widget that element might be sended
- * @param[in] _IdInput Id of the event (PC : [0..9] and touch : [1..9])
- * @param[in] _typeEvent type of the eventg generated
- * @param[in] _pos position of the event
- * @return true if event has been greped
- */
- boolean localEventInput(KeyType _type,
- Widget _destWidget,
- int _IdInput,
- KeyStatus _typeEvent,
- Vector2f _pos);
- /**
- * @brief convert the system event id in the correct EWOL id depending of the system management mode
- * This function find the next input id unused on the specifiic widget
- * == > on PC, the ID does not change (GUI is not the same)
- * @param[in] _type Type of the kay event.
- * @param[in] _destWidget Pointer of the widget destination
- * @param[in] _realInputId system Id
- * @return the ewol input id
- */
- int localGetDestinationId(KeyType _type,
- Widget _destWidget,
- int _realInputId);
- private:
- EwolContext this.context;
- public:
- InputManager(EwolContext _context);
- ~InputManager();
- void setDpi(int _newDPI);
-
- // note if id<0 == > the it was finger event ...
- void motion(KeyType _type, int _pointerID, Vector2f _pos );
- void state(KeyType _type, int _pointerID, boolean _isDown, Vector2f _pos);
- public:
- /**
- * @brief a new layer on the windows is set == > might remove all the property of the current element ...
- */
- void newLayerSet();
- /**
- * @brief This is to transfert the event from one widget to another one
- * @param _source the widget where the event came from
- * @param _destination the widget where the event mitgh be generated now
- */
- void transfertEvent(Widget _source, Widget _destination);
- /**
- * @brief This fonction lock the pointer properties to move in relative instead of absolute
- * @param[in] _widget The widget that lock the pointer events
- */
- void grabPointer(Widget _widget);
- /**
- * @brief This fonction un-lock the pointer properties to move in relative instead of absolute
- */
- void unGrabPointer();
- private:
- KeySpecial this.specialKey;
- public:
- void setLastKeyboardSpecial( KeySpecial _specialKey) {
- this.specialKey = _specialKey;
- }
- };
- };
+import org.atriasoft.echrono.Clock;
+import org.atriasoft.echrono.Duration;
+import org.atriasoft.etk.math.FMath;
+import org.atriasoft.etk.math.Vector2f;
+import org.atriasoft.ewol.event.InputSystem;
+import org.atriasoft.ewol.internal.Log;
+import org.atriasoft.ewol.widget.Widget;
+import org.atriasoft.ewol.widget.Windows;
+import org.atriasoft.gale.key.KeySpecial;
+import org.atriasoft.gale.key.KeyStatus;
+import org.atriasoft.gale.key.KeyType;
+
+/**
+ * @brief internal structure
+ */
+class InputLimit {
+ public Duration sepatateTime;
+ public int DpiOffset;
};
+class InputManager {
+ private final static int MAX_MANAGE_INPUT = 15;
+
+ // special grab pointer mode :
+ private WeakReference grabWidget = null; //!< widget that grab the curent pointer.
+ private int dpi;
+ private InputLimit eventInputLimit;
+ private InputLimit eventMouseLimit;
+ private final InputPoperty[] eventInputSaved = new InputPoperty[MAX_MANAGE_INPUT];
+ private final InputPoperty[] eventMouseSaved = new InputPoperty[MAX_MANAGE_INPUT];
+
+ private final EwolContext context;
+ private KeySpecial specialKey;
+
+ public InputManager(final EwolContext _context) {
+ this.context = _context;
+ setDpi(200);
+ Log.info("Init (start)");
+ for (int iii = 0; iii < MAX_MANAGE_INPUT; iii++) {
+ // remove the property of this input ...
+ cleanElement(this.eventInputSaved, iii);
+ cleanElement(this.eventMouseSaved, iii);
+ }
+ Log.info("Init (end)");
+ }
+
+ public void abortElement(final InputPoperty[] _eventTable, final int _idInput, final KeyType _type) {
+ if (_eventTable == null) {
+ return;
+ }
+ if (_eventTable[_idInput].isUsed == true) {
+ localEventInput(_type, _eventTable[_idInput].curentWidgetEvent.get(), _eventTable[_idInput].destinationInputId, KeyStatus.abort, _eventTable[_idInput].posEvent);
+ }
+ }
+
+ private void calculateLimit() {
+ this.eventInputLimit.sepatateTime = Duration.milliseconds(300);
+ this.eventInputLimit.DpiOffset = this.dpi * 100;
+ this.eventMouseLimit.sepatateTime = Duration.milliseconds(300);
+ this.eventMouseLimit.DpiOffset = (int) (this.dpi * 0.1f);
+ }
+
+ public void cleanElement(final InputPoperty[] eventMouseSaved2, final int _idInput) {
+ if (eventMouseSaved2 == null) {
+ return;
+ }
+ //Log.info("CleanElement[" + idInput + "] = @" + (long)eventTable);
+ eventMouseSaved2[_idInput].isUsed = false;
+ eventMouseSaved2[_idInput].destinationInputId = 0;
+ eventMouseSaved2[_idInput].lastTimeEvent = new Clock();
+ eventMouseSaved2[_idInput].curentWidgetEvent = null;
+ eventMouseSaved2[_idInput].origin.setValue(0, 0);
+ eventMouseSaved2[_idInput].size.setValue(99999999, 99999999);
+ eventMouseSaved2[_idInput].downStart.setValue(0, 0);
+ eventMouseSaved2[_idInput].isDown = false;
+ eventMouseSaved2[_idInput].isInside = false;
+ eventMouseSaved2[_idInput].nbClickEvent = 0;
+ eventMouseSaved2[_idInput].posEvent.setValue(0, 0);
+ }
+
+ /**
+ * @brief This fonction lock the pointer properties to move in relative instead of absolute
+ * @param[in] _widget The widget that lock the pointer events
+ */
+ public void grabPointer(final Widget _widget) {
+ if (_widget == null) {
+ return;
+ }
+ this.grabWidget = new WeakReference<>(_widget);
+ /* TODO :
+ this.context.grabPointerEvents(true, _widget.getOrigin()
+ + Vector2i(_widget.getSize().x/2.0f,
+ _widget.getSize().y/2.0f) );
+ */
+ }
+
+ /**
+ * @brief generate the event on the destinated widget.
+ * @param[in] _type Type of the event that might be sended.
+ * @param[in] _destWidget Pointer on the requested widget that element might be sended
+ * @param[in] _IdInput Id of the event (PC : [0..9] and touch : [1..9])
+ * @param[in] _typeEvent type of the eventg generated
+ * @param[in] _pos position of the event
+ * @return true if event has been greped
+ */
+ public boolean localEventInput(final KeyType _type, final Widget _destWidget, final int _IdInput, final KeyStatus _status, final Vector2f _pos) {
+ if (_destWidget != null) {
+ if (_type == KeyType.mouse || _type == KeyType.finger) {
+ // create the system Event :
+ // TODO : set the real ID ...
+ final InputSystem tmpEventSystem = new InputSystem(_type, _status, _IdInput, _pos, _destWidget, 0, this.specialKey);
+ // generate the event :
+ return _destWidget.systemEventInput(tmpEventSystem);
+ } else {
+ return false;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @brief convert the system event id in the correct EWOL id depending of the system management mode
+ * This function find the next input id unused on the specifiic widget
+ * == > on PC, the ID does not change (GUI is not the same)
+ * @param[in] _type Type of the kay event.
+ * @param[in] _destWidget Pointer of the widget destination
+ * @param[in] _realInputId system Id
+ * @return the ewol input id
+ */
+ public int localGetDestinationId(final KeyType _type, final Widget _destWidget, final int _realInputId) {
+ if (_type == KeyType.finger) {
+ int lastMinimum = 0;
+ for (int iii = 0; iii < MAX_MANAGE_INPUT; iii++) {
+ if (true == this.eventInputSaved[iii].isUsed) {
+ final Widget tmpWidget = this.eventInputSaved[iii].curentWidgetEvent.get();
+ if (tmpWidget == _destWidget) {
+ if (iii != _realInputId) {
+ lastMinimum = FMath.max(lastMinimum, this.eventInputSaved[iii].destinationInputId);
+ }
+ }
+ }
+ }
+ return lastMinimum + 1;
+ }
+ return _realInputId;
+ }
+
+ // note if id<0 == > the it was finger event ...
+ public void motion(final KeyType _type, final int _pointerID, final Vector2f _pos) {
+ //Log.debug("motion event : " + _type + " " + _pointerID + " " + _pos);
+ if (MAX_MANAGE_INPUT <= _pointerID) {
+ // reject pointer == > out of IDs...
+ return;
+ }
+ InputPoperty[] eventTable = null;
+ if (_type == KeyType.mouse) {
+ eventTable = this.eventMouseSaved;
+ } else if (_type == KeyType.finger) {
+ eventTable = this.eventInputSaved;
+ } else {
+ Log.error("Unknown type of event");
+ return;
+ }
+ if (_pointerID > MAX_MANAGE_INPUT || _pointerID < 0) {
+ // not manage input
+ return;
+ }
+ final Windows tmpWindows = this.context.getWindows();
+ // special case for the mouse event 0 that represent the hover event of the system :
+ if (_type == KeyType.mouse && _pointerID == 0) {
+ // this event is all time on the good widget ... and manage the enter and leave ...
+ // NOTE : the "layer widget" force us to get the widget at the specific position all the time :
+ Widget tmpWidget = null;
+ if (this.grabWidget.get() != null) {
+ // grab all events ...
+ tmpWidget = this.grabWidget.get();
+ } else if (tmpWindows != null) {
+ tmpWidget = tmpWindows.getWidgetAtPos(_pos);
+ }
+ if (tmpWidget != eventTable[_pointerID].curentWidgetEvent.get()
+ || (eventTable[_pointerID].isInside == true && (eventTable[_pointerID].origin.x > _pos.x || eventTable[_pointerID].origin.y > _pos.y
+ || (eventTable[_pointerID].origin.x + eventTable[_pointerID].size.x) < _pos.x || (eventTable[_pointerID].origin.y + eventTable[_pointerID].size.y) < _pos.y))) {
+ eventTable[_pointerID].isInside = false;
+ //Log.debug("GUI : Input ID=" + _pointerID + " == >" + eventTable[_pointerID].destinationInputId + " [LEAVE] " + _pos);
+ eventTable[_pointerID].posEvent = _pos;
+ localEventInput(_type, eventTable[_pointerID].curentWidgetEvent.get(), eventTable[_pointerID].destinationInputId, KeyStatus.leave, _pos);
+ }
+ if (eventTable[_pointerID].isInside == false) {
+ // set the element inside ...
+ eventTable[_pointerID].isInside = true;
+ // get destination widget :
+ eventTable[_pointerID].curentWidgetEvent = new WeakReference<>(tmpWidget);
+ if (tmpWidget == null) {
+ eventTable[_pointerID].isInside = false;
+ } else {
+ eventTable[_pointerID].origin = tmpWidget.getOrigin();
+ eventTable[_pointerID].size = tmpWidget.getSize();
+ }
+ eventTable[_pointerID].destinationInputId = 0;
+ //Log.debug("GUI : Input ID=" + _pointerID + " == >" + eventTable[_pointerID].destinationInputId + " [ENTER] " + _pos);
+ eventTable[_pointerID].posEvent = _pos;
+ localEventInput(_type, tmpWidget, eventTable[_pointerID].destinationInputId, KeyStatus.enter, _pos);
+ }
+ //Log.debug("GUI : Input ID=" + _pointerID + " == >" + eventTable[_pointerID].destinationInputId + " [MOVE] " + _pos);
+ eventTable[_pointerID].posEvent = _pos;
+ localEventInput(_type, tmpWidget, eventTable[_pointerID].destinationInputId, KeyStatus.move, _pos);
+ } else if (eventTable[_pointerID].isUsed == true) {
+ if (eventTable[_pointerID].isInside == true) {
+ if (eventTable[_pointerID].origin.x > _pos.x || eventTable[_pointerID].origin.y > _pos.y || (eventTable[_pointerID].origin.x + eventTable[_pointerID].size.x) < _pos.x
+ || (eventTable[_pointerID].origin.y + eventTable[_pointerID].size.y) < _pos.y) {
+ eventTable[_pointerID].isInside = false;
+ //Log.debug("GUI : Input ID=" + _pointerID + " == >" + eventTable[_pointerID].destinationInputId + " [LEAVE] " + _pos);
+ eventTable[_pointerID].posEvent = _pos;
+ localEventInput(_type, eventTable[_pointerID].curentWidgetEvent.get(), eventTable[_pointerID].destinationInputId, KeyStatus.leave, _pos);
+ }
+ } else if ((eventTable[_pointerID].origin.x <= _pos.x && (eventTable[_pointerID].origin.x + eventTable[_pointerID].size.x) >= _pos.x)
+ && (eventTable[_pointerID].origin.y <= _pos.y && (eventTable[_pointerID].origin.y + eventTable[_pointerID].size.y) >= _pos.y)) {
+ eventTable[_pointerID].isInside = true;
+ //Log.debug("GUI : Input ID=" + _pointerID + " == >" + eventTable[_pointerID].destinationInputId + " [ENTER] " + _pos);
+ eventTable[_pointerID].posEvent = _pos;
+ localEventInput(_type, eventTable[_pointerID].curentWidgetEvent.get(), eventTable[_pointerID].destinationInputId, KeyStatus.enter, _pos);
+ }
+ //Log.debug("GUI : Input ID=" + _pointerID + " == >" + eventTable[_pointerID].destinationInputId + " [MOVE] " + _pos);
+ eventTable[_pointerID].posEvent = _pos;
+ localEventInput(_type, eventTable[_pointerID].curentWidgetEvent.get(), eventTable[_pointerID].destinationInputId, KeyStatus.move, _pos);
+ }
+ }
+
+ /**
+ * @brief a new layer on the windows is set == > might remove all the property of the current element ...
+ */
+ public void newLayerSet() {
+ for (int iii = 0; iii < MAX_MANAGE_INPUT; iii++) {
+ // remove the property of this input ...
+ abortElement(this.eventInputSaved, iii, KeyType.finger);
+ cleanElement(this.eventInputSaved, iii);
+ abortElement(this.eventMouseSaved, iii, KeyType.mouse);
+ cleanElement(this.eventMouseSaved, iii);
+ }
+ }
+
+ public void setDpi(final int newDPI) {
+ this.dpi = newDPI;
+ // recalculate the DPI system ...
+ calculateLimit();
+ }
+
+ public void setLastKeyboardSpecial(final KeySpecial _specialKey) {
+ this.specialKey = _specialKey;
+ }
+
+ public void state(final KeyType _type, final int _pointerID, final boolean _isDown, final Vector2f _pos) {
+ if (_pointerID >= MAX_MANAGE_INPUT) {
+ // reject pointer == > out of IDs...
+ return;
+ }
+ //Log.debug("event pointerId=" + _pointerID);
+ // convert position in open-GL coordonates ...
+ InputPoperty[] eventTable = null;
+ InputLimit localLimit;
+ if (_type == KeyType.mouse) {
+ eventTable = this.eventMouseSaved;
+ localLimit = this.eventMouseLimit;
+ } else if (_type == KeyType.finger) {
+ eventTable = this.eventInputSaved;
+ localLimit = this.eventInputLimit;
+ } else {
+ Log.error("Unknown type of event");
+ return;
+ }
+ if (_pointerID > MAX_MANAGE_INPUT || _pointerID <= 0) {
+ // not manage input
+ return;
+ }
+ // get the curent time ...
+ final Clock currentTime = Clock.now();
+ final Windows tmpWindows = this.context.getWindows();
+
+ if (_isDown == true) {
+ //Log.debug("GUI : Input ID=" + _pointerID + " == >" + eventTable[_pointerID].destinationInputId + " [DOWN] " + _pos);
+ if (eventTable[_pointerID].isUsed == true) {
+ // we have an event previously ... check delay between click and offset position
+ if (currentTime.less(eventTable[_pointerID].lastTimeEvent).isGreaterThan(localLimit.sepatateTime)) {
+ cleanElement(eventTable, _pointerID);
+ } else if (FMath.abs(eventTable[_pointerID].downStart.x - _pos.x) >= localLimit.DpiOffset || FMath.abs(eventTable[_pointerID].downStart.y - _pos.y) >= localLimit.DpiOffset) {
+ cleanElement(eventTable, _pointerID);
+ }
+ }
+ if (eventTable[_pointerID].isUsed == true) {
+ // save start time
+ eventTable[_pointerID].lastTimeEvent = currentTime;
+ // generate DOWN Event
+ //Log.debug("GUI : Input ID=" + _pointerID + " == >" + eventTable[_pointerID].destinationInputId + " [DOWN] " + _pos);
+ eventTable[_pointerID].posEvent = _pos;
+ localEventInput(_type, eventTable[_pointerID].curentWidgetEvent.get(), eventTable[_pointerID].destinationInputId, KeyStatus.down, _pos);
+ } else {
+ // Mark it used :
+ eventTable[_pointerID].isUsed = true;
+ // Save current position :
+ eventTable[_pointerID].downStart = _pos;
+ // save start time
+ eventTable[_pointerID].lastTimeEvent = currentTime;
+ // set the element inside ...
+ eventTable[_pointerID].isInside = true;
+ Widget tmpWidget = this.grabWidget.get();
+ // get destination widget :
+ if (tmpWindows != null) {
+ if (tmpWidget != null && _type == KeyType.mouse) {
+ eventTable[_pointerID].curentWidgetEvent = new WeakReference<>(tmpWidget);
+ } else {
+ tmpWidget = tmpWindows.getWidgetAtPos(_pos);
+ eventTable[_pointerID].curentWidgetEvent = new WeakReference<>(tmpWidget);
+ /*
+ if (tmpWidget != null) {
+ Log.debug("Get widget at pos=" + _pos + " type: " + tmpWidget.getObjectType());
+ } else {
+ Log.debug("Get widget at pos=" + _pos + " NO WIDGET");
+ }
+ */
+ }
+ } else {
+ eventTable[_pointerID].curentWidgetEvent = null;
+ }
+ tmpWidget = eventTable[_pointerID].curentWidgetEvent.get();
+ if (tmpWidget != null) {
+ eventTable[_pointerID].origin = tmpWidget.getOrigin();
+ eventTable[_pointerID].size = tmpWidget.getSize();
+ eventTable[_pointerID].destinationInputId = localGetDestinationId(_type, tmpWidget, _pointerID);
+ } else {
+ eventTable[_pointerID].destinationInputId = -1;
+ }
+ // generate DOWN Event
+ //Log.debug("GUI : Input ID=" + _pointerID + " == >" + eventTable[_pointerID].destinationInputId + " [DOWN] " + _pos);
+ eventTable[_pointerID].posEvent = _pos;
+ localEventInput(_type, tmpWidget, eventTable[_pointerID].destinationInputId, KeyStatus.down, _pos);
+ }
+ } else {
+ //Log.debug("GUI : Input ID=" + _pointerID + " == >" + eventTable[_pointerID].destinationInputId + " [UP] " + _pos);
+ final Widget tmpWidget = eventTable[_pointerID].curentWidgetEvent.get();
+ if (eventTable[_pointerID].isUsed == false) {
+ // bad case ... ???
+ Log.debug("Up event without previous down ... ");
+ // Mark it un-used :
+ eventTable[_pointerID].isUsed = false;
+ // revove the widget ...
+ eventTable[_pointerID].curentWidgetEvent = null;
+ } else if (tmpWidget == null) {
+ // The widget has been removed:
+ //Log.debug(" Object Removed ...");
+ // Mark it un-used :
+ eventTable[_pointerID].isUsed = false;
+ // revove the widget ...
+ eventTable[_pointerID].curentWidgetEvent = null;
+ } else {
+ // generate UP Event
+ //Log.debug("GUI : Input ID=" + _pointerID + " == >" + eventTable[_pointerID].destinationInputId + " [UP] " + _pos);
+ eventTable[_pointerID].posEvent = _pos;
+ // send up event after the single event to prevent multiple widget getting elements
+ localEventInput(_type, tmpWidget, _pointerID, KeyStatus.up, _pos);
+ // generate event (single)
+ if (FMath.abs(eventTable[_pointerID].downStart.x - _pos.x) < localLimit.DpiOffset && FMath.abs(eventTable[_pointerID].downStart.y - _pos.y) < localLimit.DpiOffset) {
+ // Save current position :
+ eventTable[_pointerID].downStart = _pos;
+ // save start time
+ eventTable[_pointerID].lastTimeEvent = currentTime;
+ int nbClickMax = 0;
+ if (tmpWidget != null) {
+ nbClickMax = tmpWidget.getMouseLimit();
+ if (nbClickMax > 5) {
+ nbClickMax = 5;
+ }
+ }
+ // in grab mode the single to quinte event are not generated ....
+ if ((this.grabWidget.get() == null || _type != KeyType.mouse) && eventTable[_pointerID].nbClickEvent < nbClickMax) {
+ // generate event SINGLE :
+ eventTable[_pointerID].nbClickEvent++;
+ //Log.debug("GUI : Input ID=" + _pointerID + " == >" + eventTable[_pointerID].destinationInputId + " [" + eventTable[_pointerID].nbClickEvent + "] " + _pos);
+ eventTable[_pointerID].posEvent = _pos;
+ localEventInput(_type, tmpWidget, eventTable[_pointerID].destinationInputId, KeyStatus.pressCount(eventTable[_pointerID].nbClickEvent), _pos);
+ if (eventTable[_pointerID].nbClickEvent >= nbClickMax) {
+ eventTable[_pointerID].nbClickEvent = 0;
+ }
+ } else {
+ eventTable[_pointerID].nbClickEvent = 0;
+ }
+ }
+ // send up event after the single event to prevent multiple widget getting elements
+ localEventInput(_type, tmpWidget, _pointerID, KeyStatus.upAfter, _pos);
+ // specific for tuch event
+ if (_type == KeyType.finger) {
+ cleanElement(eventTable, _pointerID);
+ }
+ }
+ }
+ }
+
+ /**
+ * @brief This is to transfert the event from one widget to another one
+ * @param _source the widget where the event came from
+ * @param _destination the widget where the event mitgh be generated now
+ */
+ public void transfertEvent(final Widget _source, final Widget _destination) {
+ if (_source == null || _destination == null) {
+ // prevent errors ...
+ return;
+ }
+ for (int iii = 0; iii < MAX_MANAGE_INPUT; iii++) {
+ Widget tmpWidget = this.eventInputSaved[iii].curentWidgetEvent.get();
+ if (tmpWidget == _source) {
+ // inform the widget that it does not receive the event now
+ //Log.debug("GUI : Input ID=" + iii + " == >" + this.eventInputSaved[iii].destinationInputId + " [EVENT_INPUT_TYPE_ABORT] " + this.eventInputSaved[iii].posEvent);
+ localEventInput(KeyType.finger, tmpWidget, this.eventInputSaved[iii].destinationInputId, KeyStatus.abort, this.eventInputSaved[iii].posEvent);
+ // set the new widget ...
+ this.eventInputSaved[iii].curentWidgetEvent = new WeakReference<>(_destination);
+ // inform the widget that he receive the event property now...
+ //Log.debug("GUI : Input ID=" + iii + " == >" + this.eventInputSaved[iii].destinationInputId + " [EVENT_INPUT_TYPE_TRANSFERT] " + this.eventInputSaved[iii].posEvent);
+ localEventInput(KeyType.finger, _destination, this.eventInputSaved[iii].destinationInputId, KeyStatus.transfert, this.eventInputSaved[iii].posEvent);
+ }
+ tmpWidget = this.eventMouseSaved[iii].curentWidgetEvent.get();
+ if (tmpWidget == _source) {
+ // inform the widget that it does not receive the event now
+ //Log.debug("GUI : Input ID=" + iii + " == >" + this.eventMouseSaved[iii].destinationInputId + " [EVENT_INPUT_TYPE_ABORT] " + this.eventMouseSaved[iii].posEvent);
+ localEventInput(KeyType.mouse, tmpWidget, this.eventMouseSaved[iii].destinationInputId, KeyStatus.abort, this.eventMouseSaved[iii].posEvent);
+ // set the new widget ...
+ this.eventMouseSaved[iii].curentWidgetEvent = new WeakReference<>(_destination);
+ // inform the widget that he receive the event property now...
+ //Log.debug("GUI : Input ID=" + iii + " == >" + this.eventMouseSaved[iii].destinationInputId + " [EVENT_INPUT_TYPE_TRANSFERT] " + this.eventMouseSaved[iii].posEvent);
+ localEventInput(KeyType.mouse, _destination, this.eventMouseSaved[iii].destinationInputId, KeyStatus.transfert, this.eventMouseSaved[iii].posEvent);
+ }
+ }
+ }
+
+ /**
+ * @brief This function un-lock the pointer properties to move in relative instead of absolute
+ */
+ public void unGrabPointer() {
+ this.grabWidget = null;
+ // TODO: this.context.grabPointerEvents(false, Vector2f(0,0));
+ }
+
+};
+
+/**
+ * @brief internal structure
+ */
+class InputPoperty {
+ public boolean isUsed;
+ public int destinationInputId;
+ public Clock lastTimeEvent;
+ public WeakReference curentWidgetEvent;
+ public Vector2f origin;
+ public Vector2f size;
+ public Vector2f downStart;
+ public Vector2f posEvent;
+ public boolean isDown;
+ public boolean isInside;
+ public int nbClickEvent; // 0 .. 1 .. 2 .. 3
+}
diff --git a/src/org/atriasoft/ewol/event/EntrySystem.java b/src/org/atriasoft/ewol/event/EntrySystem.java
index c08f5f6..7830843 100644
--- a/src/org/atriasoft/ewol/event/EntrySystem.java
+++ b/src/org/atriasoft/ewol/event/EntrySystem.java
@@ -5,9 +5,9 @@ import org.atriasoft.gale.key.KeySpecial;
import org.atriasoft.gale.key.KeyStatus;
public class EntrySystem {
- public final Entry event;
+ public final EventEntry event;
public EntrySystem(final KeyKeyboard _type, final KeyStatus _status, final KeySpecial _specialKey, final Character _char) {
- this.event = new Entry(_type, _status, _specialKey, _char);
+ this.event = new EventEntry(_specialKey, _type, _status, _char);
}
}
\ No newline at end of file
diff --git a/src/org/atriasoft/ewol/event/Entry.java b/src/org/atriasoft/ewol/event/EventEntry.java
similarity index 59%
rename from src/org/atriasoft/ewol/event/Entry.java
rename to src/org/atriasoft/ewol/event/EventEntry.java
index a071fb0..8a5bbab 100644
--- a/src/org/atriasoft/ewol/event/Entry.java
+++ b/src/org/atriasoft/ewol/event/EventEntry.java
@@ -4,40 +4,37 @@ import org.atriasoft.gale.key.KeyKeyboard;
import org.atriasoft.gale.key.KeySpecial;
import org.atriasoft.gale.key.KeyStatus;
-/** @file
- * @author Edouard DUPIN
- * @copyright 2011, Edouard DUPIN, all right reserved
- * @license MPL v2.0 (see license file)
- */
-
-public class Entry {
+public class EventEntry {
+ private final KeySpecial specialKey; //!< input key status (prevent change in time..)
private final KeyKeyboard type; //!< type of hardware event
private final KeyStatus status; //!< status of hardware event
- private final KeySpecial specialKey; //!< input key status (prevent change in time..)
private final Character unicodeData; //!< Unicode data (in some case)
- public Entry(final KeyKeyboard _type, final KeyStatus _status, final KeySpecial _specialKey, final Character _char) {
- this.type = _type;
- this.status = _status;
- this.specialKey = _specialKey;
- this.unicodeData = _char;
-
+ public EventEntry(final KeySpecial specialKey, final KeyKeyboard type, final KeyStatus status, final Character charValue) {
+ this.type = type;
+ this.status = status;
+ this.specialKey = specialKey;
+ this.unicodeData = charValue;
}
public Character getChar() {
return this.unicodeData;
- };
+ }
public KeySpecial getSpecialKey() {
return this.specialKey;
- };
+ }
public KeyStatus getStatus() {
return this.status;
- };
+ }
public KeyKeyboard getType() {
return this.type;
};
-};
\ No newline at end of file
+ @Override
+ public String toString() {
+ return "EventEntry [type=" + this.type + ", status=" + this.status + ", unicodeData=" + this.unicodeData + ", specialKey=" + this.specialKey + "]";
+ }
+}
diff --git a/src/org/atriasoft/ewol/event/EvantInput.java b/src/org/atriasoft/ewol/event/EventInput.java
similarity index 100%
rename from src/org/atriasoft/ewol/event/EvantInput.java
rename to src/org/atriasoft/ewol/event/EventInput.java
diff --git a/src/org/atriasoft/ewol/event/EventTime.java b/src/org/atriasoft/ewol/event/EventTime.java
index b953297..7321c74 100644
--- a/src/org/atriasoft/ewol/event/EventTime.java
+++ b/src/org/atriasoft/ewol/event/EventTime.java
@@ -9,10 +9,10 @@ import org.atriasoft.echrono.Duration;
* @license MPL v2.0 (see license file)
*/
public class EventTime {
- private Clock timeSystem; //!< Current system time (micro-second)
- private Clock timeUpAppl; //!< Current application wake up-time (micro-second)
- private Duration timeDelta; //!< Time from the last cycle call of the system (main appl tick) (second)
- private Duration timeDeltaCall; //!< Time from the last call (when we can manage periodic call with specifying periode) (second)
+ private final Clock timeSystem; //!< Current system time (micro-second)
+ private final Clock timeUpAppl; //!< Current application wake up-time (micro-second)
+ private final Duration timeDelta; //!< Time from the last cycle call of the system (main appl tick) (second)
+ private final Duration timeDeltaCall; //!< Time from the last call (when we can manage periodic call with specifying periode) (second)
public EventTime(final Clock _timeSystem, final Clock _timeUpAppl, final Duration _timeDelta, final Duration _timeDeltaCall) {
this.timeSystem = _timeSystem;
@@ -50,19 +50,4 @@ public class EventTime {
return this.timeSystem;
};
- public void setApplWakeUpTime(final Clock _timeUpAppl) {
- this.timeUpAppl = _timeUpAppl;
- };
-
- public void setDelta(final Duration _timeDelta) {
- this.timeDelta = _timeDelta;
- };
-
- public void setDeltaCall(final Duration _timeDeltaCall) {
- this.timeDeltaCall = _timeDeltaCall;
- };
-
- public void setTime(final Clock _timeSystem) {
- this.timeSystem = _timeSystem;
- };
}
diff --git a/src/org/atriasoft/ewol/event/InputSystem.java b/src/org/atriasoft/ewol/event/InputSystem.java
index 465f5eb..3ee16a4 100644
--- a/src/org/atriasoft/ewol/event/InputSystem.java
+++ b/src/org/atriasoft/ewol/event/InputSystem.java
@@ -1,12 +1,11 @@
package org.atriasoft.ewol.event;
import org.atriasoft.etk.math.Vector2f;
+import org.atriasoft.ewol.widget.Widget;
import org.atriasoft.gale.key.KeySpecial;
import org.atriasoft.gale.key.KeyStatus;
import org.atriasoft.gale.key.KeyType;
-import jdk.internal.org.jline.reader.Widget;
-
public class InputSystem {
public EventInput event;
diff --git a/src/org/atriasoft/ewol/gravity.cpp b/src/org/atriasoft/ewol/gravity.cpp
deleted file mode 100644
index dfb7371..0000000
--- a/src/org/atriasoft/ewol/gravity.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/** @file
- * @author Edouard DUPIN
- * @copyright 2011, Edouard DUPIN, all right reserved
- * @license MPL v2.0 (see license file)
- */
-
-#include
-#include
-
-#include
-ETK_DECLARE_TYPE(enum ewol::gravity);
-
-String ewol::gravityToString( enum ewol::gravity _obj) {
- switch(_obj) {
- case ewol::gravity_center:
- return "center";
- case ewol::gravity_topLeft:
- return "top-left";
- case ewol::gravity_top:
- return "top";
- case ewol::gravity_topRight:
- return "top-right";
- case ewol::gravity_right:
- return "right";
- case ewol::gravity_buttomRight:
- return "buttom-right";
- case ewol::gravity_buttom:
- return "buttom";
- case ewol::gravity_buttomLeft:
- return "buttom-left";
- case ewol::gravity_left:
- return "left";
- }
- return "unknow";
-}
-
-enum ewol::gravity ewol::stringToGravity( String _obj) {
- if (_obj == "center") {
- return ewol::gravity_center;
- } else if (_obj == "top-left") {
- return ewol::gravity_topLeft;
- } else if (_obj == "top") {
- return ewol::gravity_top;
- } else if (_obj == "top-right") {
- return ewol::gravity_topRight;
- } else if (_obj == "right") {
- return ewol::gravity_right;
- } else if (_obj == "buttom-right") {
- return ewol::gravity_buttomRight;
- } else if (_obj == "buttom") {
- return ewol::gravity_buttom;
- } else if (_obj == "buttom-left") {
- return ewol::gravity_buttomLeft;
- } else if (_obj == "left") {
- return ewol::gravity_left;
- }
- return ewol::gravity_center;
-}
-Vector2f ewol::gravityGenerateDelta( enum ewol::gravity _gravity, Vector2f _deltas) {
- Vector2f out(0.0f,0.0f);
- if (_deltas.x() > 0.0001f) {
- if ((uint(_gravity) uint(ewol::gravity_left)) != 0) {
- // nothing to do
- } else if ((uint(_gravity) uint(ewol::gravity_right)) != 0) {
- out = Vector2f(int(_deltas.x()), 0.0f);
- } else {
- out = Vector2f(int(_deltas.x()*0.5f), 0.0f);
- }
- }
- if (_deltas.y() > 0.0001f) {
- if ((uint(_gravity) uint(ewol::gravity_buttom)) != 0) {
- // nothing to do
- } else if ((uint(_gravity) uint(ewol::gravity_top)) != 0) {
- out += Vector2f(0.0f, int(_deltas.y()));
- } else {
- out += Vector2f(0.0f, int(_deltas.y()*0.5f));
- }
- }
- return out;
-}
-
-etk::Stream ewol::operator +(etk::Stream _os, enum ewol::gravity _obj) {
- _os + ewol::gravityToString(_obj);
- return _os;
-}
-
diff --git a/src/org/atriasoft/ewol/internal/LoadPackageStream.java b/src/org/atriasoft/ewol/internal/LoadPackageStream.java
new file mode 100644
index 0000000..2e37bf0
--- /dev/null
+++ b/src/org/atriasoft/ewol/internal/LoadPackageStream.java
@@ -0,0 +1,84 @@
+package org.atriasoft.ewol.internal;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystemNotFoundException;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Collections;
+import java.util.stream.Stream;
+
+public class LoadPackageStream {
+ public static byte[] getAllData(final String resourceName) {
+ Log.verbose("Load resource: '/resources" + resourceName + "'");
+ final InputStream out = LoadPackageStream.class.getResourceAsStream("/resources" + resourceName);
+ if (out == null) {
+ Log.error("Can not load resource: '" + resourceName + "'");
+ for (final Path elem : LoadPackageStream.getResources(LoadPackageStream.class.getResource("/resources")).toArray(Path[]::new)) {
+ Log.warning(" - '" + elem + "'");
+ }
+ return null;
+ }
+ byte[] data = null;
+ try {
+ data = out.readAllBytes();
+ } catch (final IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return data;
+ }
+
+ public static Stream getResources(final URL element) {
+ try {
+ final URI uri = element.toURI();
+ FileSystem fs;
+ Path path;
+ if (uri.getScheme().contentEquals("jar")) {
+ try {
+ fs = FileSystems.getFileSystem(uri);
+ } catch (final FileSystemNotFoundException e) {
+ fs = FileSystems.newFileSystem(uri, Collections. emptyMap());
+ }
+ String pathInJar = "/";
+ final String tmpPath = element.getPath();
+ final int idSeparate = tmpPath.indexOf('!');
+ if (idSeparate != -1) {
+ pathInJar = tmpPath.substring(idSeparate + 1);
+ while (pathInJar.startsWith("/")) {
+ pathInJar = pathInJar.substring(1);
+ }
+ }
+ path = fs.getPath(pathInJar);
+ } else {
+ fs = FileSystems.getDefault();
+ path = Paths.get(uri);
+ }
+ return Files.walk(path, 1);
+ } catch (URISyntaxException | IOException e) {
+ e.printStackTrace();
+ return Stream.of();
+ }
+ }
+
+ public static InputStream getStream(final String resourceName) {
+ Log.verbose("Load resource: '/resources" + resourceName + "'");
+ final InputStream out = LoadPackageStream.class.getResourceAsStream("/resources" + resourceName);
+ if (out == null) {
+ Log.error("Can not load resource: '" + resourceName + "'");
+ for (final Path elem : LoadPackageStream.getResources(LoadPackageStream.class.getResource("/resources")).toArray(Path[]::new)) {
+ Log.warning(" - '" + elem + "'");
+ }
+ }
+ return out;
+ }
+
+ private LoadPackageStream() {}
+
+}
diff --git a/src/org/atriasoft/ewol/internal/Tools.java b/src/org/atriasoft/ewol/internal/Tools.java
new file mode 100644
index 0000000..8170e7f
--- /dev/null
+++ b/src/org/atriasoft/ewol/internal/Tools.java
@@ -0,0 +1,22 @@
+package org.atriasoft.ewol.internal;
+
+public class Tools {
+ /**
+ * @brief get the next power 2 if the input
+ * @param[in] value Value that we want the next power of 2
+ * @return result value
+ */
+ public 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;
+ }
+
+ private Tools() {}
+}
diff --git a/src/org/atriasoft/ewol/object/EwolObject.java b/src/org/atriasoft/ewol/object/EwolObject.java
index 92b9813..37ffeec 100644
--- a/src/org/atriasoft/ewol/object/EwolObject.java
+++ b/src/org/atriasoft/ewol/object/EwolObject.java
@@ -2,6 +2,7 @@ package org.atriasoft.ewol.object;
import java.lang.ref.WeakReference;
+import org.atriasoft.ewol.Ewol;
import org.atriasoft.ewol.context.EwolContext;
import org.atriasoft.ewol.internal.Log;
@@ -13,7 +14,7 @@ import org.atriasoft.ewol.internal.Log;
/**
* @brief Basic message classes for ewol system
- * this class mermit at every Object to communicate between them.
+ * this class permit at every Object to communicate between them.
*/
public class EwolObject {
private static Integer valUID = 0; //!< Static used for the unique ID definition
@@ -34,18 +35,18 @@ public class EwolObject {
return Ewol.getContext().getEObjectManager();
}
- /**
- * @brief Retrive an object with his name (in the global list)
- * @param[in] _name Name of the object
- * @return the requested object or null
- */
+ /**
+ * @brief Retrive an object with his name (in the global list)
+ * @param[in] _name Name of the object
+ * @return the requested object or null
+ */
public static EwolObject getObjectNamed(final String _objectName) {
return getObjectManager().getObjectNamed(_objectName);
}
//@EwolPropertyDescription("Object name, might be a unique reference in all the program")
//@JacksonXmlProperty(isAttribute = true, localName = "name")
- private String name = ""; //!< name of the element ...
+ protected String name = ""; //!< name of the element ...
protected WeakReference parent = null; //!< Reference on the current parent.
@@ -180,8 +181,8 @@ public class EwolObject {
* @return the requested object or null
*/
public EwolObject getSubObjectNamed(final String _objectName) {
- Log.verbose("check if name : " + _objectName + " ?= " + this.propertyName);
- if (_objectName == this.propertyName) {
+ Log.verbose("check if name : " + _objectName + " ?= " + this.name);
+ if (_objectName == this.name) {
return this;
}
return null;
diff --git a/src/org/atriasoft/ewol/object/Manager.cpp b/src/org/atriasoft/ewol/object/Manager.cpp
deleted file mode 100644
index daa2fee..0000000
--- a/src/org/atriasoft/ewol/object/Manager.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-/** @file
- * @author Edouard DUPIN
- * @copyright 2011, Edouard DUPIN, all right reserved
- * @license MPL v2.0 (see license file)
- */
-
-#include
-#include
-#include
-#include
-
-#include
-ETK_DECLARE_TYPE(ObjectManager);
-
-ObjectManager::Manager(EwolContext _context) :
- this.context(_context),
- periodicCall(this, "periodic", "Call every time system render"),
- this.applWakeUpTime(0),
- this.lastPeriodicCallTime(0) {
- Log.debug(" == > init Object-Manager");
- periodicCall.setPeriodic(true);
- // set the basic time properties :
- this.applWakeUpTime = echrono::Clock::now();
- this.lastPeriodicCallTime = this.applWakeUpTime;
-}
-
-ObjectManager::~Manager() {
- ethread::RecursiveLock lock(this.mutex);
- this.workerList.clear();
- boolean hasError = false;
- if (this.eObjectList.size()!=0) {
- Log.error("Must not have anymore eObject !!!");
- hasError = true;
- }
- if (hasError == true) {
- Log.error("Check if the function UnInit has been called !!!");
- }
- displayListObject();
-}
-
-void ObjectManager::displayListObject() {
- ethread::RecursiveLock lock(this.mutex);
- Log.info("List loaded object : ");
- for (auto it : this.eObjectList) {
- EwolObject element = it.lock();
- if (element != null) {
- Log.info(" [" + element.getId() + "] ref=" + element.useCount()-1 + " name='" + element.propertyName.get() + "' type=" + element.getObjectType());
- }
- }
-}
-
-void ObjectManager::unInit() {
- ethread::RecursiveLock lock(this.mutex);
- Log.debug(" == > Un-Init Object-Manager");
- if (this.workerList.size() > 0) {
- Log.debug(" == > Remove all workers");
- this.workerList.clear();
- }
- for (auto it : this.eObjectList) {
- EwolObject element = it.lock();
- if (element != null) {
- //it.removeObject();
- }
- }
- if (this.eObjectList.size() != 0) {
- Log.error("Have " + this.eObjectList.size() + " active Object");
- }
- this.eObjectList.clear();
-}
-
-void ObjectManager::add( EwolObject _object) {
- ethread::RecursiveLock lock(this.mutex);
- if (_object == null) {
- Log.error("try to add an inexistant Object in manager");
- }
- this.eObjectList.pushBack(_object);
-}
-
-int ObjectManager::getNumberObject() {
- ethread::RecursiveLock lock(this.mutex);
- return this.eObjectList.size();
-}
-
-// clean all Object that request an autoRemove ...
-void ObjectManager::cleanInternalRemoved() {
- ethread::RecursiveLock lock(this.mutex);
- int nbObject = this.eObjectList.size();
- Log.verbose("Clean Object List (if needed) : " + this.eObjectList.size() + " elements");
- auto it(this.eObjectList.begin());
- while (it != this.eObjectList.end()) {
- if (it.expired() == true) {
- it = this.eObjectList.erase(it);
- } else {
- ++it;
- }
- }
- if (this.eObjectList.size() != nbObject) {
- Log.verbose(" remove " + nbObject - this.eObjectList.size() + " deprecated objects");
- }
-}
-
-EwolObject ObjectManager::get( String _name) {
- ethread::RecursiveLock lock(this.mutex);
- if (_name == "") {
- return null;
- }
- for (auto it : this.eObjectList) {
- EwolObject element = it.lock();
- if ( element != null
- LOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOM element.propertyName.get() == _name) {
- return element;
- }
- }
- return null;
-}
-
-
-EwolObject ObjectManager::getObjectNamed( String _name) {
- ethread::RecursiveLock lock(this.mutex);
- return ObjectManager::get(_name);
-}
-
-
-void ObjectManager::workerAdd( EwolObject _worker) {
- ethread::RecursiveLock lock(this.mutex);
- this.workerList.pushBack(_worker);
-}
-
-void ObjectManager::workerRemove( EwolObject _worker) {
- ethread::RecursiveLock lock(this.mutex);
- auto it(this.workerList.begin());
- while (it != this.workerList.end()) {
- if (*it == _worker) {
- it = this.workerList.erase(it);
- } else {
- ++it;
- }
- }
-}
-
-void ObjectManager::timeCall( echrono::Clock _localTime) {
- ethread::RecursiveLock lock(this.mutex);
- echrono::Clock previousTime = this.lastPeriodicCallTime;
- this.lastPeriodicCallTime = _localTime;
- if (periodicCall.size() <= 0) {
- return;
- }
- echrono::Duration deltaTime = _localTime - previousTime;
- ewol::event::Time myTime(_localTime, this.applWakeUpTime, deltaTime, deltaTime);
- periodicCall.emit(myTime);
-}
-
-void ObjectManager::timeCallResume( echrono::Clock _localTime) {
- ethread::RecursiveLock lock(this.mutex);
- this.lastPeriodicCallTime = _localTime;
-}
-
-boolean ObjectManager::timeCallHave() {
- ethread::RecursiveLock lock(this.mutex);
- return periodicCall.size() > 0;
-}
diff --git a/src/org/atriasoft/ewol/object/Object.cpp b/src/org/atriasoft/ewol/object/Object.cpp
deleted file mode 100644
index e69de29..0000000
diff --git a/src/org/atriasoft/ewol/object/ObjectManager.java b/src/org/atriasoft/ewol/object/ObjectManager.java
index bd0ea9a..c3e4d43 100644
--- a/src/org/atriasoft/ewol/object/ObjectManager.java
+++ b/src/org/atriasoft/ewol/object/ObjectManager.java
@@ -6,12 +6,12 @@ import java.util.Iterator;
import java.util.List;
import org.atriasoft.echrono.Clock;
-import org.atriasoft.echrono.Steady;
+import org.atriasoft.echrono.Duration;
import org.atriasoft.echrono.Time;
import org.atriasoft.esignal.Signal;
import org.atriasoft.ewol.context.EwolContext;
+import org.atriasoft.ewol.event.EventTime;
import org.atriasoft.ewol.internal.Log;
-import org.atriasoft.gale.event.EventTime;
/** @file
* @author Edouard DUPIN
@@ -21,68 +21,33 @@ import org.atriasoft.gale.event.EventTime;
public class ObjectManager {
private final List> eObjectList = new ArrayList<>(); // all widget allocated == > all time increment ... never removed ...
- private final EwolContext context;
+ private EwolContext context = null;
+
+ private final List workerList = new ArrayList<>();
+
+ public final Signal periodicCall = new Signal<>();
+
+ private final Time applWakeUpTime; //!< Time of the application initialize
+
+ private Clock lastPeriodicCallTime; //!< last call time ...
public ObjectManager(final EwolContext _context) {
this.context = _context;
//periodicCall(this, "periodic", "Call every time system render");
Log.debug(" == > init Object-Manager");
- this.periodicCall.setPeriodic(true);
+ Log.todo("set this back ...");
+ //this.periodicCall.setPeriodic(true);
// set the basic time properties :
this.applWakeUpTime = Clock.now();
this.lastPeriodicCallTime = new Clock(this.applWakeUpTime.get());
}
- /**
- * @brief remove all resources (un-init) out of the destructor (due to the system implementation)
- */
- synchronized void unInit() {
- Log.debug(" == > Un-Init Object-Manager");
- if (this.workerList.size() > 0) {
- Log.debug(" == > Remove all workers");
- this.workerList.clear();
- }
- for (final WeakReference it : this.eObjectList) {
- final EwolObject element = it.get();
- if (element != null) {
- //it.removeObject();
- }
- }
- if (this.eObjectList.size() != 0) {
- Log.error("Have " + this.eObjectList.size() + " active Object");
- }
- this.eObjectList.clear();
- }
-
- /**
- * @brief Get the number of loaded object in the system
- * @return number of Object
- */
- synchronized
-
- int getNumberObject() {
- return this.eObjectList.size();
- }
-
- /**
- * @brief Display all object Open.
- */
- synchronized void displayListObject() {
- Log.info("List loaded object : ");
- for (final WeakReference it : this.eObjectList) {
- final EwolObject element = it.get();
- if (element != null) {
- Log.info(" [" + element.getId() + "] name='" + element.getName() + "' type=" + element.getClass().getCanonicalName());
- }
- }
- }
-
/**
* @brief Internal API that used only with Object toi reference itself in the manager.
* @note The manager remove the object when the refecence Low down 1 (last keeper)
* @param[in] _object Reference shared pointer on the object
*/
- private synchronized void add(final EwolObject _object) {
+ public synchronized void add(final EwolObject _object) {
if (_object == null) {
Log.error("try to add an inexistant Object in manager");
}
@@ -107,6 +72,19 @@ public class ObjectManager {
}
}
+ /**
+ * @brief Display all object Open.
+ */
+ public synchronized void displayListObject() {
+ Log.info("List loaded object : ");
+ for (final WeakReference it : this.eObjectList) {
+ final EwolObject element = it.get();
+ if (element != null) {
+ Log.info(" [" + element.getId() + "] name='" + element.getName() + "' type=" + element.getClass().getCanonicalName());
+ }
+ }
+ }
+
/**
* @brief Retrive an Object with his name
* @param[in] _name Name of the Object
@@ -125,16 +103,75 @@ public class ObjectManager {
return null;
}
+ /**
+ * @brief Get the number of loaded object in the system
+ * @return number of Object
+ */
+ public synchronized int getNumberObject() {
+ return this.eObjectList.size();
+ }
+
/**
* @brief retrive an object with his name
* @param[in] _name Name of the object
* @return the requested object or null
*/
public synchronized EwolObject getObjectNamed(final String _name) {
- return ObjectManager.get(_name);
+ return get(_name);
}
- private final List workerList = new ArrayList<>();
+ /**
+ * @brief Call every time we can with the current time
+ * @param[in] _localTime Current system Time.
+ */
+ public synchronized void timeCall(final Clock _localTime) {
+ final Clock previousTime = this.lastPeriodicCallTime;
+ this.lastPeriodicCallTime = _localTime;
+ if (this.periodicCall.size() <= 0) {
+ return;
+ }
+ final Duration deltaTime = new Duration(_localTime.get() - previousTime.get());
+
+ final EventTime myTime = new EventTime(_localTime, this.applWakeUpTime.toClock(), deltaTime, deltaTime);
+ this.periodicCall.emit(myTime);
+ }
+
+ /**
+ * @breif check if the Interface have some user that request a periodic call
+ * @return true, have some periodic event...
+ */
+ public synchronized boolean timeCallHave() {
+ return this.periodicCall.size() > 0;
+ }
+
+ /**
+ * @brief If the application is suspended The Ewol Object manager does not know it, just call this to update delta call
+ * @param[in] _localTime Current system Time.
+ */
+ public synchronized void timeCallResume(final Clock _localTime) {
+ this.lastPeriodicCallTime = _localTime;
+ }
+
+ /**
+ * @brief remove all resources (un-init) out of the destructor (due to the system implementation)
+ */
+ public synchronized void unInit() {
+ Log.debug(" == > Un-Init Object-Manager");
+ if (this.workerList.size() > 0) {
+ Log.debug(" == > Remove all workers");
+ this.workerList.clear();
+ }
+ for (final WeakReference it : this.eObjectList) {
+ final EwolObject element = it.get();
+ if (element != null) {
+ //it.removeObject();
+ }
+ }
+ if (this.eObjectList.size() != 0) {
+ Log.error("Have " + this.eObjectList.size() + " active Object");
+ }
+ this.eObjectList.clear();
+ }
/**
* @brief Add a worker on the system list.
@@ -159,41 +196,4 @@ public class ObjectManager {
}
}
- public final Signal periodicCall = new Signal<>();
-
- private final Time applWakeUpTime; //!< Time of the application initialize
- private Clock lastPeriodicCallTime; //!< last call time ...
-
- /**
- * @brief Call every time we can with the current time
- * @param[in] _localTime Current system Time.
- */
- public synchronized void timeCall( final Clock _localTime){
- final Clock previousTime = this.lastPeriodicCallTime;
- this.lastPeriodicCallTime = _localTime;
- if (this.periodicCall.size() <= 0) {
- return;
- }
- final Duration deltaTime = new Duration(_localTime.get() - previousTime.get());
-
- final EventTime myTime(final _localTime, this.applWakeUpTime, deltaTime, deltaTime);
- this.periodicCall.emit(myTime);
- }
-
- /**
- * @brief If the application is suspended The Ewol Object manager does not know it, just call this to update delta call
- * @param[in] _localTime Current system Time.
- */
- public synchronized void timeCallResume(final Clock _localTime) {
- this.lastPeriodicCallTime = _localTime;
- }
-
- /**
- * @breif check if the Interface have some user that request a periodic call
- * @return true, have some periodic event...
- */
- public synchronized boolean timeCallHave() {
- return this.periodicCall.size() > 0;
- }
-
}
diff --git a/src/org/atriasoft/ewol/object/Worker.cpp b/src/org/atriasoft/ewol/object/Worker.cpp
deleted file mode 100644
index e9d87c8..0000000
--- a/src/org/atriasoft/ewol/object/Worker.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/** @file
- * @author Edouard DUPIN
- * @copyright 2011, Edouard DUPIN, all right reserved
- * @license MPL v2.0 (see license file)
- */
-
-#include
-#include
-#include
-#include
-ETK_DECLARE_TYPE(ewol::object::Worker);
-
-ewol::object::Worker::Worker() {
- addObjectType("ewol::Worker");
-}
-
-void ewol::object::Worker::init() {
- EwolObject::init();
- getObjectManager().workerAdd(sharedFromThis());
-}
-
-ewol::object::Worker::~Worker() {
- // nothing to do ...
-}
-
-void ewol::object::Worker::destroy() {
- EwolObject::destroy();
- getObjectManager().workerRemove(sharedFromThis());
-}
diff --git a/src/org/atriasoft/ewol/resource/ColorFile.cpp b/src/org/atriasoft/ewol/resource/ColorFile.cpp
deleted file mode 100644
index e497e58..0000000
--- a/src/org/atriasoft/ewol/resource/ColorFile.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/** @file
- * @author Edouard DUPIN
- * @copyright 2011, Edouard DUPIN, all right reserved
- * @license MPL v2.0 (see license file)
- */
-
-#include
-#include
-#include
-#include
-#include
-ETK_DECLARE_TYPE(ewol::resource::ColorFile);
-
-ewol::resource::ColorFile::ColorFile() :
- gale::Resource(),
- // Set the list unodered
- this.list(0, false),
- this.errorColor(etk::color::orange) {
- addResourceType("ewol::ColorFile");
-}
-
-void ewol::resource::ColorFile::init( etk::Uri _uri) {
- ethread::RecursiveLock lock(this.mutex);
- gale::Resource::init(_uri.get());
- Log.debug("CF : load \"" + _uri + "\"");
- reload();
- Log.debug("List of all color : " + this.list.getKeys());
-}
-
-ewol::resource::ColorFile::~ColorFile() {
- // remove all element
- this.list.clear();
-}
-
-
-void ewol::resource::ColorFile::reload() {
- ethread::RecursiveLock lock(this.mutex);
- // remove all previous set of value :
- for (int iii = 0; iii < this.list.size() ; ++iii) {
- this.list.getValue(iii) = this.errorColor;
- }
- // open and read all json elements:
- ejson::Document doc;
- if (doc.load(etk::Uri(this.name)) == false) {
- Log.error("Can not load file : '" + this.name + "'");
- return;
- }
- ejson::Array baseArray = doc["color"].toArray();
- if (baseArray.exist() == false) {
- Log.error("Can not get basic array : 'color' in file:" + this.name);
- doc.display();
- return;
- }
- boolean findError = false;
- for ( auto it : baseArray) {
- ejson::Object tmpObj = it.toObject();
- if (tmpObj.exist() == false) {
- Log.error(" can not get object in 'color' : " + it);
- findError = true;
- continue;
- }
- String name = tmpObj["name"].toString().get();
- String color = tmpObj["color"].toString().get(this.errorColor.getHexString());
- Log.debug("find new color : '" + name + "' color='" + color + "'");
- if (name.size() == 0) {
- Log.error("Drop an empty name");
- findError = true;
- continue;
- }
- this.list.add(name, etk::Color(color));
- }
- if (findError == true) {
- Log.error("pb in parsing file:" + this.name);
- doc.display();
- }
-}
-
-
-int ewol::resource::ColorFile::request( String _paramName) {
- ethread::RecursiveLock lock(this.mutex);
- // check if the parameters existed :
- if (this.list.exist(_paramName) == false) {
- this.list.add(_paramName, this.errorColor);
- }
- return this.list.getId(_paramName);
-}
diff --git a/src/org/atriasoft/ewol/resource/ColorFile.java b/src/org/atriasoft/ewol/resource/ColorFile.java
deleted file mode 100644
index f49e51b..0000000
--- a/src/org/atriasoft/ewol/resource/ColorFile.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/** @file
- * @author Edouard DUPIN
- * @copyright 2011, Edouard DUPIN, all right reserved
- * @license MPL v2.0 (see license file)
- */
-#pragma once
-
-#include
-#include
-#include
-#include
-#include
-
-namespace ewol {
- namespace resource {
- /**
- * @brief ColorFile is a Resource designed to be specific with the theme (for example black, or white or orange ...)
- */
- class ColorFile : public gale::Resource {
- private:
- etk::Map > this.list; //!< List of all color in the file
- etk::Color this.errorColor; //!< Error returned color
- protected:
- /**
- * @brief Constructor of the color property file
- * @param[in] _uri Name of the file needed
- */
- ColorFile();
- void init( etk::Uri _uri);
- public:
- DECLARE_RESOURCE_URI_FACTORY(ColorFile);
- /**
- * @brief Simple Destructor of this class (nothing specific ...)
- */
- ~ColorFile();
- public:
- /**
- * @brief Set the error color.
- * @param[in] _errorColor Color that might be set when not finding a color
- */
- void setErrorColor( etk::Color _errorColor) {
- this.errorColor = _errorColor;
- }
- /**
- * @brief Request the presence of a specific color.
- * @param[in] _paramName Name of the color.
- * @return A unique ID of the color (or -1 if an error occured).
- */
- int request( String _paramName);
- /**
- * @brief Get the associated color of the ID.
- * @param[in] _Id Id of the color.
- * @return The requested color.
- */
- etk::Color get(int _id) {
- if (_id < 0) {
- return this.errorColor;
- }
- return this.list.getValue(_id);
- };
- /**
- * @brief Get All color name
- * @return list of all color existing
- */
- List getColors() {
- return this.list.getKeys();
- }
- public: // herited function:
- void reload();
- };
- };
-};
-
diff --git a/src/org/atriasoft/ewol/resource/Colored3DObject.cpp b/src/org/atriasoft/ewol/resource/Colored3DObject.cpp
deleted file mode 100644
index 522066f..0000000
--- a/src/org/atriasoft/ewol/resource/Colored3DObject.cpp
+++ /dev/null
@@ -1,527 +0,0 @@
-/** @file
- * @author Edouard DUPIN
- * @copyright 2011, Edouard DUPIN, all right reserved
- * @license MPL v2.0 (see license file)
- */
-
-#ifndef __TARGET_OS__Web
-
-#include
-#include
-#include
-#include
-#include
-
-#include
-ETK_DECLARE_TYPE(ewol::resource::Colored3DObject);
-
-ewol::resource::Colored3DObject::Colored3DObject() :
- this.GLprogram(null) {
- addResourceType("ewol::Colored3DObject");
-}
-
-void ewol::resource::Colored3DObject::init() {
- gale::Resource::init();
- // get the shader resource :
- this.GLPosition = 0;
- this.GLprogram = gale::resource::Program::create("DATA:///simple3D.prog?lib=ewol");
- if (this.GLprogram != null) {
- this.GLPosition = this.GLprogram.getAttribute("EW_coord3d");
- this.GLColor = this.GLprogram.getUniform("EW_color");
- this.GLMatrix = this.GLprogram.getUniform("EW_MatrixTransformation");
- }
-}
-
-ewol::resource::Colored3DObject::~Colored3DObject() {
-
-}
-
-
-void ewol::resource::Colored3DObject::draw( List _vertices,
- etk::Color _color,
- boolean _updateDepthBuffer,
- boolean _depthtest) {
- if (_vertices.size() <= 0) {
- return;
- }
- if (this.GLprogram == null) {
- Log.error("No shader ...");
- return;
- }
- if (true == _depthtest) {
- gale::openGL::enable(gale::openGL::flag_depthTest);
- if (false == _updateDepthBuffer) {
- glDepthMask(GL_FALSE);
- }
- }
- //Log.debug(" display " + this.coord.size() + " elements" );
- this.GLprogram.use();
- // set Matrix: translation/positionMatrix
- mat4 projMatrix = gale::openGL::getMatrix();
- mat4 camMatrix = gale::openGL::getCameraMatrix();
- mat4 tmpMatrix = projMatrix * camMatrix;
- this.GLprogram.uniformMatrix(this.GLMatrix, tmpMatrix);
- // position :
- this.GLprogram.sendAttribute(this.GLPosition, 3/*x,y,z,unused*/, _vertices[0], 4*sizeof(float));
- // color :
- this.GLprogram.uniform4fv(this.GLColor, 1/*r,g,b,a*/, (float*)_color);
- // Request the draw od the elements:
- gale::openGL::drawArrays(gale::openGL::renderMode::triangle, 0, _vertices.size());
- this.GLprogram.unUse();
- // Request the draw od the elements:
- //glDrawArrays(GL_LINES, 0, vertices.size());
- //this.GLprogram.UnUse();
- if (true == _depthtest) {
- if (false == _updateDepthBuffer) {
- glDepthMask(GL_TRUE);
- }
- gale::openGL::disable(gale::openGL::flag_depthTest);
- }
-}
-
-void ewol::resource::Colored3DObject::draw( List _vertices,
- etk::Color _color,
- mat4 _transformationMatrix,
- boolean _updateDepthBuffer,
- boolean _depthtest) {
- if (_vertices.size() <= 0) {
- return;
- }
- if (this.GLprogram == null) {
- Log.error("No shader ...");
- return;
- }
- if (true == _depthtest) {
- gale::openGL::enable(gale::openGL::flag_depthTest);
- if (false == _updateDepthBuffer) {
- glDepthMask(GL_FALSE);
- }
- }
- //Log.debug(" display " + this.coord.size() + " elements" );
- this.GLprogram.use();
- // set Matrix: translation/positionMatrix
- mat4 projMatrix = gale::openGL::getMatrix();
- mat4 camMatrix = gale::openGL::getCameraMatrix();
- mat4 tmpMatrix = projMatrix * camMatrix * _transformationMatrix;
- this.GLprogram.uniformMatrix(this.GLMatrix, tmpMatrix);
- // position :
- this.GLprogram.sendAttribute(this.GLPosition, 3/*x,y,z*/, _vertices[0], 4*sizeof(float));
- // color :
- this.GLprogram.uniform4fv(this.GLColor, 1/*r,g,b,a*/, (float*)_color);
- // Request the draw od the elements:
- gale::openGL::drawArrays(gale::openGL::renderMode::triangle, 0, _vertices.size());
- this.GLprogram.unUse();
- if (true == _depthtest) {
- if (false == _updateDepthBuffer) {
- glDepthMask(GL_TRUE);
- }
- gale::openGL::disable(gale::openGL::flag_depthTest);
- }
-}
-
-void ewol::resource::Colored3DObject::drawLine(List _vertices,
- etk::Color _color,
- mat4 _transformationMatrix,
- boolean _updateDepthBuffer,
- boolean _depthtest) {
- if (_vertices.size() <= 0) {
- return;
- }
- if (this.GLprogram == null) {
- Log.error("No shader ...");
- return;
- }
- if (true == _depthtest) {
- gale::openGL::enable(gale::openGL::flag_depthTest);
- if (false == _updateDepthBuffer) {
- glDepthMask(GL_FALSE);
- }
- }
- //Log.debug(" display " + this.coord.size() + " elements" );
- this.GLprogram.use();
- // set Matrix: translation/positionMatrix
- mat4 projMatrix = gale::openGL::getMatrix();
- mat4 camMatrix = gale::openGL::getCameraMatrix();
- mat4 tmpMatrix = projMatrix * camMatrix * _transformationMatrix;
- this.GLprogram.uniformMatrix(this.GLMatrix, tmpMatrix);
- // position :
- this.GLprogram.sendAttribute(this.GLPosition, 3/*x,y,z*/, _vertices[0], 4*sizeof(float));
- // color :
- this.GLprogram.uniform4fv(this.GLColor, 1/*r,g,b,a*/, (float*)_color);
- // Request the draw od the elements:
- gale::openGL::drawArrays(gale::openGL::renderMode::line, 0, _vertices.size());
- this.GLprogram.unUse();
- if (true == _depthtest) {
- if (false == _updateDepthBuffer) {
- glDepthMask(GL_TRUE);
- }
- gale::openGL::disable(gale::openGL::flag_depthTest);
- }
-}
-
-
-void ewol::resource::Colored3DObject::drawCubeLine( Vector3f _min,
- Vector3f _max,
- etk::Color _color,
- mat4 _transformationMatrix,
- boolean _updateDepthBuffer,
- boolean _depthtest) {
- List vertices;
- vertices.pushBack(Vector3f(_min.x(), _min.y(),_min.z()));
- vertices.pushBack(Vector3f(_max.x(), _min.y(),_min.z()));
-
- vertices.pushBack(Vector3f(_max.x(), _min.y(),_min.z()));
- vertices.pushBack(Vector3f(_max.x(), _min.y(),_max.z()));
-
- vertices.pushBack(Vector3f(_max.x(), _min.y(),_max.z()));
- vertices.pushBack(Vector3f(_min.x(), _min.y(),_max.z()));
-
- vertices.pushBack(Vector3f(_min.x(), _min.y(),_max.z()));
- vertices.pushBack(Vector3f(_min.x(), _min.y(),_min.z()));
-
-
- vertices.pushBack(Vector3f(_min.x(), _max.y(),_min.z()));
- vertices.pushBack(Vector3f(_max.x(), _max.y(),_min.z()));
-
- vertices.pushBack(Vector3f(_max.x(), _max.y(),_min.z()));
- vertices.pushBack(Vector3f(_max.x(), _max.y(),_max.z()));
-
- vertices.pushBack(Vector3f(_max.x(), _max.y(),_max.z()));
- vertices.pushBack(Vector3f(_min.x(), _max.y(),_max.z()));
-
- vertices.pushBack(Vector3f(_min.x(), _max.y(),_max.z()));
- vertices.pushBack(Vector3f(_min.x(), _max.y(),_min.z()));
-
-
- vertices.pushBack(Vector3f(_min.x(), _min.y(),_min.z()));
- vertices.pushBack(Vector3f(_min.x(), _max.y(),_min.z()));
-
- vertices.pushBack(Vector3f(_max.x(), _min.y(),_min.z()));
- vertices.pushBack(Vector3f(_max.x(), _max.y(),_min.z()));
-
- vertices.pushBack(Vector3f(_max.x(), _min.y(),_max.z()));
- vertices.pushBack(Vector3f(_max.x(), _max.y(),_max.z()));
-
- vertices.pushBack(Vector3f(_min.x(), _min.y(),_max.z()));
- vertices.pushBack(Vector3f(_min.x(), _max.y(),_max.z()));
-
- drawLine(vertices, _color, _transformationMatrix, _updateDepthBuffer, _depthtest);
-}
-
-void ewol::resource::Colored3DObject::drawSquare( Vector3f _size,
- mat4 _transformationMatrix,
- etk::Color _tmpColor) {
- List tmpVertices;
- static int indices[36] = { 0,1,2, 3,2,1, 4,0,6,
- 6,0,2, 5,1,4, 4,1,0,
- 7,3,1, 7,1,5, 5,4,7,
- 7,4,6, 7,2,3, 7,6,2};
- Vector3f vertices[8]={ Vector3f(_size[0],_size[1],_size[2]),
- Vector3f(-_size[0],_size[1],_size[2]),
- Vector3f(_size[0],-_size[1],_size[2]),
- Vector3f(-_size[0],-_size[1],_size[2]),
- Vector3f(_size[0],_size[1],-_size[2]),
- Vector3f(-_size[0],_size[1],-_size[2]),
- Vector3f(_size[0],-_size[1],-_size[2]),
- Vector3f(-_size[0],-_size[1],-_size[2])};
- tmpVertices.clear();
- for (int iii=0 ; iii<36 ; iii+=3) {
- // normal calculation :
- //btVector3 normal = (vertices[indices[iii+2]]-vertices[indices[iii]]).cross(vertices[indices[iii+1]]-vertices[indices[iii]]);
- //normal.normalize ();
- tmpVertices.pushBack(vertices[indices[iii]]);
- tmpVertices.pushBack(vertices[indices[iii+1]]);
- tmpVertices.pushBack(vertices[indices[iii+2]]);
- }
- draw(tmpVertices, _tmpColor, _transformationMatrix);
-}
-
-void ewol::resource::Colored3DObject::drawSphere(float _radius,
- int _lats,
- int _longs,
- mat4 _transformationMatrix,
- etk::Color _tmpColor) {
- List tmpVertices;
- for(int iii=0; iii<=_lats; ++iii) {
- float lat0 = M_PI * (-0.5f + float(iii - 1) / _lats);
- float z0 = _radius*sin(lat0);
- float zr0 = _radius*cos(lat0);
-
- float lat1 = M_PI * (-0.5f + float(iii) / _lats);
- float z1 = _radius*sin(lat1);
- float zr1 = _radius*cos(lat1);
-
- for(int jjj=0; jjj<_longs; ++jjj) {
- float lng = 2.0f * M_PI * float(jjj - 1) / _longs;
- float x = cos(lng);
- float y = sin(lng);
- Vector3f v1 = Vector3f(x * zr1, y * zr1, z1);
- Vector3f v4 = Vector3f(x * zr0, y * zr0, z0);
-
- lng = 2 * M_PI * float(jjj) / _longs;
- x = cos(lng);
- y = sin(lng);
- Vector3f v2 = Vector3f(x * zr1, y * zr1, z1);
- Vector3f v3 = Vector3f(x * zr0, y * zr0, z0);
-
- tmpVertices.pushBack(v1);
- tmpVertices.pushBack(v2);
- tmpVertices.pushBack(v3);
-
- tmpVertices.pushBack(v1);
- tmpVertices.pushBack(v3);
- tmpVertices.pushBack(v4);
- }
- }
- draw(tmpVertices, _tmpColor, _transformationMatrix);
-}
-void ewol::resource::Colored3DObject::drawCylinder(float _radius,
- float _size,
- int _lats,
- int _longs,
- mat4 _transformationMatrix,
- etk::Color _tmpColor) {
- List tmpVertices;
- // center to border (TOP)
-
- // center to border (TOP)
- for(int jjj=0; jjj<_longs; ++jjj) {
- float lng = 2.0f * M_PI * float(jjj - 1) / _longs;
-
- float z = _size*0.5f;
- Vector3f v1 = Vector3f(0.0f, 0.0f, z);
-
- float x = cos(lng)*_radius;
- float y = sin(lng)*_radius;
- Vector3f v2 = Vector3f(x, y, z);
-
- lng = 2.0f * M_PI * float(jjj) / _longs;
- x = cos(lng)*_radius;
- y = sin(lng)*_radius;
- Vector3f v3 = Vector3f(x, y, z);
- tmpVertices.pushBack(v1);
- tmpVertices.pushBack(v3);
- tmpVertices.pushBack(v2);
- }
- // Cylinder
- for(int jjj=0; jjj<_longs; ++jjj) {
- float lng = 2.0f * M_PI * float(jjj - 1) / _longs;
-
- float z = _size*0.5f;
-
- float x = cos(lng)*_radius;
- float y = sin(lng)*_radius;
- Vector3f v2 = Vector3f(x, y, z);
- Vector3f v2b = Vector3f(x, y, -z);
-
- lng = 2.0f * M_PI * float(jjj) / _longs;
- x = cos(lng)*_radius;
- y = sin(lng)*_radius;
- Vector3f v3 = Vector3f(x, y, z);
- Vector3f v3b = Vector3f(x, y, -z);
-
- tmpVertices.pushBack(v2);
- tmpVertices.pushBack(v3);
- tmpVertices.pushBack(v3b);
-
- tmpVertices.pushBack(v2);
- tmpVertices.pushBack(v3b);
- tmpVertices.pushBack(v2b);
- }
- // center to border (BUTTOM)
- for(int jjj=0; jjj<_longs; ++jjj) {
- float lng = 2.0f * M_PI * float(jjj - 1) / _longs;
-
- float z = _size*-0.5f;
- Vector3f v1 = Vector3f(0.0f, 0.0f, z);
-
- float x = cos(lng)*_radius;
- float y = sin(lng)*_radius;
- Vector3f v2 = Vector3f(x, y, z);
-
- lng = 2.0f * M_PI * float(jjj) / _longs;
- x = cos(lng)*_radius;
- y = sin(lng)*_radius;
- Vector3f v3 = Vector3f(x, y, z);
- tmpVertices.pushBack(v1);
- tmpVertices.pushBack(v2);
- tmpVertices.pushBack(v3);
- }
- draw(tmpVertices, _tmpColor, _transformationMatrix);
-}
-void ewol::resource::Colored3DObject::drawCapsule(float _radius,
- float _size,
- int _lats,
- int _longs,
- mat4 _transformationMatrix,
- etk::Color _tmpColor) {
- List tmpVertices;
- _lats = int(_lats / 2)*2;
-
- // center to border (TOP)
- float offset = _size*0.5f;
- for(int iii=_lats/2+1; iii<=_lats; ++iii) {
- float lat0 = M_PI * (-0.5f + float(iii - 1) / _lats);
- float z0 = _radius*sin(lat0);
- float zr0 = _radius*cos(lat0);
-
- float lat1 = M_PI * (-0.5f + float(iii) / _lats);
- float z1 = _radius*sin(lat1);
- float zr1 = _radius*cos(lat1);
-
- for(int jjj=0; jjj<_longs; ++jjj) {
- float lng = 2.0f * M_PI * float(jjj - 1) / _longs;
- float x = cos(lng);
- float y = sin(lng);
- Vector3f v1 = Vector3f(x * zr1, y * zr1, z1+offset);
- Vector3f v4 = Vector3f(x * zr0, y * zr0, z0+offset);
-
- lng = 2 * M_PI * float(jjj) / _longs;
- x = cos(lng);
- y = sin(lng);
- Vector3f v2 = Vector3f(x * zr1, y * zr1, z1+offset);
- Vector3f v3 = Vector3f(x * zr0, y * zr0, z0+offset);
- tmpVertices.pushBack(v1);
- tmpVertices.pushBack(v2);
- tmpVertices.pushBack(v3);
-
- tmpVertices.pushBack(v1);
- tmpVertices.pushBack(v3);
- tmpVertices.pushBack(v4);
- }
- }
- // Cylinder
- for(int jjj=0; jjj<_longs; ++jjj) {
- float lng = 2.0f * M_PI * float(jjj - 1) / _longs;
-
- float z = _size*0.5f;
-
- float x = cos(lng)*_radius;
- float y = sin(lng)*_radius;
- Vector3f v2 = Vector3f(x, y, z);
- Vector3f v2b = Vector3f(x, y, -z);
-
- lng = 2.0f * M_PI * float(jjj) / _longs;
- x = cos(lng)*_radius;
- y = sin(lng)*_radius;
- Vector3f v3 = Vector3f(x, y, z);
- Vector3f v3b = Vector3f(x, y, -z);
-
- tmpVertices.pushBack(v2);
- tmpVertices.pushBack(v3);
- tmpVertices.pushBack(v3b);
-
- tmpVertices.pushBack(v2);
- tmpVertices.pushBack(v3b);
- tmpVertices.pushBack(v2b);
- }
- // center to border (BUTTOM)
- offset = -_size*0.5f;
- for(int iii=0; iii<=_lats/2; ++iii) {
- float lat0 = M_PI * (-0.5f + float(iii - 1) / _lats);
- float z0 = _radius*sin(lat0);
- float zr0 = _radius*cos(lat0);
-
- float lat1 = M_PI * (-0.5f + float(iii) / _lats);
- float z1 = _radius*sin(lat1);
- float zr1 = _radius*cos(lat1);
-
- for(int jjj=0; jjj<_longs; ++jjj) {
- float lng = 2.0f * M_PI * float(jjj - 1) / _longs;
- float x = cos(lng);
- float y = sin(lng);
- Vector3f v1 = Vector3f(x * zr1, y * zr1, z1+offset);
- Vector3f v4 = Vector3f(x * zr0, y * zr0, z0+offset);
-
- lng = 2 * M_PI * float(jjj) / _longs;
- x = cos(lng);
- y = sin(lng);
- Vector3f v2 = Vector3f(x * zr1, y * zr1, z1+offset);
- Vector3f v3 = Vector3f(x * zr0, y * zr0, z0+offset);
- tmpVertices.pushBack(v1);
- tmpVertices.pushBack(v2);
- tmpVertices.pushBack(v3);
-
- tmpVertices.pushBack(v1);
- tmpVertices.pushBack(v3);
- tmpVertices.pushBack(v4);
- }
- }
- draw(tmpVertices, _tmpColor, _transformationMatrix);
-}
-
-void ewol::resource::Colored3DObject::drawCone(float _radius,
- float _size,
- int _lats,
- int _longs,
- mat4 _transformationMatrix,
- etk::Color _tmpColor) {
- List tmpVertices;
- // center to border (TOP)
- for(int jjj=0; jjj<_longs; ++jjj) {
- float lng = 2.0f * M_PI * float(jjj - 1) / _longs;
- Vector3f v1 = Vector3f(0.0f, 0.0f, -_size/2);
-
- float x = cos(lng)*_radius;
- float y = sin(lng)*_radius;
- Vector3f v2 = Vector3f(x, y, _size/2);
-
- lng = 2.0f * M_PI * float(jjj) / _longs;
- x = cos(lng)*_radius;
- y = sin(lng)*_radius;
- Vector3f v3 = Vector3f(x, y, _size/2);
- tmpVertices.pushBack(v1);
- tmpVertices.pushBack(v3);
- tmpVertices.pushBack(v2);
- }
- // center to border (BUTTOM)
- for(int jjj=0; jjj<_longs; ++jjj) {
- float lng = 2.0f * M_PI * float(jjj - 1) / _longs;
-
- Vector3f v1 = Vector3f(0.0f, 0.0f, _size/2);
-
- float x = cos(lng)*_radius;
- float y = sin(lng)*_radius;
- Vector3f v2 = Vector3f(x, y, _size/2);
-
- lng = 2.0f * M_PI * float(jjj) / _longs;
- x = cos(lng)*_radius;
- y = sin(lng)*_radius;
- Vector3f v3 = Vector3f(x, y, _size/2);
- tmpVertices.pushBack(v1);
- tmpVertices.pushBack(v2);
- tmpVertices.pushBack(v3);
- }
- draw(tmpVertices, _tmpColor, _transformationMatrix);
-}
-
-void ewol::resource::Colored3DObject::drawTriangles( List _vertex,
- List _indice,
- mat4 _transformationMatrix,
- etk::Color _tmpColor,
- Vector3f _offset) {
- List tmpVertices;
- for (int iii=0; iii<_indice.size()/3; ++iii) {
- tmpVertices.pushBack(_vertex[_indice[iii*3 + 0]]+_offset);
- tmpVertices.pushBack(_vertex[_indice[iii*3 + 1]]+_offset);
- tmpVertices.pushBack(_vertex[_indice[iii*3 + 2]]+_offset);
- //Log.info(" indices " + _indice[iii*3 + 0] + " " + _indice[iii*3 + 1] + " " + _indice[iii*3 + 2]);
- //Log.info(" triangle " + _vertex[_indice[iii*3 + 0]] + " " + _vertex[_indice[iii*3 + 1]] + " " + _vertex[_indice[iii*3 + 2]]);
- }
- //Log.info("display " + tmpVertices.size() + " vertices form " + _indice.size());
- draw(tmpVertices, _tmpColor, _transformationMatrix);
-}
-
-namespace etk {
- template<> String toString(ewol::resource::Colored3DObject ) {
- return "!!ewol::resource::Colored3DObject!ERROR!CAN_NOT_BE_CONVERT!!";
- }
-}
-#include
-
-// declare for signal event
-ESIGNAL_DECLARE_SIGNAL(ewol::resource::Colored3DObject);
-ESIGNAL_DECLARE_SIGNAL(ememory::Ptr);
-
-#endif
-
diff --git a/src/org/atriasoft/ewol/resource/Colored3DObject.java b/src/org/atriasoft/ewol/resource/Colored3DObject.java
deleted file mode 100644
index 28caea8..0000000
--- a/src/org/atriasoft/ewol/resource/Colored3DObject.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/** @file
- * @author Edouard DUPIN
- * @copyright 2011, Edouard DUPIN, all right reserved
- * @license MPL v2.0 (see license file)
- */
-#pragma once
-
-#ifndef __TARGET_OS__Web
-
-#include
-#include
-#include
-#include
-
-namespace ewol {
- namespace resource {
- /**
- * @brief simple display of Colored3DObject ==> for DEBUG only Not availlable on ALL platform (like webGL)
- */
- class Colored3DObject : public gale::Resource {
- protected:
- ememory::Ptr this.GLprogram;
- int this.GLPosition;
- int this.GLMatrix;
- int this.GLColor;
- protected:
- Colored3DObject();
- void init();
- public:
- DECLARE_RESOURCE_FACTORY(Colored3DObject);
- ~Colored3DObject();
- public:
- void draw( List _vertices,
- etk::Color _color,
- boolean _updateDepthBuffer=true,
- boolean _depthtest=true);
- void draw( List _vertices,
- etk::Color _color,
- mat4 _transformationMatrix,
- boolean _updateDepthBuffer=true,
- boolean _depthtest=true);
- void drawLine(List _vertices,
- etk::Color _color,
- mat4 _transformationMatrix,
- boolean _updateDepthBuffer=true,
- boolean _depthtest=true);
- void drawCubeLine( Vector3f _min,
- Vector3f _max,
- etk::Color _color,
- mat4 _transformationMatrix,
- boolean _updateDepthBuffer=true,
- boolean _depthtest=true);
- public:
- void drawSquare( Vector3f _size,
- mat4 _transformationMatrix,
- etk::Color _tmpColor);
- void drawSphere(float _radius,
- int _lats,
- int _longs,
- mat4 _transformationMatrix,
- etk::Color _tmpColor);
- void drawCylinder(float _radius,
- float _size,
- int _lats,
- int _longs,
- mat4 _transformationMatrix,
- etk::Color _tmpColor);
- void drawCapsule(float _radius,
- float _size,
- int _lats,
- int _longs,
- mat4 _transformationMatrix,
- etk::Color _tmpColor);
- void drawCone(float _radius,
- float _size,
- int _lats,
- int _longs,
- mat4 _transformationMatrix,
- etk::Color _tmpColor);
- void drawTriangles( List _vertex,
- List _indice,
- mat4 _transformationMatrix,
- etk::Color _tmpColor,
- Vector3f _offset=Vector3f(0,0,0.1));
- };
- };
-};
-
-#endif
diff --git a/src/org/atriasoft/ewol/resource/ConfigFile.cpp b/src/org/atriasoft/ewol/resource/ConfigFile.cpp
deleted file mode 100644
index 9ae4b63..0000000
--- a/src/org/atriasoft/ewol/resource/ConfigFile.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/** @file
- * @author Edouard DUPIN
- * @copyright 2011, Edouard DUPIN, all right reserved
- * @license MPL v2.0 (see license file)
- */
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-ETK_DECLARE_TYPE(ewol::resource::ConfigFile);
-
-ewol::resource::ConfigFile::ConfigFile() :
- gale::Resource(),
- // set map unorderred
- this.list(0, false) {
- addResourceType("ewol::ConfigFile");
-}
-
-void ewol::resource::ConfigFile::init( etk::Uri _uri) {
- ethread::RecursiveLock lock(this.mutex);
- gale::Resource::init(_uri.get());
- Log.debug("SFP : load \"" + _uri + "\"");
- reload();
-}
-
-
-ewol::resource::ConfigFile::~ConfigFile() {
- this.list.clear();
-}
-
-void ewol::resource::ConfigFile::reload() {
- ethread::RecursiveLock lock(this.mutex);
- // reset all parameters
- for (int iii=0; iii
-#include
-#include
-#include
-#include
-
-namespace ewol {
- namespace resource {
- class ConfigFile : public gale::Resource {
- private:
- ejson::Document this.doc;
- etk::Map this.list;
- protected:
- ConfigFile();
- void init( etk::Uri _filename);
- public:
- ~ConfigFile();
- DECLARE_RESOURCE_URI_FACTORY(ConfigFile);
- public:
- void reload();
-
- int request( String _paramName);
-
- double getNumber(int _id);
- String getString(int _id);
- boolean getBoolean(int _id);
- public:
- /**
- * @brief keep the resource pointer.
- * @note Never free this pointer by your own...
- * @param[in] _filename Name of the configuration file.
- * @return pointer on the resource or null if an error occured.
- */
- static ememory::Ptr keep( String _filename);
- };
- };
-};
diff --git a/src/org/atriasoft/ewol/resource/DistanceFieldFont.cpp b/src/org/atriasoft/ewol/resource/DistanceFieldFont.cpp
deleted file mode 100644
index 3f8ff71..0000000
--- a/src/org/atriasoft/ewol/resource/DistanceFieldFont.cpp
+++ /dev/null
@@ -1,470 +0,0 @@
-/** @file
- * @author Edouard DUPIN
- * @copyright 2011, Edouard DUPIN, all right reserved
- * @license MPL v2.0 (see license file)
- */
-
-#include
-#include
-#include
-
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#define SIZE_GENERATION (30)
-
-#include
-ETK_DECLARE_TYPE(ewol::resource::DistanceFieldFont);
-
-ewol::resource::DistanceFieldFont::DistanceFieldFont() :
- ewol::resource::Texture(),
- this.borderSize(10),
- this.textureBorderSize(0,0) {
- addResourceType("ewol::resource::DistanceFieldFont");
- this.font = null;
- this.lastGlyphPos.setValue(1,1);
- this.lastRawHeigh = 0;
- this.sizeRatio = 1.0f;
-}
-
-/**
- * @brief Get all the Path contain in the specidy path:
- * @param[in] _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]
- */
-static List explodeMultiplePath( etk::Uri _uri) {
- List out;
- out.pushBack(_uri);
- if (_uri.getQuery().exist("lib") == true) {
- etk::Uri tmp = _uri;
- tmp.getQuery().erase("lib");
- out.pushBack(tmp);
- }
- return out;
-}
-
-void ewol::resource::DistanceFieldFont::init( String _fontName) {
- ethread::RecursiveLock lock(this.mutex);
- ewol::resource::Texture::init(_fontName);
- String localName = _fontName;
- List folderList;
- if (ewol::getContext().getFontDefault().getUseExternal() == true) {
- #if defined(__TARGET_OS__Android)
- folderList.pushBack(etk::Path("/system/fonts"));
- #elif defined(__TARGET_OS__Linux)
- folderList.pushBack(etk::Path("/usr/share/fonts"));
- #endif
- }
- etk::Uri applicationBaseFont = ewol::getContext().getFontDefault().getFolder();
- for (auto it : explodeMultiplePath(applicationBaseFont)) {
- folderList.pushBack(it);
- }
- for (int folderID = 0; folderID < folderList.size() ; folderID++) {
- List output = etk::uri::listRecursive(folderList[folderID]);
-
- List split = etk::split(localName, ';');
- Log.info("try to find font named : " + split + " in: " + output);
- //Log.critical("parse string : " + split);
- boolean hasFindAFont = false;
- for (int jjj=0; jjj maybe estimate it with the dpi ???
- setImageSize(Vector2i(512,32));
- // now we can acces directly on the image
- this.data.clear(etk::Color<>(0x00000000));
- // add error glyph
- addGlyph(0);
- // by default we set only the first AINSI char availlable
- for (int iii=0x20; iii<0x7F; iii++) {
- addGlyph(iii);
- }
- flush();
- if (true) {
- Log.error("Save in cache the loaded data ..... ");
- egami::store(this.data, "CACHE:///fileFont.bmp"); // ==> for debug test only ...
- egami::store(this.data, "CACHE:///fileFont.png");
- }
- exportOnFile();
-}
-
-ewol::resource::DistanceFieldFont::~DistanceFieldFont() {
-
-}
-
-
-float ewol::resource::DistanceFieldFont::getDisplayRatio(float _size) {
- ethread::RecursiveLock lock(this.mutex);
- return _size / (float)SIZE_GENERATION;
-}
-
-
-void ewol::resource::DistanceFieldFont::generateDistanceField( egami::ImageMono _input, egami::Image _output) {
- Log.info("Generate Distance field font [START]");
- Log.info(" _input.getSize()=" + _input.getSize());
- ethread::RecursiveLock lock(this.mutex);
- int size = _input.getSize().x() * _input.getSize().y();
- List xdist;
- List ydist;
- List gx;
- List gy;
- List data;
- List outside;
- List inside;
- xdist.resize(size, 0);
- ydist.resize(size, 0);
- gx.resize(size, 0.0);
- gy.resize(size, 0.0);
- data.resize(size, 0.0);
- outside.resize(size, 0.0);
- inside.resize(size, 0.0);
- Log.info(" size=" + size);
- // Convert img into double (data)
- double img_min = 255, img_max = -255;
- for (int yyy = 0; yyy < _input.getSize().y(); ++yyy) {
- for (int xxx = 0; xxx < _input.getSize().x(); ++xxx) {
- int iii = yyy * _input.getSize().x() + xxx;
- double v = _input.get(Vector2i(xxx, yyy));
- data[iii] = v;
- if (v > img_max) {
- img_max = v;
- }
- if (v < img_min) {
- img_min = v;
- }
- }
- }
- // Rescale image levels between 0 and 1
- for (int yyy = 0; yyy < _input.getSize().y(); ++yyy) {
- for (int xxx = 0; xxx < _input.getSize().x(); ++xxx) {
- int iii = yyy * _input.getSize().x() + xxx;
- data[iii] = (_input.get(Vector2i(xxx, yyy))-img_min)/img_max;
- }
- }
- // Compute outside = edtaa3(bitmap); % Transform background (0's)
- computegradient(data[0], _input.getSize().x(), _input.getSize().y(), gx[0], gy[0]);
- edtaa3(data[0], gx[0], gy[0], _input.getSize().x(), _input.getSize().y(), xdist[0], &ydist[0], &outside[0]);
- for(int iii = 0; iii < outside.size(); ++iii) {
- if( outside[iii] < 0 ) {
- outside[iii] = 0.0;
- }
- }
- // Compute inside = edtaa3(1-bitmap); % Transform foreground (1's)
- for(int iii = 0; iii < gx.size(); ++iii) {
- gx[iii] = 0;
- }
- for(int iii = 0; iii < gy.size(); ++iii) {
- gy[iii] = 0;
- }
- for(int iii = 0; iii < data.size(); ++iii) {
- data[iii] = 1 - data[iii];
- }
- computegradient( data[0], _input.getSize().x(), _input.getSize().y(), gx[0], gy[0]);
- edtaa3(data[0], gx[0], gy[0], _input.getSize().x(), _input.getSize().y(), xdist[0], &ydist[0], &inside[0]);
- for(int iii = 0; iii < inside.size(); ++iii) {
- if( inside[iii] < 0 ) {
- inside[iii] = 0.0;
- }
- }
- Log.info(" _output=" + _output);
- _output.resize(_input.getSize(), etk::Color<>(0));
- _output.clear(etk::Color<>(0));
- for (int xxx = 0; xxx < _output.getSize().x(); ++xxx) {
- for (int yyy = 0; yyy < _output.getSize().y(); ++yyy) {
- int iii = yyy * _output.getSize().x() + xxx;
- outside[iii] -= inside[iii];
- outside[iii] = 128+outside[iii]*16;
- if( outside[iii] < 0 ) {
- outside[iii] = 0;
- }
- if( outside[iii] > 255 ) {
- outside[iii] = 255;
- }
- int val = 255 - (unsigned char) outside[iii];
- // TODO : Remove multiple size of the map ...
- _output.set(Vector2i(xxx, yyy), etk::Color<>((int)val,(int)val,(int)val,255));
- }
- }
- Log.info(" _output=" + _output);
-}
-
-boolean ewol::resource::DistanceFieldFont::addGlyph( Character _val) {
- ethread::RecursiveLock lock(this.mutex);
- boolean hasChange = false;
- if (this.font == null) {
- return false;
- }
- // add the curent "char"
- GlyphProperty tmpchar;
- tmpchar.this.UVal = _val;
- egami::ImageMono imageGlyphRaw;
- egami::Image imageGlyphDistanceField(Vector2i(32,32), egami::colorType::RGBA8);
- Log.debug("Generate Glyph : " + _val);
-
- if (this.font.getGlyphProperty(SIZE_GENERATION, tmpchar) == true) {
- //Log.debug("load char: '" + _val + "'=" + _val);
- hasChange = true;
- // change line if needed ...
- if (this.lastGlyphPos.x() + tmpchar.this.sizeTexture.x()+this.borderSize*2.0 > this.data.getSize().x()) {
- this.lastGlyphPos.setX(1);
- this.lastGlyphPos += Vector2i(0, this.lastRawHeigh);
- this.lastRawHeigh = 0;
- }
- while(this.lastGlyphPos.y()+tmpchar.this.sizeTexture.y()+this.borderSize*2.0 > this.data.getSize().y()) {
- Vector2i size = this.data.getSize();
- size.setY(size.y()*2);
- Log.verbose("resize " + this.data.getSize() + " => " + size);
- this.data.resize(size, etk::Color<>(0));
- // change the coordonate on the element in the texture
- for (int jjj = 0; jjj < this.listElement.size(); ++jjj) {
- this.listElement[jjj].this.texturePosStart *= Vector2f(1.0f, 0.5f);
- this.listElement[jjj].this.texturePosSize *= Vector2f(1.0f, 0.5f);
- }
- }
- this.textureBorderSize = Vector2f(this.borderSize/(float)this.data.getSize().x(),
- this.borderSize/(float)this.data.getSize().y() );
- // draw the glyph
- this.font.drawGlyph(imageGlyphRaw, SIZE_GENERATION, tmpchar, this.borderSize);
-
- generateDistanceField(imageGlyphRaw, imageGlyphDistanceField);
-
- if (_val == 100) {
- Log.debug("print char: " + _val + " size=" + imageGlyphDistanceField.getSize());
- for (int yyy = 0; yyy < imageGlyphDistanceField.getSize().y(); ++yyy) {
- for (int xxx = 0; xxx < imageGlyphDistanceField.getSize().x(); ++xxx) {
- Log.print((int)(imageGlyphDistanceField.get(Vector2i(xxx, yyy)).r()) + " ");
- }
- }
- }
-
- this.data.insert(this.lastGlyphPos, imageGlyphDistanceField);
-
- // set image position
- tmpchar.this.texturePosStart.setValue( ((float)this.lastGlyphPos.x()+(this.borderSize*0.5f)) / (float)this.data.getSize().x(),
- ((float)this.lastGlyphPos.y()+(this.borderSize*0.5f)) / (float)this.data.getSize().y() );
- tmpchar.this.texturePosSize.setValue( ((float)imageGlyphRaw.getSize().x()-this.borderSize) / (float)this.data.getSize().x(),
- ((float)imageGlyphRaw.getSize().y()-this.borderSize) / (float)this.data.getSize().y() );
-
- // update the maximum of the line hight :
- if (this.lastRawHeigh < imageGlyphRaw.getSize().y()) {
- // note : +1 is for the overlapping of the glyph (Part 2)
- this.lastRawHeigh = imageGlyphRaw.getSize().y()+1;
- }
- // note : +1 is for the overlapping of the glyph (Part 3)
- // update the Bitmap position drawing :
- this.lastGlyphPos += Vector2i(imageGlyphRaw.getSize().x()+1, 0);
- } else {
- Log.warning("Did not find char : '" + _val + "'=" + _val);
- tmpchar.setNotExist();
- }
- this.listElement.pushBack(tmpchar);
- //this.font[iii].display();
- // generate the kerning for all the characters :
- if (tmpchar.exist() == true) {
- // TODO : set the kerning back ...
- //this.font[iii].generateKerning(this.size, this.listElement[iii]);
- }
- if (hasChange == true) {
- flush();
- //Log.error("Save in cache the loaded data ..... ");
- //egami::store(this.data, "CACHE:///fileFont.bmp"); // ==> for debug test only ...
- //egami::store(this.data, "CACHE:///fileFont.png");
- }
- return hasChange;
-}
-
-int ewol::resource::DistanceFieldFont::getIndex(Character _charcode) {
- ethread::RecursiveLock lock(this.mutex);
- if (_charcode < 0x20) {
- return 0;
- } else if (_charcode < 0x80) {
- return _charcode - 0x1F;
- } else {
- for (int iii=0x80-0x20; iii < this.listElement.size(); iii++) {
- //Log.debug("search : '" + charcode + "' =?= '" + (this.listElement[displayMode])[iii].this.UVal + "'");
- if (_charcode == (this.listElement)[iii].this.UVal) {
- //Log.debug("search : '" + charcode + "'");
- if ((this.listElement)[iii].exist()) {
- //Log.debug("return " + iii);
- return iii;
- } else {
- return 0;
- }
- }
- }
- }
- if (addGlyph(_charcode) == true) {
- // TODO : This does not work due to the fact that the update of open GL is not done in the context main cycle !!!
- ewol::getContext().forceRedrawAll();
- }
- return 0;
-}
-
-ewol::GlyphProperty* ewol::resource::DistanceFieldFont::getGlyphPointer( Character _charcode) {
- ethread::RecursiveLock lock(this.mutex);
- Log.verbose("getGlyphPointer : " + uint(_charcode));
- int index = getIndex(_charcode);
- if( index < 0
- || (int)index >= this.listElement.size() ) {
- Log.error(" Try to get glyph index inexistant ... == > return the index 0 ... id=" + index);
- if (this.listElement.size() > 0) {
- return ((this.listElement)[0]);
- }
- return null;
- }
- //Log.error(" index=" + index);
- //Log.error(" this.UVal=" + this.listElement[_displayMode][index].this.UVal);
- //Log.error(" this.glyphIndex=" + this.listElement[_displayMode][index].this.glyphIndex);
- //Log.error(" this.advance=" + this.listElement[_displayMode][index].this.advance);
- //Log.error(" this.bearing=" + this.listElement[_displayMode][index].this.bearing);
- return ((this.listElement)[index]);
-}
-
-void ewol::resource::DistanceFieldFont::exportOnFile() {
- ethread::RecursiveLock lock(this.mutex);
- Log.debug("EXPORT: DistanceFieldFont : file : '" + this.fileName + ".json'");
- ejson::Document doc;
- ejson::Array tmpList;
- for (int iii=0; iii
-#include
-#include
-
-namespace ewol {
- namespace resource {
- class DistanceFieldFont : public ewol::resource::Texture {
- private:
- etk::Uri this.fileName;
- float this.sizeRatio;
- // 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)
- ememory::Ptr this.font;
- public:
- List this.listElement;
- private:
- // for the texture generation :
- Vector2i this.lastGlyphPos;
- int this.lastRawHeigh;
- protected:
- DistanceFieldFont();
- void init( String _fontName);
- public:
- DECLARE_RESOURCE_NAMED_FACTORY(DistanceFieldFont);
- ~DistanceFieldFont();
- public:
- float getDisplayRatio(float _size);
- /**
- * @brief get the display height of this font
- * @param[in] _size Request font size
- * @return Dimention of the font need between 2 lines
- */
- float getHeight(float _size) {
- return ((float)this.font.getHeight(_size));
- };
- /**
- * @brief get the font size with a specific display size
- * @param[in] _fontHeight Request font height
- * @return Dimention of the font for this compleate line size.
- */
- float getSize(float _fontHeight) {
- return this.font.getSizeWithHeight(_fontHeight);
- }
- /**
- * @brief get the ID of a unicode charcode
- * @param[in] _charcode The unicodeValue
- * @return The ID in the table (if it does not exist : return 0)
- */
- int getIndex(Character _charcode);
- /**
- * @brief get the pointer on the coresponding glyph
- * @param[in] _charcode The unicodeValue
- * @return The pointer on the glyph == > never null
- */
- ewol::GlyphProperty* getGlyphPointer( Character _charcode);
- public:
- /**
- * @brief keep the resource pointer.
- * @note Never free this pointer by your own...
- * @param[in] _filename Name of the texture font.
- * @return pointer on the resource or null if an error occured.
- */
- static ememory::Ptr keep( String _filename);
- private:
- /**
- * @brief add a glyph in a texture font.
- * @param[in] _val Char value to add.
- * @return true if the image size have change, false otherwise
- */
- boolean addGlyph( Character _val);
-
- void generateDistanceField( egami::ImageMono _input, egami::Image _output);
- private:
- float this.borderSize; //!< number of pixel added on the border of a glyph
- Vector2f this.textureBorderSize; //!< Transformed the border size in the texture dimention
- public:
- float getPixelBorderSize() {
- return this.borderSize;
- }
- Vector2f getTextureBorderSize() {
- return this.textureBorderSize;
- }
- public:
- void exportOnFile();
- boolean importFromFile();
- };
- };
-};
diff --git a/src/org/atriasoft/ewol/resource/FontFreeType.cpp b/src/org/atriasoft/ewol/resource/FontFreeType.cpp
deleted file mode 100644
index 319ec63..0000000
--- a/src/org/atriasoft/ewol/resource/FontFreeType.cpp
+++ /dev/null
@@ -1,384 +0,0 @@
-/** @file
- * @author Edouard DUPIN
- * @copyright 2011, Edouard DUPIN, all right reserved
- * @license MPL v2.0 (see license file)
- */
-
-#include
-#include
-
-
-#include
-
-#include
-#include
-#include
-#include
-
-#include
-ETK_DECLARE_TYPE(ewol::resource::FontFreeType);
-
-// free Font hnadle of librairies ... entry for acces ...
-static int l_countLoaded=0;
-static FT_Library library;
-
-void ewol::resource::freeTypeInit() {
- Log.debug(" == > init Font-Manager");
- l_countLoaded++;
- if (l_countLoaded>1) {
- // already loaded ...
- return;
- }
- int error = FT_Init_FreeType( library );
- if(0 != error) {
- Log.critical(" when loading FreeType Librairy ...");
- }
-}
-
-void ewol::resource::freeTypeUnInit() {
- Log.debug(" == > Un-Init Font-Manager");
- l_countLoaded--;
- if (l_countLoaded>0) {
- // already needed ...
- return;
- }
- int error = FT_Done_FreeType( library );
- library = null;
- if(0 != error) {
- Log.critical(" when Un-loading FreeType Librairy ...");
- }
-}
-
-ewol::resource::FontFreeType::FontFreeType() {
- addResourceType("ewol::FontFreeType");
- this.init = false;
- this.FileSize = 0;
-}
-
-void ewol::resource::FontFreeType::init( etk::Uri _uri) {
- ethread::RecursiveLock lock(this.mutex);
- ewol::resource::FontBase::init(_uri);
- auto fileIO = etk::uri::get(_uri);
- if (fileIO == null) {
- Log.error("File Does not exist : " + _uri);
- return;
- }
- if (fileIO.open(etk::io::OpenMode::Read) == false) {
- Log.error("Can not open the file : " + _uri);
- return;
- }
- this.FileBuffer = fileIO.readAll();
- // close the file:
- fileIO.close();
- // load Face ...
- int error = FT_New_Memory_Face(library, this.FileBuffer[0], this.FileBuffer.size(), 0, this.fftFace );
- if( FT_Err_Unknown_File_Format == error) {
- Log.error("... the font file could be opened and read, but it appears ... that its font format is unsupported");
- } else if (0 != error) {
- Log.error("... another error code means that the font file could not ... be opened or read, or simply that it is broken...");
- } else {
- // all OK
- Log.debug("load font : \"" + _uri + "\" glyph count = " + (int)this.fftFace.nuthis.glyphs);
- this.init = true;
- //display();
- }
-}
-
-ewol::resource::FontFreeType::~FontFreeType() {
- ethread::RecursiveLock lock(this.mutex);
- // clean the tmp memory
- this.FileBuffer.clear();
- // must be deleted fftFace
- FT_Done_Face(this.fftFace);
-}
-
-Vector2f ewol::resource::FontFreeType::getSize(int _fontSize, String _unicodeString) {
- ethread::RecursiveLock lock(this.mutex);
- if (this.init == false) {
- return Vector2f(0,0);
- }
- // TODO : ...
- Vector2f outputSize(0,0);
- return outputSize;
-}
-
-int ewol::resource::FontFreeType::getHeight(int _fontSize) {
- ethread::RecursiveLock lock(this.mutex);
- return _fontSize*1.43f; // this is a really "magic" number ...
-}
-float ewol::resource::FontFreeType::getSizeWithHeight(float _fontHeight) {
- ethread::RecursiveLock lock(this.mutex);
- return _fontHeight*0.6993f; // this is a really "magic" number ...
-}
-
-boolean ewol::resource::FontFreeType::getGlyphProperty(int _fontSize, ewol::GlyphProperty _property) {
- ethread::RecursiveLock lock(this.mutex);
- if(false == this.init) {
- return false;
- }
- // 300dpi (hight quality) 96 dpi (normal quality)
- int fontQuality = 96;
- // Select size ...
- // note tha +6 == *64 corespond with the 1/64th of points calculation of freetype
- int error = FT_Set_Char_Size(this.fftFace, _fontSize+6, _fontSize+6, fontQuality, fontQuality);
- if (0!=error ) {
- Log.error("FT_Set_Char_Size == > error in settings ...");
- return false;
- }
- // a small shortcut
- FT_GlyphSlot slot = this.fftFace.glyph;
- // retrieve glyph index from character code
- int glyph_index = FT_Get_Char_Index(this.fftFace, _property.this.UVal);
- // load glyph image into the slot (erase previous one)
- error = FT_Load_Glyph(this.fftFace, // handle to face object
- glyph_index, // glyph index
- FT_LOAD_DEFAULT );
- if (0!=error ) {
- Log.error("FT_Load_Glyph specify Glyph");
- return false;
- }
- // convert to an anti-aliased bitmap
- error = FT_Render_Glyph(slot, FT_RENDER_MODE_NORMAL );
- if (0!=error) {
- Log.error("FT_Render_Glyph");
- return false;
- }
- // set properties :
- _property.this.glyphIndex = glyph_index;
- _property.this.sizeTexture.setValue(slot.bitmap.width, slot.bitmap.rows);
- _property.this.bearing.setValue( slot.metrics.horiBearingX>>6 , slot.metrics.horiBearingY>>6 );
- _property.this.advance.setValue( slot.metrics.horiAdvance>>6 , slot.metrics.vertAdvance>>6 );
-
- return true;
-}
-
-boolean ewol::resource::FontFreeType::drawGlyph(egami::Image _imageOut,
- int _fontSize,
- Vector2i _glyphPosition,
- ewol::GlyphProperty _property,
- int8_t _posInImage) {
- ethread::RecursiveLock lock(this.mutex);
- if(this.init == false) {
- return false;
- }
- // 300dpi (hight quality) 96 dpi (normal quality)
- int fontQuality = 96;
- // Select size ...
- // note tha +6 == *64 corespond with the 1/64th of points calculation of freetype
- int error = FT_Set_Char_Size(this.fftFace, _fontSize+6, _fontSize+6, fontQuality, fontQuality);
- if (0!=error ) {
- Log.error("FT_Set_Char_Size == > error in settings ...");
- return false;
- }
- // a small shortcut
- FT_GlyphSlot slot = this.fftFace.glyph;
- // load glyph image into the slot (erase previous one)
- error = FT_Load_Glyph(this.fftFace, // handle to face object
- _property.this.glyphIndex, // glyph index
- FT_LOAD_DEFAULT );
- if (0!=error ) {
- Log.error("FT_Load_Glyph specify Glyph");
- return false;
- }
- // convert to an anti-aliased bitmap
- error = FT_Render_Glyph(slot, FT_RENDER_MODE_NORMAL );
- if (0!=error) {
- Log.error("FT_Render_Glyph");
- return false;
- }
- // draw it on the output Image :
- etk::Color<> tlpppp(0xFF, 0xFF, 0xFF, 0x00);
- for(int jjj=0; jjj < slot.bitmap.rows;jjj++) {
- for(int iii=0; iii < slot.bitmap.width; iii++){
- tlpppp = _imageOut.get(Vector2i(_glyphPosition.x()+iii, _glyphPosition.y()+jjj));
- int valueColor = slot.bitmap.buffer[iii + slot.bitmap.width*jjj];
- // set only alpha :
- switch(_posInImage) {
- default:
- case 0:
- tlpppp.setA(valueColor);
- break;
- case 1:
- tlpppp.setR(valueColor);
- break;
- case 2:
- tlpppp.setG(valueColor);
- break;
- case 3:
- tlpppp.setB(valueColor);
- break;
- }
- // real set of color
- _imageOut.set(Vector2i(_glyphPosition.x()+iii, _glyphPosition.y()+jjj), tlpppp );
- }
- }
- return true;
-}
-
-boolean ewol::resource::FontFreeType::drawGlyph(egami::ImageMono _imageOut,
- int _fontSize,
- ewol::GlyphProperty _property,
- int _borderSize) {
- ethread::RecursiveLock lock(this.mutex);
- if(false == this.init) {
- return false;
- }
- // 300dpi (hight quality) 96 dpi (normal quality)
- int fontQuality = 96;
- // Select size ...
- // note tha +6 == *64 corespond with the 1/64th of points calculation of freetype
- int error = FT_Set_Char_Size(this.fftFace, _fontSize+6, _fontSize+6, fontQuality, fontQuality);
- if (0!=error ) {
- Log.error("FT_Set_Char_Size == > error in settings ...");
- return false;
- }
- // a small shortcut
- FT_GlyphSlot slot = this.fftFace.glyph;
- // load glyph image into the slot (erase previous one)
- error = FT_Load_Glyph(this.fftFace, // handle to face object
- _property.this.glyphIndex, // glyph index
- FT_LOAD_DEFAULT );
- if (0!=error ) {
- Log.error("FT_Load_Glyph specify Glyph");
- return false;
- }
- // convert to an anti-aliased bitmap
- error = FT_Render_Glyph(slot, FT_RENDER_MODE_NORMAL ); // TODO : set FT_RENDER_MODE_MONO ==> 1 bit value ==> faster generation ...
- if (0!=error) {
- Log.error("FT_Render_Glyph");
- return false;
- }
- // resize output image :
- _imageOut.resize(Vector2i(slot.bitmap.width+2*_borderSize, slot.bitmap.rows+2*_borderSize), 0);
-
- for(int jjj=0; jjj < slot.bitmap.rows;jjj++) {
- for(int iii=0; iii < slot.bitmap.width; iii++){
- int valueColor = slot.bitmap.buffer[iii + slot.bitmap.width*jjj];
- // real set of color
- _imageOut.set(Vector2i(_borderSize+iii, _borderSize+jjj), valueColor );
- }
- }
- return true;
-}
-
-
-void ewol::resource::FontFreeType::generateKerning(int fontSize, List listGlyph) {
- ethread::RecursiveLock lock(this.mutex);
- if(this.init == false) {
- return;
- }
- if ((FT_FACE_FLAG_KERNING this.fftFace.face_flags) == 0) {
- Log.info("No kerning generation (disable) in the font");
- }
- // 300dpi (hight quality) 96 dpi (normal quality)
- int fontQuality = 96;
- // Select size ...
- // note tha +6 == *64 corespond with the 1/64th of points calculation of freetype
- int error = FT_Set_Char_Size(this.fftFace, fontSize+6, fontSize+6, fontQuality, fontQuality);
- if (0!=error ) {
- Log.error("FT_Set_Char_Size == > error in settings ...");
- return;
- }
- // For all the kerning element we get the kerning value :
- for(int iii=0; iii