Search in sources :

Example 1 with SVGImageElement

use of net.sf.latexdraw.parsers.svg.SVGImageElement in project latexdraw by arnobl.

the class SVGPicture method toSVG.

@Override
public SVGElement toSVG(final SVGDocument doc) {
    if (doc == null)
        return null;
    final SVGElement root = new SVGGElement(doc);
    final SVGElement img;
    root.setAttribute(LNamespace.LATEXDRAW_NAMESPACE + ':' + LNamespace.XML_TYPE, LNamespace.XML_TYPE_PICTURE);
    root.setAttribute(SVGAttributes.SVG_ID, getSVGID());
    img = new SVGImageElement(doc, shape.getPathSource());
    img.setAttribute(SVGAttributes.SVG_X, String.valueOf(shape.getPosition().getX()));
    img.setAttribute(SVGAttributes.SVG_Y, String.valueOf(shape.getPosition().getY()));
    img.setAttribute(SVGAttributes.SVG_HEIGHT, String.valueOf(shape.getImage().getHeight()));
    img.setAttribute(SVGAttributes.SVG_WIDTH, String.valueOf(shape.getImage().getWidth()));
    setSVGRotationAttribute(root);
    root.appendChild(img);
    return root;
}
Also used : SVGGElement(net.sf.latexdraw.parsers.svg.SVGGElement) SVGElement(net.sf.latexdraw.parsers.svg.SVGElement) SVGImageElement(net.sf.latexdraw.parsers.svg.SVGImageElement)

Aggregations

SVGElement (net.sf.latexdraw.parsers.svg.SVGElement)1 SVGGElement (net.sf.latexdraw.parsers.svg.SVGGElement)1 SVGImageElement (net.sf.latexdraw.parsers.svg.SVGImageElement)1