[DEV] add texture in GC

This commit is contained in:
Edouard DUPIN 2021-05-29 00:50:51 +02:00
parent 1c300cf50a
commit 3d3f7c3274

View File

@ -5,6 +5,7 @@
*/ */
package org.atriasoft.ewol.compositing; package org.atriasoft.ewol.compositing;
import org.atriasoft.egami.ImageByte;
import org.atriasoft.esvg.CapMode; import org.atriasoft.esvg.CapMode;
import org.atriasoft.esvg.GraphicContext; import org.atriasoft.esvg.GraphicContext;
import org.atriasoft.esvg.JoinMode; import org.atriasoft.esvg.JoinMode;
@ -16,7 +17,7 @@ import org.atriasoft.gale.resource.ResourceTexture2;
public class CompositingGraphicContext extends Compositing { public class CompositingGraphicContext extends Compositing {
GraphicContext context = new GraphicContext(); GraphicContext context = new GraphicContext();
private final ResourceTexture2 resourcTexture = null; private final ResourceTexture2 texture = new ResourceTexture2();
public CompositingGraphicContext() { public CompositingGraphicContext() {
@ -67,12 +68,14 @@ public class CompositingGraphicContext extends Compositing {
@Override @Override
public void flush() { public void flush() {
if (this.resourcTexture == null) { if (this.texture == null) {
Log.warning("texture is null"); Log.warning("texture is null");
return; return;
} }
this.resourcTexture.set(this.context.render()); ImageByte img = this.context.render();
this.resourcTexture.flush(); //IOgami.storePNG(new Uri("/home/heero/000000000aaaaplopppp222.png"), img);
this.texture.set(img);
this.texture.flush();
} }
/** /**
@ -112,15 +115,15 @@ public class CompositingGraphicContext extends Compositing {
* @return tre image registered size * @return tre image registered size
*/ */
public Vector2i getRealSize() { public Vector2i getRealSize() {
return this.resourcTexture.get().getSize(); return this.texture.get().getSize();
} }
public int getRendererId() { public int getRendererId() {
return this.resourcTexture.getRendererId(); return this.texture.getRendererId();
} }
public ResourceTexture2 getResourceTexture() { public ResourceTexture2 getResourceTexture() {
return this.resourcTexture; return this.texture;
} }
public float getStrokeWidth() { public float getStrokeWidth() {
@ -131,6 +134,10 @@ public class CompositingGraphicContext extends Compositing {
return this.context.getTextHeight(); return this.context.getTextHeight();
} }
public float getTextSize() {
return this.context.getTextSize();
}
/** /**
* Sometimes the user declare an image but not allocate the ressources all the time, this is to know it .. * Sometimes the user declare an image but not allocate the ressources all the time, this is to know it ..
* @return the validity od the resources. * @return the validity od the resources.