aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/apache/fop/svg/SVGArea.java
blob: dfff7f3daf537af2ac84ea2c09209c691869b32f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* $Id$
 * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
 * For details on use and redistribution please refer to the
 * LICENSE file included with these sources."
 */

package org.apache.fop.svg;

// FOP
import org.apache.fop.render.Renderer;
import org.apache.fop.layout.FontState;
import org.apache.fop.layout.Area;

import java.util.*;

import org.w3c.dom.svg.*;
import org.w3c.dom.*;

/**
 * class representing an SVG area in which the SVG graphics sit
 */
public class SVGArea extends Area {
    Document doc;

    /**
     * construct an SVG area
     *
     * @param fontState the font state
     * @param width the width of the area
     * @param height the height of the area
     */
    public SVGArea(FontState fontState, float width, float height) {
        super(fontState, (int) width * 1000, (int) height * 1000);
        currentHeight = (int) height * 1000;
        contentRectangleWidth = (int) width * 1000;
    }

    public void setSVGDocument(Document doc) {
        this.doc = doc;
    }

    public Document getSVGDocument() {
        return doc;
    }

    public int getWidth() {
        //        return getSVGDocument().getRootElement().getWidth().getBaseVal().getValue();
        return contentRectangleWidth;
    }

    /**
     * render the SVG.
     *
     * @param renderer the Renderer to use
     */
    public void render(Renderer renderer) {
        renderer.renderSVGArea(this);
    }
}