2
* Licensed to the Apache Software Foundation (ASF) under one or more
3
* contributor license agreements. See the NOTICE file distributed with
4
* this work for additional information regarding copyright ownership.
5
* The ASF licenses this file to You under the Apache License, Version 2.0
6
* (the "License"); you may not use this file except in compliance with
7
* the License. You may obtain a copy of the License at
9
* http://www.apache.org/licenses/LICENSE-2.0
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
18
/* $Id: Overlay.java 426576 2006-07-28 15:44:37Z jeremias $ */
20
package org.apache.fop.render.afp.modca;
22
import java.io.ByteArrayOutputStream;
23
import java.io.IOException;
24
import java.io.OutputStream;
25
import java.util.Iterator;
29
public class Overlay extends AbstractPageObject{
32
* Construct a new overlay object for the specified name argument, the overlay
33
* name should be an 8 character identifier.
36
* the name of the page.
38
* the width of the page.
40
* the height of the page.
42
* the rotation of the page.
44
public Overlay(String name, int width, int height, int rotation) {
46
super(name, width, height, rotation);
51
* Accessor method to write the AFP datastream for the overlay.
53
* @param os The stream to write to
54
* @throws java.io.IOException
56
public void writeDataStream(OutputStream os)
61
_activeEnvironmentGroup.writeDataStream(os);
63
writeObjectList(_segments, os);
65
writeObjectList(_tagLogicalElements, os);
67
writeObjectList(_objects, os);
74
* Helper method to write the start of the overlay.
75
* @param os The stream to write to
77
private void writeStart(OutputStream os)
80
byte[] data = new byte[17];
82
data[0] = 0x5A; // Structured field identifier
83
data[1] = 0x00; // Length byte 1
84
data[2] = 0x10; // Length byte 2
85
data[3] = (byte) 0xD3; // Structured field id byte 1
86
data[4] = (byte) 0xA8; // Structured field id byte 2
87
data[5] = (byte) 0xDF; // Structured field id byte 3
88
data[6] = 0x00; // Flags
89
data[7] = 0x00; // Reserved
90
data[8] = 0x00; // Reserved
92
for (int i = 0; i < _nameBytes.length; i++) {
94
data[9 + i] = _nameBytes[i];
103
* Helper method to write the end of the overlay.
104
* @param os The stream to write to
106
private void writeEnd(OutputStream os)
109
byte[] data = new byte[17];
111
data[0] = 0x5A; // Structured field identifier
112
data[1] = 0x00; // Length byte 1
113
data[2] = 0x10; // Length byte 2
114
data[3] = (byte) 0xD3; // Structured field id byte 1
115
data[4] = (byte) 0xA9; // Structured field id byte 2
116
data[5] = (byte) 0xDF; // Structured field id byte 3
117
data[6] = 0x00; // Flags
118
data[7] = 0x00; // Reserved
119
data[8] = 0x00; // Reserved
121
for (int i = 0; i < _nameBytes.length; i++) {
123
data[9 + i] = _nameBytes[i];