plop
This commit is contained in:
parent
6c0af28ce3
commit
f59c1c0135
@ -28,19 +28,19 @@ public class EsvgDocument extends Base {
|
|||||||
private Uri uri = null; //!< reference elements ...
|
private Uri uri = null; //!< reference elements ...
|
||||||
private String version = "0.0";
|
private String version = "0.0";
|
||||||
private static final boolean envDisplayRefs = "true".equals(System.getenv("ESQG_DISPLAY_REFS"));
|
private static final boolean envDisplayRefs = "true".equals(System.getenv("ESQG_DISPLAY_REFS"));
|
||||||
|
|
||||||
public EsvgDocument() {
|
public EsvgDocument() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public EsvgDocument(final Vector2i size) {
|
public EsvgDocument(final Vector2i size) {
|
||||||
this.size = new Vector2f(size.x(), size.y());
|
this.size = new Vector2f(size.x(), size.y());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addElement(final Base elem) {
|
public void addElement(final Base elem) {
|
||||||
this.subElementList.add(elem);
|
this.subElementList.add(elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* change all style in a xml atribute
|
* change all style in a xml atribute
|
||||||
*/
|
*/
|
||||||
@ -73,7 +73,7 @@ public class EsvgDocument extends Base {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clear() {
|
public void clear() {
|
||||||
this.uri = null;
|
this.uri = null;
|
||||||
this.version = "0.0";
|
this.version = "0.0";
|
||||||
@ -81,7 +81,7 @@ public class EsvgDocument extends Base {
|
|||||||
this.paint.clear();
|
this.paint.clear();
|
||||||
this.size = Vector2f.ZERO;
|
this.size = Vector2f.ZERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display all the node in the svg file.
|
* Display all the node in the svg file.
|
||||||
*/
|
*/
|
||||||
@ -100,7 +100,7 @@ public class EsvgDocument extends Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void draw(final Renderer myRenderer, final Matrix2x3f basicTrans, final int level) {
|
protected void draw(final Renderer myRenderer, final Matrix2x3f basicTrans, final int level) {
|
||||||
for (final Base element : this.subElementList) {
|
for (final Base element : this.subElementList) {
|
||||||
@ -109,7 +109,7 @@ public class EsvgDocument extends Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void drawShapePoints(
|
protected void drawShapePoints(
|
||||||
final List<List<Vector2f>> out,
|
final List<List<Vector2f>> out,
|
||||||
@ -124,16 +124,16 @@ public class EsvgDocument extends Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO remove this fucntion : use generic function ...
|
// TODO remove this fucntion : use generic function ...
|
||||||
public Vector2f getDefinedSize() {
|
public Vector2f getDefinedSize() {
|
||||||
return this.size;
|
return this.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<List<Vector2f>> getLines() {
|
public List<List<Vector2f>> getLines() {
|
||||||
return getLines(new Vector2f(256, 256));
|
return getLines(new Vector2f(256, 256));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<List<Vector2f>> getLines(Vector2f size) {
|
public List<List<Vector2f>> getLines(Vector2f size) {
|
||||||
final List<List<Vector2f>> out = new ArrayList<>();
|
final List<List<Vector2f>> out = new ArrayList<>();
|
||||||
if (size.x() <= 0) {
|
if (size.x() <= 0) {
|
||||||
@ -149,7 +149,7 @@ public class EsvgDocument extends Base {
|
|||||||
drawShapePoints(out, 10, 0.25f, basicTrans);
|
drawShapePoints(out, 10, 0.25f, basicTrans);
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Base getReference(final String name) {
|
public Base getReference(final String name) {
|
||||||
if (name.isEmpty()) {
|
if (name.isEmpty()) {
|
||||||
LOGGER.error("request a reference with no name ... ");
|
LOGGER.error("request a reference with no name ... ");
|
||||||
@ -166,11 +166,11 @@ public class EsvgDocument extends Base {
|
|||||||
LOGGER.error("Can not find reference name : '" + name + "'");
|
LOGGER.error("Can not find reference name : '" + name + "'");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLoadOk() {
|
public boolean isLoadOk() {
|
||||||
return this.loadOK;
|
return this.loadOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
//! @previous
|
//! @previous
|
||||||
public List<Color> renderImageFloatRGB(final Vector2i size) {
|
public List<Color> renderImageFloatRGB(final Vector2i size) {
|
||||||
@ -183,7 +183,7 @@ public class EsvgDocument extends Base {
|
|||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! @previous
|
//! @previous
|
||||||
public List<Color<uint8t,4>> renderImageU8RGBA(final Vector2i size) {
|
public List<Color<uint8t,4>> renderImageU8RGBA(final Vector2i size) {
|
||||||
List<Color> data = renderImageFloatRGBA(size);
|
List<Color> data = renderImageFloatRGBA(size);
|
||||||
@ -195,7 +195,7 @@ public class EsvgDocument extends Base {
|
|||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! @previous
|
//! @previous
|
||||||
public List<Color<uint8t,3>> renderImageU8RGB(final Vector2i size) {
|
public List<Color<uint8t,3>> renderImageU8RGB(final Vector2i size) {
|
||||||
List<Color> data = renderImageFloatRGBA(size);
|
List<Color> data = renderImageFloatRGBA(size);
|
||||||
@ -239,7 +239,7 @@ public class EsvgDocument extends Base {
|
|||||||
}
|
}
|
||||||
return this.loadOK;
|
return this.loadOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* parse a string that contain an svg stream
|
* parse a string that contain an svg stream
|
||||||
* @param data Data to parse
|
* @param data Data to parse
|
||||||
@ -271,11 +271,11 @@ public class EsvgDocument extends Base {
|
|||||||
}
|
}
|
||||||
return this.loadOK;
|
return this.loadOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean parseXMLData(final XmlElement root) {
|
public boolean parseXMLData(final XmlElement root) {
|
||||||
return parseXMLData(root, false);
|
return parseXMLData(root, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean parseXMLData(final XmlElement root, final boolean isReference) {
|
public boolean parseXMLData(final XmlElement root, final boolean isReference) {
|
||||||
// get the svg version :
|
// get the svg version :
|
||||||
this.version = root.getAttribute("version", "");
|
this.version = root.getAttribute("version", "");
|
||||||
@ -290,7 +290,7 @@ public class EsvgDocument extends Base {
|
|||||||
} else {
|
} else {
|
||||||
LOGGER.trace("Parse Reference section ... (no attibute)");
|
LOGGER.trace("Parse Reference section ... (no attibute)");
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2f maxSize = Vector2f.ZERO;
|
Vector2f maxSize = Vector2f.ZERO;
|
||||||
final Dynamic<Vector2f> size = new Dynamic<>(Vector2f.ZERO);
|
final Dynamic<Vector2f> size = new Dynamic<>(Vector2f.ZERO);
|
||||||
// parse all sub node:
|
// parse all sub node:
|
||||||
@ -386,12 +386,12 @@ public class EsvgDocument extends Base {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
public float[][] renderImageFloat(final Vector2i size) {
|
public float[][] renderImageFloat(final Vector2i size) {
|
||||||
return renderImageFloat(size, false);
|
return renderImageFloat(size, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float[][] renderImageFloat(Vector2i size, final boolean visualDebug) {
|
public float[][] renderImageFloat(Vector2i size, final boolean visualDebug) {
|
||||||
if (size == null) {
|
if (size == null) {
|
||||||
size = new Vector2i((int) this.size.x(), (int) this.size.y());
|
size = new Vector2i((int) this.size.x(), (int) this.size.y());
|
||||||
@ -408,7 +408,7 @@ public class EsvgDocument extends Base {
|
|||||||
// create the first element matrix modification ...
|
// create the first element matrix modification ...
|
||||||
Matrix2x3f basicTrans = Matrix2x3f.IDENTITY.multiply(Matrix2x3f.createScale(new Vector2f(size.x() / this.size.x(), size.y() / this.size.y())));
|
Matrix2x3f basicTrans = Matrix2x3f.IDENTITY.multiply(Matrix2x3f.createScale(new Vector2f(size.x() / this.size.x(), size.y() / this.size.y())));
|
||||||
draw(renderedElement, basicTrans);
|
draw(renderedElement, basicTrans);
|
||||||
|
|
||||||
// direct return the generated data ...
|
// direct return the generated data ...
|
||||||
return renderedElement.getData();
|
return renderedElement.getData();
|
||||||
}
|
}
|
||||||
@ -421,7 +421,7 @@ public class EsvgDocument extends Base {
|
|||||||
public ImageFloatRGBA renderImageFloatRGBA(final Vector2i size) {
|
public ImageFloatRGBA renderImageFloatRGBA(final Vector2i size) {
|
||||||
return renderImageFloatRGBA(size, false);
|
return renderImageFloatRGBA(size, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImageFloatRGBA renderImageFloatRGBA(Vector2i size, final boolean visualDebug) {
|
public ImageFloatRGBA renderImageFloatRGBA(Vector2i size, final boolean visualDebug) {
|
||||||
if (size == null) {
|
if (size == null) {
|
||||||
size = new Vector2i((int) this.size.x(), (int) this.size.y());
|
size = new Vector2i((int) this.size.x(), (int) this.size.y());
|
||||||
@ -445,9 +445,9 @@ public class EsvgDocument extends Base {
|
|||||||
final Matrix2x3f basicTrans = Matrix2x3f.IDENTITY
|
final Matrix2x3f basicTrans = Matrix2x3f.IDENTITY
|
||||||
.multiply(Matrix2x3f.createScale(new Vector2f(size.x() / this.size.x(), size.y() / this.size.y())));
|
.multiply(Matrix2x3f.createScale(new Vector2f(size.x() / this.size.x(), size.y() / this.size.y())));
|
||||||
draw(renderedElement, basicTrans);
|
draw(renderedElement, basicTrans);
|
||||||
|
|
||||||
// direct return the generated data ...
|
// direct return the generated data ...
|
||||||
return renderedElement.getData();
|
return renderedElement.getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user