use of org.jwildfire.create.tina.io.SimpleXMLBuilder.Attribute in project JWildfire by thargor6.
the class FACLFlameWriter method getFlameXML.
public String getFlameXML(Flame pFlame) throws Exception {
SimpleXMLBuilder xb = new SimpleXMLBuilder();
List<SimpleXMLBuilder.Attribute<?>> flamesAttrList = new ArrayList<>();
flamesAttrList.add(new Attribute<String>("name", ""));
xb.beginElement("Flames", flamesAttrList);
// Flame
List<SimpleXMLBuilder.Attribute<?>> attrList = createFlameAttributes(pFlame, xb);
Layer layer = pFlame.getFirstLayer();
xb.beginElement("flame", attrList);
// XForm
for (XForm xForm : layer.getXForms()) {
xb.emptyElement("xform", createXFormAttrList(xb, layer, xForm));
}
// FinalXForms
for (XForm xForm : layer.getFinalXForms()) {
xb.emptyElement("finalxform", createXFormAttrList(xb, layer, xForm));
}
// Gradient
addGradient(xb, layer);
xb.endElement("flame");
xb.endElement("Flames");
return xb.buildXML();
}
use of org.jwildfire.create.tina.io.SimpleXMLBuilder.Attribute in project JWildfire by thargor6.
the class FACLFlameWriter method addGradient.
private void addGradient(SimpleXMLBuilder xb, Layer layer) {
RGBPalette palette = layer.getPalette();
for (int i = 0; i < 256; i++) {
List<SimpleXMLBuilder.Attribute<?>> attrList = new ArrayList<>();
attrList.add(new Attribute<Integer>("index", i));
String rgbStr = palette.getColor(i).getRed() + " " + palette.getColor(i).getGreen() + " " + palette.getColor(i).getBlue();
attrList.add(new Attribute<String>("rgb", rgbStr));
xb.simpleElement("color", null, attrList);
}
}
Aggregations