aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/apache/fop/image/ImageArea.java
blob: 509ba92d4b3eabeed3d06a8db0d23a329f281436 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
 * $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.image;

import org.apache.fop.fo.properties.TextAlign;
import org.apache.fop.layout.*;
import org.apache.fop.layout.inline.*;

import org.apache.fop.render.Renderer;

import java.util.Vector;
import java.util.Enumeration;

public class ImageArea extends InlineArea {

    protected int xOffset = 0;
    protected int align;
    protected int valign;
    protected FopImage image;


    public ImageArea(FontState fontState, FopImage img, int AllocationWidth,
                     int width, int height, int startIndent, int endIndent,
                     int align) {
        super(fontState, width, 0, 0, 0);
        this.currentHeight = height;
        this.contentRectangleWidth = width;
        this.height = height;
        this.image = img;
        this.align = align;

        /*
         * switch (align) {
         * case TextAlign.START:
         * xOffset = startIndent;
         * break;
         * case TextAlign.END:
         * if (endIndent == 0)
         * endIndent = AllocationWidth;
         * xOffset = (endIndent - width);
         * break;
         * case TextAlign.JUSTIFY:
         * xOffset = startIndent;
         * break;
         * case TextAlign.CENTER:
         * if (endIndent == 0)
         * endIndent = AllocationWidth;
         * xOffset = startIndent + ((endIndent - startIndent) - width)/2;
         * break;
         * }
         */
    }

    public int getXOffset() {
        return this.xOffset;
    }

    public FopImage getImage() {
        return this.image;
    }

    public void render(Renderer renderer) {
        renderer.renderImageArea(this);
    }

    public int getImageHeight() {
        return currentHeight;
    }

    public void setAlign(int align) {
        this.align = align;
    }

    public int getAlign() {
        return this.align;
    }

    public void setVerticalAlign(int align) {
        this.valign = align;
    }

    public int getVerticalAlign() {
        return this.valign;
    }

    public void setStartIndent(int startIndent) {
        xOffset = startIndent;
    }



}