Search in sources :

Example 1 with HwmfGraphics

use of org.apache.poi.hwmf.draw.HwmfGraphics in project poi by apache.

the class HwmfPicture method draw.

public void draw(Graphics2D ctx, Rectangle2D graphicsBounds) {
    AffineTransform at = ctx.getTransform();
    try {
        Rectangle2D wmfBounds = getBounds();
        // scale output bounds to image bounds
        ctx.translate(graphicsBounds.getX(), graphicsBounds.getY());
        ctx.scale(graphicsBounds.getWidth() / wmfBounds.getWidth(), graphicsBounds.getHeight() / wmfBounds.getHeight());
        HwmfGraphics g = new HwmfGraphics(ctx, wmfBounds);
        for (HwmfRecord r : records) {
            r.draw(g);
        }
    } finally {
        ctx.setTransform(at);
    }
}
Also used : HwmfRecord(org.apache.poi.hwmf.record.HwmfRecord) Rectangle2D(java.awt.geom.Rectangle2D) AffineTransform(java.awt.geom.AffineTransform) HwmfGraphics(org.apache.poi.hwmf.draw.HwmfGraphics)

Aggregations

AffineTransform (java.awt.geom.AffineTransform)1 Rectangle2D (java.awt.geom.Rectangle2D)1 HwmfGraphics (org.apache.poi.hwmf.draw.HwmfGraphics)1 HwmfRecord (org.apache.poi.hwmf.record.HwmfRecord)1