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