com.openhtmltopdf.java2d.Java2DSVGReplacedElement Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openhtmltopdf-java2d Show documentation
Show all versions of openhtmltopdf-java2d Show documentation
Openhtmltopdf is a CSS 2.1 renderer written in Java. This artifact supports image output with the Java2D API.
The newest version!
package com.openhtmltopdf.java2d;
import org.w3c.dom.Element;
import com.openhtmltopdf.css.style.CssContext;
import com.openhtmltopdf.extend.OutputDevice;
import com.openhtmltopdf.extend.SVGDrawer;
import com.openhtmltopdf.extend.SVGDrawer.SVGImage;
import com.openhtmltopdf.java2d.api.Java2DRendererBuilder.Graphics2DPaintingReplacedElement;
import com.openhtmltopdf.render.Box;
import com.openhtmltopdf.render.RenderingContext;
public class Java2DSVGReplacedElement extends Graphics2DPaintingReplacedElement /* TODO */ {
private final SVGImage _svgImage;
public Java2DSVGReplacedElement(Element e, SVGDrawer svgImpl, int width, int height, Box box, CssContext c) {
super(width, height);
this._svgImage = svgImpl.buildSVGImage(e, box, c, width, height, /* dots-per-pixel */ 1);
}
@Override
public void paint(OutputDevice outputDevice, RenderingContext ctx, double x, double y, double width,
double height) {
this._svgImage.drawSVG(outputDevice, ctx, x, y);
}
@Override
public int getIntrinsicWidth() {
return this._svgImage.getIntrinsicWidth();
}
@Override
public int getIntrinsicHeight() {
return this._svgImage.getIntrinsicHeight();
}
}