[DEV] some updates

This commit is contained in:
Edouard DUPIN 2025-08-10 00:50:06 +02:00
parent 163e2e17ea
commit df65afb204
20 changed files with 626 additions and 1065 deletions

View File

@ -98,9 +98,9 @@ public class BasicWindows extends Windows {
this.container.setPropertyFill(Vector2b.TRUE);
this.container.setPropertyExpandIfFree(Vector2b.TRUE);
this.testedElement.add(new TestWidgetSlider());
this.testedElement.add(new TestWidgetEntry());
this.testedElement.add(new TestWidgetBox());
this.testedElement.add(new TestWidgetSlider());
this.testedElement.add(new TestWidgetButton());
this.testedElement.add(new TestWidgetButtonToggle());
this.testedElement.add(new TestWidgetCheckBox());

View File

@ -8,23 +8,13 @@ package org.atriasoft.ewol.compositing;
import org.atriasoft.egami.ImageByte;
import org.atriasoft.egami.ImageByteRGBA;
import org.atriasoft.egami.ToolImage;
import org.atriasoft.esvg.CapMode;
import org.atriasoft.esvg.Circle;
import org.atriasoft.esvg.Ellipse;
import org.atriasoft.esvg.EsvgDocument;
import org.atriasoft.esvg.JoinMode;
import org.atriasoft.esvg.Line;
import org.atriasoft.esvg.PaintState;
import org.atriasoft.esvg.Rectangle;
import org.atriasoft.etk.BorderRadius;
import org.atriasoft.etk.Color;
import org.atriasoft.etk.Insets;
import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.Matrix4f;
import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.etk.math.Vector3f;
import org.atriasoft.etk.util.Pair;
import org.atriasoft.gale.backend3d.OpenGL;
import org.atriasoft.gale.backend3d.OpenGL.RenderMode;
import org.atriasoft.gale.resource.ResourceProgram;
@ -33,7 +23,7 @@ import org.atriasoft.gale.resource.ResourceVirtualArrayObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class CompositingSVG extends CompositingDraw {
public class CompositingSVG extends Compositing {
private static final Logger LOGGER = LoggerFactory.getLogger(CompositingSVG.class);
public static final int NB_VBO = 3;
public static final int SIZE_AUTO = 0;
@ -136,15 +126,12 @@ public class CompositingSVG extends CompositingDraw {
@Override
public void flush() {
generate();
if (this.vboDataCoords != null) {
this.vbo.setPosition(this.vboDataCoords);
this.vbo.setTextureCoordinate(this.vboDataCoordsTex);
this.vbo.setColors(this.vboDataColors);
this.vbo.setVertexCount(this.vboDataCoords.length);
this.vbo.flush();
}
}
/**
* get the current display position (sometime needed in the gui control)
@ -420,16 +407,9 @@ public class CompositingSVG extends CompositingDraw {
// Nothing to do ...
return;
}
this.svgData = null;
clear();
this.svgDoc = data;
this.requestSize = size;
generate();
}
protected void generate() {
final Vector2i size = this.requestSize;
if (this.svgDoc != null) {
final ImageByte tmp = ToolImage.convertImageByte(this.svgDoc.renderImageFloatRGBA(size));
final ImageByte tmp = ToolImage.convertImageByte(data.renderImageFloatRGBA(size));
if (tmp == null) {
LOGGER.error("Can not load the Raw SVG ... ");
return;
@ -438,128 +418,7 @@ public class CompositingSVG extends CompositingDraw {
this.resource = new ResourceTexture2();
}
this.resource.set(tmp);
}
}
PaintState paint = new PaintState();
public void clearPaint() {
this.paint.clear();
}
public void createSize(final Vector2i size) {
clear();
this.paint.clear();
if (this.svgDoc == null) {
this.svgDoc = new EsvgDocument(size);
}
this.svgDoc = data;
this.requestSize = size;
}
@Override
public void setPaintFillColor(final Color color) {
this.paint.fill = new Pair<>(color, "");
}
@Override
public void setPaintStrokeColor(final Color color) {
this.paint.stroke = new Pair<>(color, "");
}
@Override
public void setPaintStrokeWidth(final float width) {
this.paint.strokeWidth = width;
}
public void setPaintLineJoin(final JoinMode lineJoin) {
this.paint.lineJoin = lineJoin;
}
public void setPaintLineCap(final CapMode lineCap) {
this.paint.lineCap = lineCap;
}
public void setPaintMiterLimit(final float miterLimit) {
this.paint.miterLimit = miterLimit;
}
public void setPaintOpacity(final float opacity) {
this.paint.opacity = opacity;
}
@Override
public void addLine(final Vector2f startPos, final Vector2f stopPos) {
if (this.svgDoc == null) {
this.svgDoc = new EsvgDocument();
}
this.svgDoc.addElement(new Line(startPos, stopPos, this.paint));
}
@Override
public void addRectangle(final Vector2f position, final Vector2f size) {
if (this.svgDoc == null) {
this.svgDoc = new EsvgDocument();
}
this.svgDoc.addElement(new Rectangle(position, size, this.paint));
}
@Override
public void addRectangle(final Vector2f position, final Vector2f size, final Vector2f roundedCorner) {
if (this.svgDoc == null) {
this.svgDoc = new EsvgDocument();
}
this.svgDoc.addElement(new Rectangle(position, size, roundedCorner, this.paint));
}
@Override
public void addCircle(final Vector2f position, final float radius) {
if (this.svgDoc == null) {
this.svgDoc = new EsvgDocument();
}
this.svgDoc.addElement(new Circle(position, radius, this.paint));
}
@Override
public void addEllipse(final Vector2f center, final Vector2f radius) {
if (this.svgDoc == null) {
this.svgDoc = new EsvgDocument();
}
this.svgDoc.addElement(new Ellipse(center, radius, this.paint));
}
public void setRectangleAsSource(final int sizeX, final int sizeY, final Color color) {
createSize(new Vector2i(sizeX, sizeY)); // specific for SVG
setPaintFillColor(color);
addRectangle(Vector2f.ZERO, new Vector2f(sizeX, sizeY));
flush();
}
public void setRectangleBorderAsSource(
final int sizeX,
final int sizeY,
final Color color,
final int borderSize,
final int borderRadius,
final Color borderColor) {
final int paddingCompensateBorder = Math.round(borderSize * 0.5f);
createSize(new Vector2i(sizeX, sizeY)); // specific for SVG
setPaintFillColor(color);
setPaintStrokeColor(borderColor);
setPaintStrokeWidth(borderSize);
addRectangle(new Vector2f(paddingCompensateBorder, paddingCompensateBorder), //
new Vector2f(sizeX - 2 * paddingCompensateBorder, sizeY - 2 * paddingCompensateBorder), //
new Vector2f(borderRadius, borderRadius));
flush();
}
@Override
public void addRectangle(
final Vector2f position,
final Vector2f size,
final Insets thickness,
final BorderRadius radius) {
// TODO Auto-generated method stub
}
}

View File

@ -274,10 +274,15 @@ public class Box extends Container {
@Override
public void onRegenerateDisplay() {
super.onRegenerateDisplay();
if (!needRedraw()) {
return;
}
regenerateDisplay();
}
@Override
public void regenerateDisplay() {
super.regenerateDisplay();
final Insets localMargin = this.propertyMargin.size();
Vector2f renderSize = calculateSizeRendering();
this.overPositionStart = calculateOriginRendering(renderSize);

View File

@ -1,293 +0,0 @@
package org.atriasoft.ewol.widget;
import org.atriasoft.aknot.annotation.AknotAttribute;
import org.atriasoft.aknot.annotation.AknotDescription;
import org.atriasoft.aknot.annotation.AknotManaged;
import org.atriasoft.aknot.annotation.AknotName;
import org.atriasoft.etk.Color;
import org.atriasoft.etk.Dimension1f;
import org.atriasoft.etk.Dimension2f;
import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.ewol.compositing.CompositingSVG;
import org.atriasoft.ewol.event.EventTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class BoxSVG extends Container {
private static final Logger LOGGER = LoggerFactory.getLogger(BoxSVG.class);
protected CompositingSVG vectorialDraw = new CompositingSVG();
public static class BoxParameter {
public Float margin;
public Float padding;
public Float borderWidth;
public Float borderRadius;
public String borderColor;
public String color;
}
/**
* Periodic call to update grapgic display
* @param event Time generic event
*/
protected static void periodicCall(final BoxSVG self, final EventTime event) {
LOGGER.trace("Periodic call on Entry(" + event + ")");
self.markToRedraw();
}
Vector2i startPosition = Vector2i.ZERO;
Vector2i endPosition = Vector2i.ZERO;
public boolean isInside(final Vector2f value) {
return value.x() > this.startPosition.x() //
&& value.y() > this.startPosition.y() //
&& value.x() < this.endPosition.x() //
&& value.y() < this.endPosition.y();
}
/**
* Constructor
*/
public BoxSVG() {}
/**
* Constructor with his subWidget
*/
public BoxSVG(final Widget subWidget) {
super(subWidget);
}
protected Dimension1f propertyBorderWidth = Dimension1f.ZERO;
@AknotManaged
@AknotAttribute
@AknotName(value = "border-width")
@AknotDescription(value = "Border of the box")
public Dimension1f getPropertyBorderWidth() {
return this.propertyBorderWidth;
}
public void setPropertyBorderWidth(final Dimension1f propertyBorder) {
if (this.propertyBorderWidth.equals(propertyBorder)) {
return;
}
this.propertyBorderWidth = propertyBorder;
markToRedraw();
requestUpdateSize();
}
protected Dimension1f propertyBorderRadius = new Dimension1f(0);
@AknotManaged
@AknotAttribute
@AknotName(value = "border-radius")
@AknotDescription(value = "Border radius of the box")
public Dimension1f getPropertyBorderRadius() {
return this.propertyBorderRadius;
}
public void setPropertyBorderRadius(final Dimension1f propertyBorderRadius) {
if (this.propertyBorderRadius.equals(propertyBorderRadius)) {
return;
}
this.propertyBorderRadius = propertyBorderRadius;
markToRedraw();
requestUpdateSize();
}
protected Color propertyBorderColor = Color.NONE;
@AknotManaged
@AknotAttribute
@AknotName(value = "border-color")
@AknotDescription(value = "Border color of the box")
public Color getPropertyBorderColor() {
return this.propertyBorderColor;
}
public void setPropertyBorderColor(final Color propertyBorderColor) {
if (this.propertyBorderColor.equals(propertyBorderColor)) {
return;
}
this.propertyBorderColor = propertyBorderColor;
markToRedraw();
requestUpdateSize();
}
protected Color propertyColor = Color.NONE;
@AknotManaged
@AknotAttribute
@AknotName(value = "color")
@AknotDescription(value = "Border color of the box")
public Color getPropertyColor() {
return this.propertyColor;
}
public void setPropertyColor(final Color propertyColor) {
if (this.propertyColor.equals(propertyColor)) {
return;
}
this.propertyColor = propertyColor;
markToRedraw();
requestUpdateSize();
}
protected Dimension2f propertyMargin = Dimension2f.ZERO;
@AknotManaged
@AknotAttribute
@AknotName(value = "margin")
@AknotDescription(value = "margin of the box")
public Dimension2f getPropertyMargin() {
return this.propertyMargin;
}
public void setPropertyMargin(final Dimension2f propertyMargin) {
if (this.propertyMargin.equals(propertyMargin)) {
return;
}
this.propertyMargin = propertyMargin;
markToRedraw();
requestUpdateSize();
}
protected Dimension2f propertyPadding = Dimension2f.ZERO;
@AknotManaged
@AknotAttribute
@AknotName(value = "padding")
@AknotDescription(value = "Padding of the box")
public Dimension2f getPropertyPadding() {
return this.propertyPadding;
}
public void setPropertyPadding(final Dimension2f propertyPadding) {
if (this.propertyPadding.equals(propertyPadding)) {
return;
}
this.propertyPadding = propertyPadding;
markToRedraw();
requestUpdateSize();
}
@Override
public void calculateMinMaxSize() {
super.calculateMinMaxSize();
final Vector2f childMinSize = new Vector2f(this.minSize.x(), this.minSize.y());
LOGGER.debug("calculate min size: border=" + this.propertyBorderWidth);
final Vector2f borderSize = new Vector2f(this.propertyBorderWidth.size() * 2.0f,
this.propertyBorderWidth.size() * 2.0f);
final Vector2f padding = this.propertyPadding.size().multiply(2);
final Vector2f margin = this.propertyMargin.size().multiply(2);
final Vector2f calculatedBoxMinSize = childMinSize.add(margin).add(padding).add(borderSize);
this.minSize = calculatedBoxMinSize;
this.maxSize = Vector2f.max(this.minSize, this.propertyMaxSize.size());
markToRedraw();
}
@Override
public void onChangeSize() {
markToRedraw();
if (this.propertyHide) {
return;
}
if (this.subWidget == null) {
return;
}
final Vector2f localPadding = this.propertyPadding.size();
final Vector2f localMargin = this.propertyMargin.size();
final float localBorderSize = this.propertyBorderWidth.size();
final Vector2f offsetSubWidget = localPadding.add(localMargin).add(localBorderSize);
Vector2f subWidgetSize = this.subWidget.getCalculateMinSize();
if (this.subWidget.canExpand().x() && this.propertyFill.x()) {
subWidgetSize = subWidgetSize.withX(this.size.x());
} else {
subWidgetSize = subWidgetSize.withX(this.minSize.x());
}
if (this.subWidget.canExpand().y() && this.propertyFill.y()) {
subWidgetSize = subWidgetSize.withY(this.size.y());
} else {
subWidgetSize = subWidgetSize.withY(this.minSize.y());
}
subWidgetSize = subWidgetSize.less(offsetSubWidget.multiply(2));
subWidgetSize = subWidgetSize.clipInteger();
final Vector2f freeSizeWithoutWidget = this.size.less(offsetSubWidget.multiply(2)).less(subWidgetSize);
Vector2f subWidgetOrigin = this.origin.add(this.propertyGravity.gravityGenerateDelta(freeSizeWithoutWidget));
subWidgetOrigin = subWidgetOrigin.add(offsetSubWidget);
subWidgetOrigin = subWidgetOrigin.clipInteger();
this.subWidget.setOrigin(subWidgetOrigin);
this.subWidget.setSize(subWidgetSize);
this.subWidget.onChangeSize();
}
protected Vector2i renderOrigin;
protected Vector2i renderSize;
private Vector2f calculateOriginRendering(final Vector2f renderSize) {
return this.propertyGravity.gravityGenerateDelta(this.size.less(renderSize));
}
private Vector2f calculateSizeRendering() {
Vector2f tmpRenderSize = this.minSize;
if (this.propertyFill.x()) {
tmpRenderSize = tmpRenderSize.withX(this.size.x());
}
if (this.propertyFill.y()) {
tmpRenderSize = tmpRenderSize.withY(this.size.y());
}
return tmpRenderSize;
}
@Override
public void onRegenerateDisplay() {
super.onRegenerateDisplay();
if (!needRedraw()) {
return;
}
final Vector2f localMargin = this.propertyMargin.size();
Vector2f tmpRenderSize = calculateSizeRendering();
Vector2f tmpRenderOrigin = calculateOriginRendering(tmpRenderSize);
tmpRenderOrigin = tmpRenderOrigin.add(localMargin);
tmpRenderSize = tmpRenderSize.less(localMargin.multiply(2));
// not sure this is needed...
tmpRenderSize = tmpRenderSize.clipInteger();
tmpRenderOrigin = tmpRenderOrigin.clipInteger();
this.renderOrigin = new Vector2i((int) tmpRenderOrigin.x(), (int) tmpRenderOrigin.y());
this.renderSize = new Vector2i((int) tmpRenderSize.x(), (int) tmpRenderSize.y());
//System.out.println("renderSize: " + this.renderSize);
// remove data of the previous composition :
this.vectorialDraw.clear();
final int borderSize = (int) this.propertyBorderWidth.size();
final int paddingCompensateBorder = Math.round(borderSize * 0.5f);
if (borderSize > 0.0f) {
this.vectorialDraw.setRectangleBorderAsSource(this.renderSize.x(), this.renderSize.y(), this.propertyColor,
borderSize, (int) this.propertyBorderRadius.size(), this.propertyBorderColor);
} else {
this.vectorialDraw.setRectangleAsSource(this.renderSize.x(), this.renderSize.y(), this.propertyColor);
}
this.vectorialDraw.setPos(this.renderOrigin);
// For events:
this.startPosition = this.renderOrigin;
this.endPosition = this.renderOrigin.add(this.renderSize);
this.vectorialDraw.print(this.renderSize);
this.vectorialDraw.flush();
}
@Override
protected void onDraw() {
if (this.vectorialDraw != null) {
this.vectorialDraw.draw(true);
}
super.onDraw();
}
}

View File

@ -158,6 +158,10 @@ public class Container extends Widget {
@Override
public void onRegenerateDisplay() {
regenerateDisplay();
}
public void regenerateDisplay() {
if (this.subWidget != null) {
this.subWidget.systemRegenerateDisplay();
}

View File

@ -160,6 +160,10 @@ public class ContainerN extends Widget {
@Override
public void onRegenerateDisplay() {
regenerateDisplay();
}
public void regenerateDisplay() {
for (final Widget it : this.subWidget) {
if (it != null) {
it.systemRegenerateDisplay();

View File

@ -504,7 +504,12 @@ public class Entry extends Box {
if (!needRedraw()) {
return;
}
super.onRegenerateDisplay();
regenerateDisplay();
}
@Override
public void regenerateDisplay() {
super.regenerateDisplay();
// calculate the vertical offset to center the text:
final float offsetCenter = FMath.max(0.0f,
(FMath.abs(this.insidePositionStop.y() - this.insidePositionStart.y()) - this.text.getHeight()) * 0.5f);
@ -648,9 +653,9 @@ public class Entry extends Box {
}
/**
* change the cursor position with the curent position requested on the display
* change the cursor position with the current position requested on the display
* @param pos Absolute position of the event
* @note The display is automaticly requested when change apear.
* @note The display is automatically requested when change appear.
*/
protected void updateCursorPosition(final Vector2f pos) {
updateCursorPosition(pos, false);

View File

@ -16,7 +16,6 @@ import org.atriasoft.etk.Dimension2f;
import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.ewol.compositing.CompositingImage;
import org.atriasoft.ewol.event.EventInput;
import org.atriasoft.ewol.resource.ResourceColorFile;

View File

@ -159,8 +159,7 @@ public class Label extends Widget {
final Vector2f textPos = new Vector2f(tmpTextOrigin.x(), tmpTextOrigin.y());
final Vector2f drawClippingPos = tmpOriginShaper
.less(new Vector2f(padding.left(), padding.bottom()));
final Vector2f drawClippingPos = tmpOriginShaper.less(new Vector2f(padding.left(), padding.bottom()));
final Vector2f drawClippingSize = tmpOriginShaper.add(tmpSizeShaper); /// new Vector2f((this.size.x() - paddingSize), (this.size.y() - paddingSize), 1);
// clean the element

View File

@ -9,10 +9,8 @@ import org.atriasoft.aknot.annotation.AknotAttribute;
import org.atriasoft.aknot.annotation.AknotDescription;
import org.atriasoft.aknot.annotation.AknotManaged;
import org.atriasoft.aknot.annotation.AknotName;
import org.atriasoft.etk.Color;
import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.FMath;
import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector2b;
import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.ewol.DrawProperty;
@ -435,10 +433,10 @@ class Scroll extends Container {
final Vector2f renderOrigin = new Vector2f(this.size.x() - paddingVert.x(), 0);
final Vector2f renderSize = new Vector2f(paddingVert.x(), this.size.y());
this.compositingV.setRectangleAsSource((int) renderSize.x(), (int) renderSize.y(), Color.GREEN);
this.compositingV.setPos(renderOrigin);
this.compositingV.print(renderSize);
this.compositingV.flush();
// this.compositingV.setRectangleAsSource((int) renderSize.x(), (int) renderSize.y(), Color.GREEN);
// this.compositingV.setPos(renderOrigin);
// this.compositingV.print(renderSize);
// this.compositingV.flush();
/*
this.shaperV.setShape(new Vector2f(this.size.x() - paddingVert.x(), 0),
new Vector2f(paddingVert.x(), this.size.y()),
@ -456,10 +454,10 @@ class Scroll extends Container {
final Vector2f renderOrigin = Vector2f.ZERO;
final Vector2f renderSize = new Vector2f(this.size.x() - paddingVert.x(), paddingHori.y());
this.compositingH.setRectangleAsSource((int) renderSize.x(), (int) renderSize.y(), Color.GREEN);
this.compositingH.setPos(renderOrigin);
this.compositingH.print(renderSize);
this.compositingH.flush();
// this.compositingH.setRectangleAsSource((int) renderSize.x(), (int) renderSize.y(), Color.GREEN);
// this.compositingH.setPos(renderOrigin);
// this.compositingH.print(renderSize);
// this.compositingH.flush();
/*
this.shaperH.setShape(Vector2f.ZERO, new Vector2f(this.size.x() - paddingVert.x(), paddingHori.y()),
new Vector2f(originScrollBar, paddingHori.bottom()), new Vector2f(lenScrollBar, 0));

View File

@ -6,13 +6,15 @@ import org.atriasoft.aknot.annotation.AknotManaged;
import org.atriasoft.aknot.annotation.AknotName;
import org.atriasoft.aknot.annotation.AknotSignal;
import org.atriasoft.esignal.Signal;
import org.atriasoft.etk.BorderRadius;
import org.atriasoft.etk.Color;
import org.atriasoft.etk.Dimension1f;
import org.atriasoft.etk.Insets;
import org.atriasoft.etk.math.FMath;
import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.ewol.Padding;
import org.atriasoft.ewol.compositing.CompositingGC;
import org.atriasoft.ewol.compositing.CompositingSVG;
import org.atriasoft.ewol.event.EventInput;
import org.atriasoft.gale.key.KeyStatus;
import org.slf4j.Logger;
@ -31,7 +33,6 @@ public class Slider extends Widget {
private static final Logger LOGGER = LoggerFactory.getLogger(Slider.class);
private Float propertyValue = 0.0f; //!< string that must be displayed
protected CompositingSVG compositing = new CompositingSVG();
@AknotSignal
@AknotName("value")
@AknotDescription("Tick value change")
@ -57,6 +58,8 @@ public class Slider extends Widget {
CompositingGC vectorialDraw = new CompositingGC(); //!< drawing tool.
private final Dimension1f propertyLineWidth = new Dimension1f(20);
public Slider() {
this.propertyCanFocus = true;
markToRedraw();
@ -168,7 +171,7 @@ public class Slider extends Widget {
@Override
public void onDraw() {
this.compositing.draw();
this.vectorialDraw.draw();
}
@Override
@ -234,48 +237,35 @@ public class Slider extends Widget {
@Override
public void onRegenerateDisplay() {
if (!needRedraw()) {
return;
//return;
}
//LOGGER.trace("Regenerate Display ==> is needed: '" + this.propertyValue + "'");
this.compositing.clear();
//this.gc.clear();
/*
if (this.colorIdTextFg >= 0) {
//this.text.setDefaultColorFg(this.shape.getColor(this.colorIdTextFg));
//this.text.setDefaultColorBg(this.shape.getColor(this.colorIdTextBg));
//this.text.setCursorColor(this.shape.getColor(this.colorIdCursor));
//this.text.setSelectionColor(this.shape.getColor(this.colorIdSelection));
}
*/
this.vectorialDraw.clear();
final Padding padding = Padding.ZERO;//this.shape.getPadding();
{
// Manage external shape:
Vector2f tmpSizeShaper = this.minSize;
Vector2f sizeInsideRender = this.minSize;
Vector2f delta = this.propertyGravity.gravityGenerateDelta(this.size.less(this.minSize));
if (this.propertyFill.x()) {
tmpSizeShaper = tmpSizeShaper.withX(this.size.x());
sizeInsideRender = sizeInsideRender.withX(this.size.x());
delta = delta.withX(0.0f);
}
if (this.propertyFill.y()) {
tmpSizeShaper = tmpSizeShaper.withY(this.size.y());
sizeInsideRender = sizeInsideRender.withY(this.size.y());
delta = delta.withY(0.0f);
}
Vector2f tmpOriginShaper = delta;
Vector2f tmpSizeInside = tmpSizeShaper.less(padding.x(), padding.y());
//Vector2f tmpOriginText = this.size.less(tmpSizeText).multiply(0.5f);
Vector2f tmpOriginInside = Vector2f.ZERO;
// sometimes, the user define an height bigger than the real size needed == > in this case we need to center the text in the shaper ...
// fix all the position in the int class:
tmpSizeShaper = Vector2f.clipInt(tmpSizeShaper);
tmpOriginShaper = Vector2f.clipInt(tmpOriginShaper);
tmpSizeInside = Vector2f.clipInt(tmpSizeInside);
tmpOriginInside = Vector2f.clipInt(tmpOriginInside);
sizeInsideRender = Vector2f.clipInt(sizeInsideRender);
tmpOriginShaper = Vector2f
.clipInt(tmpOriginShaper.addY(sizeInsideRender.y() * 0.5f - this.propertyLineWidth.size() * 0.5f));
this.overPositionStart = tmpOriginShaper;
this.overPositionSize = tmpSizeShaper;
this.overPositionStop = tmpOriginShaper.add(tmpSizeShaper);
//this.shape.setShape(0, tmpOriginShaper, tmpSizeShaper, tmpOriginInside, tmpSizeInside);
this.overPositionSize = sizeInsideRender.withY(this.propertyLineWidth.size());
this.overPositionStop = tmpOriginShaper.add(this.overPositionSize);
this.vectorialDraw.setPaintFillColor(this.textColorBg);
this.vectorialDraw.addRectangle(this.overPositionStart, this.overPositionStop, new Insets(0),
new BorderRadius(this.propertyLineWidth.size() * 0.5f));
}
{
// Manage cursor:
@ -287,7 +277,8 @@ public class Slider extends Widget {
}
Vector2f tmpOriginShaper = delta;
Vector2f tmpSizeInside = tmpSizeShaper.less(padding.x(), padding.y());
Vector2f tmpSizeInside = new Vector2f(this.propertyLineWidth.size() * 2.0f,
this.propertyLineWidth.size() * 2.0f);
//Vector2f tmpOriginText = this.size.less(tmpSizeText).multiply(0.5f);
Vector2f tmpOriginInside = Vector2f.ZERO;
@ -304,17 +295,11 @@ public class Slider extends Widget {
this.overCursorPositionStart = tmpOriginShaper;
this.overCursorPositionSize = tmpSizeShaper;
this.overCursorPositionStop = tmpOriginShaper.add(tmpSizeShaper);
//this.shape.setShape(1, tmpOriginShaper, tmpSizeShaper, tmpOriginInside, tmpSizeInside);
this.overCursorPositionStop = tmpOriginShaper.add(this.overCursorPositionSize);
this.vectorialDraw.addRectangle(this.overCursorPositionStart, this.overCursorPositionStop, new Insets(0),
new BorderRadius(this.propertyLineWidth.size() * 2.0f));
}
LOGGER.error("REQUEST display an immage with size={}x{}", (int) this.overPositionSize.x(),
(int) this.overPositionSize.y());
this.compositing.setRectangleAsSource((int) this.overPositionSize.x(), (int) this.overPositionSize.y(),
Color.GREEN);
// TODO: Refaire le design de cet affichage...
this.compositing.setPos(this.overPositionStart);
this.compositing.print(new Vector2f(this.overPositionSize.x(), this.overPositionSize.y()));
this.compositing.flush();
this.vectorialDraw.flush();
}

View File

@ -53,7 +53,6 @@ public class Tick extends Box {
/// Periodic call handle to remove it when needed
protected Connection periodicConnectionHanble = new Connection();
private final Uri propertyConfig = new Uri("THEME", "shape/Tick.json", "ewol");
private final Uri uriCheckGreen = new Uri("THEME", "CheckBoxCrossRed.svg", "ewol");
private Boolean propertyValue = false; //!< string that must be displayed
@ -74,9 +73,6 @@ public class Tick extends Box {
@AknotName("value")
@AknotDescription("Tick value change")
public Signal<Boolean> signalValue = new Signal<>();
// element over:
Vector2f overPositionStart = Vector2f.ZERO;
Vector2f overPositionStop = Vector2f.ZERO;
private boolean isDown;
@ -153,15 +149,11 @@ public class Tick extends Box {
@Override
protected void onDraw() {
super.onDraw();
if (this.propertyValue) {
if (this.compositingTick != null) {
//if (this.propertyValue) {
if (this.compositingTick != null && this.propertyValue) {
this.compositingTick.draw(true);
}
}
// if (this.shape != null) {
// this.shape.draw(true, this.propertyValue ? 0 : 1);
// }
}
@Override
public boolean onEventInput(final EventInput event) {
@ -227,13 +219,19 @@ public class Tick extends Box {
@Override
public void onRegenerateDisplay() {
super.onRegenerateDisplay();
if (!needRedraw()) {
//return;
}
this.compositingTick.setSource(Uri.getAllDataString(this.uriCheckGreen));//, this.overPositionStart.less(4));
regenerateDisplay();
}
@Override
public void regenerateDisplay() {
super.regenerateDisplay();
final Vector2f size = this.overPositionStop.less(this.overPositionStart);
this.compositingTick.setSource(Uri.getAllDataString(this.uriCheckGreen), size.toVector2i());
this.compositingTick.setPos(this.overPositionStart.add(2));
this.compositingTick.print(this.overPositionStop.less(this.overPositionStart).less(4));
this.compositingTick.print(size.less(4));
this.compositingTick.flush();
}

View File

@ -20,9 +20,9 @@ import org.atriasoft.etk.Dimension2f;
import org.atriasoft.etk.Distance;
import org.atriasoft.etk.math.FMath;
import org.atriasoft.etk.math.Matrix4f;
import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.etk.math.Vector2b;
import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.etk.math.Vector3f;
import org.atriasoft.ewol.DrawProperty;
import org.atriasoft.ewol.Gravity;

View File

@ -4,12 +4,10 @@ import org.atriasoft.aknot.annotation.AknotAttribute;
import org.atriasoft.aknot.annotation.AknotDescription;
import org.atriasoft.aknot.annotation.AknotManaged;
import org.atriasoft.aknot.annotation.AknotName;
import org.atriasoft.etk.Color;
import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.FMath;
import org.atriasoft.etk.math.Matrix4f;
import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.ewol.DrawProperty;
import org.atriasoft.ewol.HighSpeedMode;
import org.atriasoft.ewol.Padding;
@ -463,10 +461,10 @@ class WidgetScrolled extends Widget {
final Vector2f renderOrigin = new Vector2f(this.size.x() - paddingVert.x(), 0);
final Vector2f renderSize = new Vector2f(paddingVert.x(), this.size.y());
this.compositingV.setRectangleAsSource((int) renderSize.x(), (int) renderSize.y(), Color.GREEN);
this.compositingV.setPos(renderOrigin);
this.compositingV.print(renderSize);
this.compositingV.flush();
// this.compositingV.setRectangleAsSource((int) renderSize.x(), (int) renderSize.y(), Color.GREEN);
// this.compositingV.setPos(renderOrigin);
// this.compositingV.print(renderSize);
// this.compositingV.flush();
// this.shaperV.setShape(new Vector2f(this.size.x() - paddingVert.x(), 0),
// new Vector2f(paddingVert.x(), this.size.y()),
@ -484,11 +482,11 @@ class WidgetScrolled extends Widget {
final Vector2f renderOrigin = Vector2f.ZERO;
final Vector2f renderSize = new Vector2f(this.size.x() - paddingVert.x(), paddingHori.y());
this.compositingH.setRectangleAsSource((int) renderSize.x(), (int) renderSize.y(), Color.GREEN);
this.compositingH.setPos(renderOrigin);
this.compositingH.print(renderSize);
this.compositingH.flush();
// this.compositingH.setRectangleAsSource((int) renderSize.x(), (int) renderSize.y(), Color.GREEN);
// this.compositingH.setPos(renderOrigin);
// this.compositingH.print(renderSize);
// this.compositingH.flush();
//
// this.shaperH.setShape(new Vector2f(0, 0), new Vector2f(this.size.x() - paddingVert.x(), paddingHori.y()),
// new Vector2f(originScrollBar, paddingHori.bottom()), new Vector2f(lenScrollBar, 0));
}