// Write image reference; return the name of the reference ..
final String name = writeRaw(source);
if (name != null)
{
// Write image reference ..
final AttributeList attrList = new AttributeList();
attrList.setAttribute(Namespaces.XHTML_NAMESPACE, "src", name);
// width and height and scaling and so on ..
xmlWriter.writeTag(Namespaces.XHTML_NAMESPACE, "img", attrList, XmlWriter.CLOSE);
knownResources.put(source, name);
return;
}
}
}
// Fallback: (At the moment, we only support drawables and images.)
final Object rawObject = rc.getRawObject();
if (rawObject instanceof Image)
{
// Make it a PNG file ..
xmlWriter.writeComment("Image content:" + source);
final String name = writeImage((Image) rawObject);
if (name != null)
{
// Write image reference ..
final AttributeList attrList = new AttributeList();
attrList.setAttribute(Namespaces.XHTML_NAMESPACE, "src", name);
// width and height and scaling and so on ..
xmlWriter.writeTag(Namespaces.XHTML_NAMESPACE, "img", attrList, XmlWriter.CLOSE);
}
}
else if (rawObject instanceof Drawable)
{
// render it into an Buffered image and make it a PNG file.
xmlWriter.writeComment("Drawable content:" + source);
final Image image = generateImage(node, (Drawable) rawObject);
final String name = writeImage(image);
if (name != null)
{
// Write image reference ..
final AttributeList attrList = new AttributeList();
attrList.setAttribute(Namespaces.XHTML_NAMESPACE, "src", name);
// width and height and scaling and so on ..
xmlWriter.writeTag(Namespaces.XHTML_NAMESPACE, "img", attrList, XmlWriter.CLOSE);
}
}
}