You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ac...@apache.org on 2008/11/17 16:26:08 UTC
svn commit: r718262 [2/2] - in
/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop:
afp/ afp/fonts/ afp/goca/ afp/ioca/ afp/modca/ afp/modca/triplets/ afp/svg/
svg/
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/MapCodedFont.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/MapCodedFont.java?rev=718262&r1=718261&r2=718262&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/MapCodedFont.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/MapCodedFont.java Mon Nov 17 07:26:06 2008
@@ -41,7 +41,7 @@
* the Map Coded Font structured field specifies a set of resource attributes
* for the coded font.
*/
-public class MapCodedFont extends AbstractStructuredAFPObject {
+public class MapCodedFont extends AbstractStructuredObject {
/**
* The collection of map coded fonts (maximum of 254)
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/MapContainerData.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/MapContainerData.java?rev=718262&r1=718261&r2=718262&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/MapContainerData.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/MapContainerData.java Mon Nov 17 07:26:06 2008
@@ -29,7 +29,7 @@
* The Map Container Data structured field specifies how a presentation data object
* that is carried in an Object Container is mapped into its object area.
*/
-public class MapContainerData extends AbstractStructuredAFPObject {
+public class MapContainerData extends AbstractTripletStructuredObject {
/**
* Main constructor
@@ -45,13 +45,15 @@
byte[] data = new byte[11];
copySF(data, Type.MAP, Category.OBJECT_CONTAINER);
int tripletLen = getTripletDataLength();
+
byte[] len = BinaryUtils.convert(10 + tripletLen, 2);
data[1] = len[0];
data[2] = len[1];
+
len = BinaryUtils.convert(2 + tripletLen, 2);
data[9] = len[0];
data[10] = len[1];
os.write(data);
- os.write(tripletData);
+ writeTriplets(os);
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/MapDataResource.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/MapDataResource.java?rev=718262&r1=718261&r2=718262&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/MapDataResource.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/MapDataResource.java Mon Nov 17 07:26:06 2008
@@ -28,7 +28,7 @@
* The Map Data Resource structured field specifies resources that are
* required for presentation.
*/
-public class MapDataResource extends AbstractStructuredAFPObject {
+public class MapDataResource extends AbstractTripletStructuredObject {
/**
* Main constructor
@@ -53,6 +53,6 @@
data[10] = len[1];
os.write(data);
- os.write(tripletData);
+ writeTriplets(os);
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/ObjectAreaDescriptor.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/ObjectAreaDescriptor.java?rev=718262&r1=718261&r2=718262&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/ObjectAreaDescriptor.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/ObjectAreaDescriptor.java Mon Nov 17 07:26:06 2008
@@ -22,11 +22,10 @@
import java.io.IOException;
import java.io.OutputStream;
-import org.apache.commons.io.output.ByteArrayOutputStream;
+import org.apache.fop.afp.modca.triplets.DescriptorPositionTriplet;
import org.apache.fop.afp.modca.triplets.MeasurementUnitsTriplet;
import org.apache.fop.afp.modca.triplets.ObjectAreaSizeTriplet;
import org.apache.fop.afp.modca.triplets.PresentationSpaceResetMixingTriplet;
-import org.apache.fop.afp.modca.triplets.Triplet;
import org.apache.fop.afp.util.BinaryUtils;
/**
@@ -48,40 +47,27 @@
super(width, height, widthRes, heightRes);
}
- /** {@inheritDoc} */
- protected byte[] getTripletData() throws IOException {
- if (tripletData == null) {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
- // Specifies the associated ObjectAreaPosition structured field
- final byte oapId = 0x01;
- Triplet triplet = new Triplet(Triplet.DESCRIPTOR_POSITION, oapId);
- triplet.writeToStream(baos);
-
- triplet = new MeasurementUnitsTriplet(widthRes, heightRes);
- triplet.writeToStream(baos);
-
- triplet = new ObjectAreaSizeTriplet(width, height);
- triplet.writeToStream(baos);
-
- triplet = new PresentationSpaceResetMixingTriplet(
- PresentationSpaceResetMixingTriplet.NOT_RESET);
- triplet.writeToStream(baos);
-
- this.tripletData = baos.toByteArray();
- }
- return this.tripletData;
- }
+ private static final byte oapId = 0x01;
/** {@inheritDoc} */
- public void writeStart(OutputStream os) throws IOException {
- super.writeStart(os);
+ public void writeToStream(OutputStream os) throws IOException {
+ // add triplets
+ addTriplet(new DescriptorPositionTriplet(oapId));
+ addTriplet(new MeasurementUnitsTriplet(widthRes, heightRes));
+ addTriplet(new ObjectAreaSizeTriplet(width, height));
+ addTriplet(new PresentationSpaceResetMixingTriplet(
+ PresentationSpaceResetMixingTriplet.NOT_RESET));
+
byte[] data = new byte[9];
copySF(data, Type.DESCRIPTOR, Category.OBJECT_AREA);
- byte[] len = BinaryUtils.convert(data.length + tripletData.length - 1, 2);
+
+ int tripletDataLength = getTripletDataLength();
+ byte[] len = BinaryUtils.convert(data.length + tripletDataLength, 2);
data[1] = len[0]; // Length
data[2] = len[1];
os.write(data);
+
+ writeTriplets(os);
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/PreprocessPresentationObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/PreprocessPresentationObject.java?rev=718262&r1=718261&r2=718262&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/PreprocessPresentationObject.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/PreprocessPresentationObject.java Mon Nov 17 07:26:06 2008
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -27,24 +27,24 @@
/**
* The Preprocess Presentation Object structured field specifies presentation
- * parameters for a data object that has been mapped as a resource.
+ * parameters for a data object that has been mapped as a resource.
*/
-public class PreprocessPresentationObject extends AbstractStructuredAFPObject {
+public class PreprocessPresentationObject extends AbstractTripletStructuredObject {
private static final byte TYPE_OTHER = (byte)0x92;
private static final byte TYPE_OVERLAY = (byte)0xDF;
private static final byte TYPE_IMAGE = (byte)0xFB;
-
+
private byte objType = TYPE_OTHER;
private byte objOrent = 0; // object always processed at 0 degree orientation
private int objXOffset = -1;
private int objYOffset = -1;
-
+
/**
* Main constructor
- *
- * @param prePresObj the presentation object to be preprocessed
+ *
+ * @param prePresObj the presentation object to be preprocessed
*/
- public PreprocessPresentationObject(AbstractStructuredAFPObject prePresObj) {
+ public PreprocessPresentationObject(AbstractTripletStructuredObject prePresObj) {
if (prePresObj instanceof ImageObject || prePresObj instanceof Overlay) {
if (prePresObj instanceof ImageObject) {
this.objType = TYPE_IMAGE;
@@ -52,40 +52,40 @@
this.objType = TYPE_OVERLAY;
}
setFullyQualifiedName(
- FullyQualifiedNameTriplet.TYPE_BEGIN_RESOURCE_OBJECT_REF,
+ FullyQualifiedNameTriplet.TYPE_BEGIN_RESOURCE_OBJECT_REF,
FullyQualifiedNameTriplet.FORMAT_CHARSTR,
prePresObj.getFullyQualifiedName());
} else {
this.objType = TYPE_OTHER;
}
}
-
+
public static final byte ORIENTATION_ZERO_DEGREES = 1;
public static final byte ORIENTATION_90_DEGREES = 2;
public static final byte ORIENTATION_180_DEGREES = 4;
public static final byte ORIENTATION_270_DEGREES = 8;
-
+
/**
* Sets the object orientations relative to media leading edge
- *
+ *
* @param orientation the object orientations relative to media leading edge
*/
public void setOrientation(byte orientation) {
- objOrent = (byte)orientation;
+ objOrent = orientation;
}
-
+
/**
* Sets the X axis origin for object content
- *
+ *
* @param xOffset the X axis origin for object content
*/
public void setXOffset(int xOffset) {
- this.objXOffset = xOffset;
+ this.objXOffset = xOffset;
}
-
+
/**
* Sets the Y axis origin for object content
- *
+ *
* @param yOffset the Y axis origin for object content
*/
public void setYOffset(int yOffset) {
@@ -105,7 +105,7 @@
os.write(data);
}
-
+
/** {@inheritDoc} */
public void writeContent(OutputStream os) throws IOException {
byte[] data = new byte[12];
@@ -137,7 +137,7 @@
data[11] = (byte)0xFF; // YocaOset
}
os.write(data);
-
+
// Triplets
super.writeContent(os);
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/PresentationEnvironmentControl.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/PresentationEnvironmentControl.java?rev=718262&r1=718261&r2=718262&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/PresentationEnvironmentControl.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/PresentationEnvironmentControl.java Mon Nov 17 07:26:06 2008
@@ -22,7 +22,6 @@
import java.io.IOException;
import java.io.OutputStream;
-import org.apache.fop.afp.modca.triplets.Triplet;
import org.apache.fop.afp.util.BinaryUtils;
/**
@@ -30,7 +29,7 @@
* affect the rendering of presentation data and the appearance that is to be assumed
* by the presentation device.
*/
-public class PresentationEnvironmentControl extends AbstractStructuredAFPObject {
+public class PresentationEnvironmentControl extends AbstractTripletStructuredObject {
/**
* Main constructor
@@ -38,27 +37,6 @@
public PresentationEnvironmentControl() {
}
- /**
- * Sets the object offset
- */
- public void setObjectOffset() {
- addTriplet(new ObjectOffsetTriplet());
- }
-
- /**
- * Sets the rendering intent
- */
- public void setRenderingIntent() {
- addTriplet(new RenderingIntentTriplet());
- }
-
- /**
- * Sets the device appearance
- */
- public void setDeviceAppearance() {
- addTriplet(new DeviceAppearanceTriplet());
- }
-
/** {@inheritDoc} */
public void writeToStream(OutputStream os) throws IOException {
byte[] data = new byte[11];
@@ -71,27 +49,50 @@
data[10] = 0x00; // Reserved; must be zero
os.write(data);
- os.write(tripletData);
+
+ writeTriplets(os);
}
+// /**
+// * Sets the object offset
+// */
+// public void setObjectOffset() {
+// addTriplet(new ObjectOffsetTriplet());
+// }
+//
+// /**
+// * Sets the rendering intent
+// */
+// public void setRenderingIntent() {
+// addTriplet(new RenderingIntentTriplet());
+// }
+//
+// /**
+// * Sets the device appearance
+// */
+// public void setDeviceAppearance() {
+// addTriplet(new DeviceAppearanceTriplet());
+// }
+
+
// TODO
- private class DeviceAppearanceTriplet extends Triplet {
- public DeviceAppearanceTriplet() {
- super(Triplet.DEVICE_APPEARANCE);
- }
- }
+// private class DeviceAppearanceTriplet extends AbstractTriplet {
+// public DeviceAppearanceTriplet() {
+// super(AbstractTriplet.DEVICE_APPEARANCE);
+// }
+// }
// TODO
- private class RenderingIntentTriplet extends Triplet {
- public RenderingIntentTriplet() {
- super(Triplet.RENDERING_INTENT);
- }
- }
+// private class RenderingIntentTriplet extends AbstractTriplet {
+// public RenderingIntentTriplet() {
+// super(AbstractTriplet.RENDERING_INTENT);
+// }
+// }
// TODO
- private class ObjectOffsetTriplet extends Triplet {
- public ObjectOffsetTriplet() {
- super(Triplet.OBJECT_OFFSET);
- }
- }
+// private class ObjectOffsetTriplet extends AbstractTriplet {
+// public ObjectOffsetTriplet() {
+// super(AbstractTriplet.OBJECT_OFFSET);
+// }
+// }
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/Registry.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/Registry.java?rev=718262&r1=718261&r2=718262&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/Registry.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/Registry.java Mon Nov 17 07:26:06 2008
@@ -30,6 +30,7 @@
/** IOB supported object types */
private static final byte COMPID_IOCA_FS10 = 5;
private static final byte COMPID_IOCA_FS11 = 11;
+ private static final byte COMPID_IOCA_FS40 = 55;
private static final byte COMPID_IOCA_FS45 = 12;
private static final byte COMPID_EPS = 13;
private static final byte COMPID_TIFF = 14;
@@ -38,6 +39,9 @@
private static final byte COMPID_PDF_SINGLE_PAGE = 25;
private static final byte COMPID_PCL_PAGE_OBJECT = 34;
+ private static final byte COMPID_TRUETYPE_OPENTYPE_FONT_RESOURCE_OBJECT = 51;
+ private static final byte COMPID_TRUETYPE_OPENTYPE_FONT_COLLECTION_RESOURCE_OBJECT = 53;
+
/** mime type entry mapping */
private final java.util.Map/*<String, ObjectType>*/ mimeObjectTypeMap
= Collections.synchronizedMap(
@@ -91,6 +95,16 @@
MimeConstants.MIME_AFP_IOCA_FS11
)
);
+// mimeObjectTypeMap.put(
+// MimeConstants.MIME_AFP_IOCA_FS40,
+// new ObjectType(
+// COMPID_IOCA_FS40,
+// new byte[] {0x06, 0x07, 0x2B, 0x12, 0x00, 0x04, 0x01, 0x01, 0x37},
+// "IOCA FS40",
+// true,
+// MimeConstants.MIME_AFP_IOCA_FS40
+// )
+//);
mimeObjectTypeMap.put(
MimeConstants.MIME_AFP_IOCA_FS45,
new ObjectType(
@@ -160,6 +174,26 @@
MimeConstants.MIME_PCL
)
);
+// mimeObjectTypeMap.put(
+// null,
+// new ObjectType(
+// COMPID_TRUETYPE_OPENTYPE_FONT_RESOURCE_OBJECT,
+// new byte[] {0x06, 0x07, 0x2B, 0x12, 0x00, 0x04, 0x01, 0x01, 0x33},
+// "TrueType/OpenType Font Resource Object",
+// true,
+// null
+// )
+// );
+// mimeObjectTypeMap.put(
+// null,
+// new ObjectType(
+// COMPID_TRUETYPE_OPENTYPE_FONT_COLLECTION_RESOURCE_OBJECT,
+// new byte[] {0x06, 0x07, 0x2B, 0x12, 0x00, 0x04, 0x01, 0x01, 0x35},
+// "TrueType/OpenType Font Collection Resource Object",
+// true,
+// null
+// )
+// );
}
/**
@@ -193,11 +227,11 @@
*/
public ObjectType(byte componentId, byte[] oid, String name,
boolean includable, String mimeType) {
+ this.componentId = componentId;
+ this.oid = oid;
this.name = name;
this.includable = includable;
this.mimeType = mimeType;
- this.componentId = componentId;
- this.oid = oid;
}
/**
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/ResourceObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/ResourceObject.java?rev=718262&r1=718261&r2=718262&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/ResourceObject.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/ResourceObject.java Mon Nov 17 07:26:06 2008
@@ -22,14 +22,50 @@
import java.io.IOException;
import java.io.OutputStream;
-import org.apache.fop.afp.modca.triplets.Triplet;
+import org.apache.fop.afp.modca.triplets.ResourceObjectTypeTriplet;
import org.apache.fop.afp.util.BinaryUtils;
/**
* This resource structured field begins an envelope that is used to carry
* resource objects in print-file-level (external) resource groups.
*/
-public class ResourceObject extends AbstractPreparedAFPObject {
+public class ResourceObject extends AbstractNamedAFPObject {
+
+ /** graphics object type */
+ public static final byte TYPE_GRAPHIC = 0x03;
+
+ /** barcode object type */
+ public static final byte TYPE_BARCODE = 0x05;
+
+ /** image object type */
+ public static final byte TYPE_IMAGE = 0x06;
+
+ /** font character set type */
+ public static final byte TYPE_FONT_CHARACTER_SET = 0x40;
+
+ /** code page type */
+ public static final byte TYPE_CODE_PAGE = 0x41;
+
+ /** coded font type */
+ public static final byte TYPE_CODED_FONT = 0x42;
+
+ /** object container type */
+ public static final byte TYPE_OBJECT_CONTAINER = (byte) 0x92;
+
+ /** document object type */
+ public static final byte TYPE_DOCUMENT = (byte) 0xA8;
+
+ /** page segment object type */
+ public static final byte TYPE_PAGE_SEGMENT = (byte) 0xFB;
+
+ /** overlay object type */
+ public static final byte TYPE_OVERLAY_OBJECT = (byte) 0xFC;
+
+ /** page def type */
+ public static final byte TYPE_PAGEDEF = (byte) 0xFD;
+
+ /** form def type */
+ public static final byte TYPE_FORMDEF = (byte) 0xFE;
private AbstractNamedAFPObject namedObject;
@@ -45,10 +81,10 @@
/**
* Sets the data object referenced by this resource object
*
- * @param obj the named data object
+ * @param namedObject the named data object
*/
- public void setDataObject(AbstractNamedAFPObject obj) {
- this.namedObject = obj;
+ public void setDataObject(AbstractNamedAFPObject namedObject) {
+ this.namedObject = namedObject;
}
/**
@@ -78,11 +114,13 @@
data[18] = 0x00; // Reserved
os.write(data);
+
+ // Write triplets
+ writeTriplets(os);
}
/** {@inheritDoc} */
protected void writeContent(OutputStream os) throws IOException {
- super.writeContent(os); // write triplets
if (namedObject != null) {
namedObject.writeToStream(os);
}
@@ -109,60 +147,4 @@
getTriplets().add(new ResourceObjectTypeTriplet(type));
}
- /** graphics object type */
- public static final byte TYPE_GRAPHIC = 0x03;
-
- /** barcode object type */
- public static final byte TYPE_BARCODE = 0x05;
-
- /** image object type */
- public static final byte TYPE_IMAGE = 0x06;
-
- /** font character set type */
- public static final byte TYPE_FONT_CHARACTER_SET = 0x40;
-
- /** code page type */
- public static final byte TYPE_CODE_PAGE = 0x41;
-
- /** coded font type */
- public static final byte TYPE_CODED_FONT = 0x42;
-
- /** object container type */
- public static final byte TYPE_OBJECT_CONTAINER = (byte) 0x92;
-
- /** document object type */
- public static final byte TYPE_DOCUMENT = (byte) 0xA8;
-
- /** page segment object type */
- public static final byte TYPE_PAGE_SEGMENT = (byte) 0xFB;
-
- /** overlay object type */
- public static final byte TYPE_OVERLAY_OBJECT = (byte) 0xFC;
-
- /** page def type */
- public static final byte TYPE_PAGEDEF = (byte) 0xFD;
-
- /** form def type */
- public static final byte TYPE_FORMDEF = (byte) 0xFE;
-
-
- /** resource object type triplet */
- private class ResourceObjectTypeTriplet extends Triplet {
-
- private static final byte RESOURCE_OBJECT = 0x21;
-
- /**
- * Main constructor
- *
- * @param objectType the resource object type
- */
- public ResourceObjectTypeTriplet(byte objectType) {
- super(RESOURCE_OBJECT,
- new byte[] {
- objectType,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // Constant Data
- }
- );
- }
- }
}
Copied: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/StructuredDataObject.java (from r713745, xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/PreparedAFPObject.java)
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/StructuredDataObject.java?p2=xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/StructuredDataObject.java&p1=xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/PreparedAFPObject.java&r1=713745&r2=718262&rev=718262&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/PreparedAFPObject.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/StructuredDataObject.java Mon Nov 17 07:26:06 2008
@@ -20,15 +20,14 @@
package org.apache.fop.afp.modca;
/**
- * An AFP object which is able to know its own data length before write()
+ * An AFP object which is able to know its own data length before writeToStream()
*/
-public interface PreparedAFPObject {
+public interface StructuredDataObject {
/**
- * Returns the current data length of this container
+ * Returns the data length of this structured field
*
- * @return the current data length of this container including
- * all enclosed GOCA drawing objects
+ * @return the data length of this structured field
*/
int getDataLength();
}
\ No newline at end of file
Copied: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/AbstractTriplet.java (from r713745, xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/Triplet.java)
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/AbstractTriplet.java?p2=xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/AbstractTriplet.java&p1=xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/Triplet.java&r1=713745&r2=718262&rev=718262&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/Triplet.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/AbstractTriplet.java Mon Nov 17 07:26:06 2008
@@ -19,17 +19,13 @@
package org.apache.fop.afp.modca.triplets;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-
-import org.apache.fop.afp.AFPConstants;
import org.apache.fop.afp.Streamable;
+import org.apache.fop.afp.modca.StructuredDataObject;
/**
* A simple implementation of a MOD:CA triplet
*/
-public class Triplet implements Streamable {
+public abstract class AbstractTriplet implements Streamable, StructuredDataObject {
public static final byte CODED_GRAPHIC_CHARACTER_SET_GLOBAL_IDENTIFIER = 0x01;
/** Triplet identifiers */
@@ -89,60 +85,18 @@
public static final byte DEVICE_APPEARANCE = (byte)0x97;
/** the triplet identifier */
- private final byte id;
-
- /** the triplet's data contents */
- private byte[] data;
-
- /**
- * Main constructor
- *
- * @param id the triplet identifier (see static definitions above)
- * @param data the data item contained in this triplet
- */
- public Triplet(byte id, byte[] data) {
- this(id);
- setData(data);
- }
+ protected final byte id;
/**
* Constructor
*
* @param id the triplet identifier (see static definitions above)
*/
- public Triplet(byte id) {
+ public AbstractTriplet(byte id) {
this.id = id;
}
/**
- * Constructor
- *
- * @param id the triplet identifier (see static definitions above)
- * @param content the content byte data
- */
- public Triplet(byte id, byte content) {
- this(id, new byte[] {content});
- }
-
- /**
- * Constructor
- *
- * @param id the triplet identifier (see static definitions above)
- * @param data the data item (in String form) contained in this triplet
- * @throws UnsupportedEncodingException EBCIDIC encoding is not supported
- */
- public Triplet(byte id, String data) throws UnsupportedEncodingException {
- this(id, data.getBytes(AFPConstants.EBCIDIC_ENCODING));
- }
-
- /** {@inheritDoc} */
- public void writeToStream(OutputStream os) throws IOException {
- os.write((byte)data.length + 2);
- os.write(id);
- os.write(data);
- }
-
- /**
* Returns the triplet identifier
*
* @return the triplet identifier
@@ -152,11 +106,15 @@
}
/**
- * Sets the data contents of this triplet
+ * Returns the structured triplet data array
*
- * @param data the data contents
+ * @return the structured triplet data array
*/
- protected void setData(byte[] data) {
- this.data = data;
+ public byte[] getData() {
+ int dataLen = getDataLength();
+ byte[] data = new byte[dataLen];
+ data[0] = (byte)dataLen;
+ data[1] = id;
+ return data;
}
}
Added: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/CommentTriplet.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/CommentTriplet.java?rev=718262&view=auto
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/CommentTriplet.java (added)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/CommentTriplet.java Mon Nov 17 07:26:06 2008
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.afp.modca.triplets;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.apache.fop.afp.AFPConstants;
+
+/**
+ * An inline comment triplet.
+ */
+public class CommentTriplet extends AbstractTriplet {
+
+ private final String commentString;
+
+ public CommentTriplet(byte id, String commentString) {
+ super(id);
+ this.commentString = commentString;
+ }
+
+ /** {@inheritDoc} */
+ public int getDataLength() {
+ return 2 + commentString.length();
+ }
+
+ /** {@inheritDoc} */
+ public void writeToStream(OutputStream os) throws IOException {
+ byte[] data = getData();
+ byte[] strData = commentString.getBytes(AFPConstants.EBCIDIC_ENCODING);
+ System.arraycopy(strData, 0, data, 2, strData.length);
+ os.write(data);
+ }
+
+}
Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/CommentTriplet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/CommentTriplet.java
------------------------------------------------------------------------------
svn:keywords = Revision Id
Added: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/DescriptorPositionTriplet.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/DescriptorPositionTriplet.java?rev=718262&view=auto
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/DescriptorPositionTriplet.java (added)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/DescriptorPositionTriplet.java Mon Nov 17 07:26:06 2008
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.afp.modca.triplets;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+public class DescriptorPositionTriplet extends AbstractTriplet {
+
+ private final byte oapId;
+
+ /**
+ * Main constructor
+ *
+ * @param oapId the object area position id
+ */
+ public DescriptorPositionTriplet(byte oapId) {
+ super(DESCRIPTOR_POSITION);
+ this.oapId = oapId;
+ }
+
+ /** {@inheritDoc} */
+ public int getDataLength() {
+ return 3;
+ }
+
+ /** {@inheritDoc} */
+ public void writeToStream(OutputStream os) throws IOException {
+ byte[] data = getData();
+ data[2] = oapId;
+ os.write(data);
+ }
+}
Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/DescriptorPositionTriplet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/DescriptorPositionTriplet.java
------------------------------------------------------------------------------
svn:keywords = Revision Id
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/ExtendedResourceLocalIdentifierTriplet.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/ExtendedResourceLocalIdentifierTriplet.java?rev=718262&r1=718261&r2=718262&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/ExtendedResourceLocalIdentifierTriplet.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/ExtendedResourceLocalIdentifierTriplet.java Mon Nov 17 07:26:06 2008
@@ -19,6 +19,9 @@
package org.apache.fop.afp.modca.triplets;
+import java.io.IOException;
+import java.io.OutputStream;
+
import org.apache.fop.afp.util.BinaryUtils;
/**
@@ -27,7 +30,7 @@
* resource name by a map structured field, such as a Map Data Resource structured
* field, or a Map Media Type structured field.
*/
-public class ExtendedResourceLocalIdentifierTriplet extends Triplet {
+public class ExtendedResourceLocalIdentifierTriplet extends AbstractTriplet {
/** the image resource type */
public static final byte TYPE_IMAGE_RESOURCE = 0x10;
@@ -38,6 +41,12 @@
/** the retired value type */
public static final byte TYPE_MEDIA_RESOURCE = 0x40;
+ /** the resource type */
+ private final byte type;
+
+ /** the resource local id */
+ private final int localId;
+
/**
* Main constructor
*
@@ -45,11 +54,22 @@
* @param localId the resource local id
*/
public ExtendedResourceLocalIdentifierTriplet(byte type, int localId) {
- super(Triplet.EXTENDED_RESOURCE_LOCAL_IDENTIFIER);
- byte[] data = new byte[5];
- data[0] = type;
- byte[] resLID = BinaryUtils.convert(localId, 4);
- System.arraycopy(resLID, 0, data, 1, resLID.length);
- super.setData(data);
+ super(AbstractTriplet.EXTENDED_RESOURCE_LOCAL_IDENTIFIER);
+ this.type = type;
+ this.localId = localId;
+ }
+
+ /** {@inheritDoc} */
+ public void writeToStream(OutputStream os) throws IOException {
+ byte[] data = getData();
+ data[2] = type;
+ byte[] resLID = BinaryUtils.convert(localId, 4); // 4 bytes
+ System.arraycopy(resLID, 0, data, 3, resLID.length);
+ os.write(data);
+ }
+
+ /** {@inheritDoc} */
+ public int getDataLength() {
+ return 7;
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/FullyQualifiedNameTriplet.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/FullyQualifiedNameTriplet.java?rev=718262&r1=718261&r2=718262&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/FullyQualifiedNameTriplet.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/FullyQualifiedNameTriplet.java Mon Nov 17 07:26:06 2008
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,105 +19,107 @@
package org.apache.fop.afp.modca.triplets;
+import java.io.IOException;
+import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import org.apache.fop.afp.AFPConstants;
/**
* A Fully Qualified Name triplet enable the identification and referencing of
- * objects using Gloabl Identifiers (GIDs).
+ * objects using Gloabl Identifiers (GIDs).
*/
-public class FullyQualifiedNameTriplet extends Triplet {
+public class FullyQualifiedNameTriplet extends AbstractTriplet {
// Specifies how the GID will be used
/** This GID replaces the first parameter in the structured field that contains a GID name. */
public static final byte TYPE_REPLACE_FIRST_GID_NAME = 0x01;
-
+
/** This triplet contains the name of a font family. */
public static final byte TYPE_FONT_FAMILY_NAME = 0x07;
-
+
/** This triplet contains the name of a font typeface. */
public static final byte TYPE_FONT_TYPEFACE_NAME = 0x08;
-
+
/** This triplet specifies a reference to the MO:DCA resource hierarchy. */
public static final byte TYPE_MODCA_RESOURCE_HIERARCHY_REF = 0x09;
-
+
/** The triplet contains a GID reference to a begin resource group structured field. */
public static final byte TYPE_BEGIN_RESOURCE_GROUP_REF = 0x0A;
-
+
/** The triplet contains a GID reference to a document attribute. */
public static final byte TYPE_ATTRIBUTE_GID = 0x0B;
-
+
/** The triplet contains the GID of a process element. */
public static final byte TYPE_PROCESS_ELEMENT_GID = 0x0C;
-
+
/** The triplet contains a reference to a begin page group structured field. */
public static final byte TYPE_BEGIN_PAGE_GROUP_REF = 0x0D;
-
+
/** The triplet contains a reference to a media type. */
public static final byte TYPE_MEDIA_TYPE_REF = 0x11;
-
+
/** The triplet contains a reference to a color management resource. */
public static final byte TYPE_COLOR_MANAGEMENT_RESOURCE_REF = 0x41;
/** The triplet contains a reference to a data-object font file that defines a base font. */
public static final byte TYPE_DATA_OBJECT_FONT_BASE_FONT_ID = 0x6E;
-
+
/** The triplet contains a reference to a data-object font file that defines a linked font. */
public static final byte TYPE_DATA_OBJECT_FONT_LINKED_FONT_ID = 0x7E;
-
- /** The triplet contains a reference to a begin document structured field. */
+
+ /** The triplet contains a reference to a begin document structured field. */
public static final byte TYPE_BEGIN_DOCUMENT_REF = (byte)0x83;
-
+
/**
* The triplet contains a reference to a begin structured field associated with a resource;
* or contains a GID reference to a coded font.
*/
public static final byte TYPE_BEGIN_RESOURCE_OBJECT_REF = (byte)0x84;
-
+
/**
* The triplet contains a GID reference to a code page that specifies the code points and
* graphic character names for a coded font.
*/
public static final byte TYPE_CODE_PAGE_NAME_REF = (byte)0x85;
-
- /**
+
+ /**
* The triplet contains a GID name reference to a font character set that specifies
* a set of graphics characters.
*/
public static final byte TYPE_FONT_CHARSET_NAME_REF = (byte)0x86;
-
+
/** The triplet contains a GID reference to a begin page structured field. */
public static final byte TYPE_BEGIN_PAGE_REF = (byte)0x87;
-
+
/** The triplet contains a GID reference to a begin medium map structured field. */
public static final byte TYPE_BEGIN_MEDIUM_MAP_REF = (byte)0x8D;
-
+
/**
* The triplet contains a GID reference to a coded font, which identifies a specific
* code page and a specific font character set.
*/
public static final byte TYPE_CODED_FONT_NAME_REF = (byte)0x8E;
-
+
/** The triplet contains a GID reference to a begin document index structured field. */
- public static final byte TYPE_BEGIN_DOCUMENT_INDEX_REF = (byte)0x98;
-
+ public static final byte TYPE_BEGIN_DOCUMENT_INDEX_REF = (byte)0x98;
+
/** The triplet contains a GID reference to a begin overlay structured field. */
public static final byte TYPE_BEGIN_OVERLAY_REF = (byte)0xB0;
-
+
/** The triplet contains a GID reference to a resource used by a data object. */
public static final byte TYPE_DATA_OBJECT_INTERNAL_RESOURCE_REF = (byte)0xBE;
-
+
/** The triplet contains a GID reference to an index element structured field. */
public static final byte TYPE_INDEX_ELEMENT_GID = (byte)0xCA;
-
+
/**
* The triplet contains a reference to other object data which may or may
* not be defined by an IBM presentation architecture.
*/
public static final byte TYPE_OTHER_OBJECT_DATA_REF = (byte)0xCE;
-
+
/**
* The triplet contains a reference to a resource used by a data object.
* The GID may be a filename or any other identifier associated with the
@@ -127,44 +129,71 @@
*/
public static final byte TYPE_DATA_OBJECT_EXTERNAL_RESOURCE_REF = (byte)0xDE;
-
+
// GID Format
-
+
/** The GID is a character encoded name. */
public static final byte FORMAT_CHARSTR = (byte)0x00;
-
+
/** the GID is a ASN.1 object identifier (OID). */
public static final byte FORMAT_OID = (byte)0x10;
/** the GID is a uniform resource locator (URL). */
public static final byte FORMAT_URL = (byte)0x20;
-
- private String fqName;
-
- /**
- * @return the actual fully qualified name of this triplet
- */
- public String getFullyQualifiedName() {
- return fqName;
- }
+ /** the fully qualified name type */
+ private final byte type;
+
+ /** the fully qualified name format */
+ private final byte format;
+
+ /** the actual fully qualified name */
+ private final String fqName;
/**
* Main constructor
- *
+ *
* @param type the fully qualified name type
* @param format the fully qualified name format
* @param fqName the fully qualified name
*/
public FullyQualifiedNameTriplet(byte type, byte format, String fqName) {
super(FULLY_QUALIFIED_NAME);
-
+ this.type = type;
+ this.format = format;
this.fqName = fqName;
+ }
+ /**
+ * Returns the actual fully qualified name
+ *
+ * @return the actual fully qualified name
+ */
+ public String getFullyQualifiedName() {
+ return fqName;
+ }
+
+ /** {@inheritDoc} */
+ public String toString() {
+ return this.fqName;
+ }
+
+ /** {@inheritDoc} */
+ public int getDataLength() {
+ return 4 + fqName.length();
+ }
+
+ /** {@inheritDoc} */
+ public void writeToStream(OutputStream os) throws IOException {
+ byte[] data = getData();
+ data[2] = type;
+ data[3] = format;
+
+ // FQName
byte[] fqNameBytes;
- String encoding = AFPConstants.EBCIDIC_ENCODING;
+ String encoding = AFPConstants.EBCIDIC_ENCODING;
if (format == FORMAT_URL) {
- encoding = AFPConstants.US_ASCII_ENCODING;
+ encoding = AFPConstants.US_ASCII_ENCODING;
}
try {
fqNameBytes = fqName.getBytes(encoding);
@@ -172,20 +201,8 @@
throw new IllegalArgumentException(
encoding + " encoding failed");
}
+ System.arraycopy(fqNameBytes, 0, data, 4, fqNameBytes.length);
- byte[] data = new byte[2 + fqNameBytes.length];
- data[0] = type;
- data[1] = format;
- // FQName
- System.arraycopy(fqNameBytes, 0, data, 2, fqNameBytes.length);
-
- super.setData(data);
- }
-
- /**
- * {@inheritDoc}
- */
- public String toString() {
- return this.fqName;
+ os.write(data);
}
}
\ No newline at end of file
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/MappingOptionTriplet.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/MappingOptionTriplet.java?rev=718262&r1=718261&r2=718262&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/MappingOptionTriplet.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/MappingOptionTriplet.java Mon Nov 17 07:26:06 2008
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,10 +19,13 @@
package org.apache.fop.afp.modca.triplets;
+import java.io.IOException;
+import java.io.OutputStream;
+
/**
* Specifies the mapping of data object presentation space to object area
*/
-public class MappingOptionTriplet extends Triplet {
+public class MappingOptionTriplet extends AbstractTriplet {
/**
* the data object is placed in the upper left corner, all data must be presented
* within the object area extents
@@ -34,35 +37,51 @@
* the object area extents will be presented but data that falls outside will not be presented
*/
public static final byte POSITION_AND_TRIM = 0x10;
-
+
/**
* the data object is centred and symmetrically scaled up or down
* while preserving aspect ratio
*/
public static final byte SCALE_TO_FIT = 0x20;
-
+
/**
* the data object is centred, all data that falls within the object area extents
* will be presented but data that falls outside will not be presented
*/
public static final byte CENTER_AND_TRIM = 0x30;
-
+
// public static final byte MIGRATION_MAPPING_1 = 0x41;
// public static final byte MIGRATION_MAPPING_2 = 0x42;
// public static final byte MIGRATION_MAPPING_3 = 0x50;
-
+
/** the data object is centred, aspect ratio is not always preserved */
public static final byte SCALE_TO_FILL = 0x60;
-
+
/** used to map ip3i print data objects */
public static final byte UP3I_PRINT_DATA = 0x70;
+ private final byte mapValue;
+
/**
* Main constructor
- *
+ *
* @param mapValue the mapping option to use
*/
public MappingOptionTriplet(byte mapValue) {
- super(Triplet.MAPPING_OPTION, mapValue);
+ super(AbstractTriplet.MAPPING_OPTION);
+ this.mapValue = mapValue;
+ }
+
+ /** {@inheritDoc} */
+ public int getDataLength() {
+ return 3;
+ }
+
+ /** {@inheritDoc} */
+ public void writeToStream(OutputStream os) throws IOException {
+ byte[] data = getData();
+ data[2] = mapValue;
+
+ os.write(data);
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/MeasurementUnitsTriplet.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/MeasurementUnitsTriplet.java?rev=718262&r1=718261&r2=718262&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/MeasurementUnitsTriplet.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/MeasurementUnitsTriplet.java Mon Nov 17 07:26:06 2008
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,36 +19,54 @@
package org.apache.fop.afp.modca.triplets;
+import java.io.IOException;
+import java.io.OutputStream;
+
import org.apache.fop.afp.util.BinaryUtils;
/**
* The Measurement Units triplet is used to specify the units of measure
* for a presentation space
*/
-public class MeasurementUnitsTriplet extends Triplet {
+public class MeasurementUnitsTriplet extends AbstractTriplet {
- private static final byte TEN_INCHES = 0x00;
+ private static final byte TEN_INCHES = 0x00;
private static final byte TEN_CM = 0x01;
-
+ private final int xRes;
+ private final int yRes;
+
/**
* Main constructor
- *
+ *
* @param xRes units per base on the x-axis
* @param yRes units per base on the y-axis
*/
public MeasurementUnitsTriplet(int xRes, int yRes) {
super(MEASUREMENT_UNITS);
- //TODO: units correct?
+ this.xRes = xRes;
+ this.yRes = yRes;
+ }
+
+ /** {@inheritDoc} */
+ public int getDataLength() {
+ return 8;
+ }
+
+ /** {@inheritDoc} */
+ public void writeToStream(OutputStream os) throws IOException {
+ byte[] data = getData();
+
+ data[2] = TEN_INCHES; // XoaBase
+ data[3] = TEN_INCHES; // YoaBase
+
byte[] xUnits = BinaryUtils.convert(xRes * 10, 2);
+ data[4] = xUnits[0]; // XoaUnits (x units per unit base)
+ data[5] = xUnits[1];
+
byte[] yUnits = BinaryUtils.convert(yRes * 10, 2);
- byte[] data = new byte[] {
- TEN_INCHES, // XoaBase
- TEN_INCHES, // YoaBase
- xUnits[0], // XoaUnits (x units per unit base)
- xUnits[1],
- yUnits[0], // YoaUnits (y units per unit base)
- yUnits[1]
- };
- super.setData(data);
+ data[6] = yUnits[0]; // YoaUnits (y units per unit base)
+ data[7] = yUnits[1];
+
+ os.write(data);
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/ObjectAreaSizeTriplet.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/ObjectAreaSizeTriplet.java?rev=718262&r1=718261&r2=718262&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/ObjectAreaSizeTriplet.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/ObjectAreaSizeTriplet.java Mon Nov 17 07:26:06 2008
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,44 +19,66 @@
package org.apache.fop.afp.modca.triplets;
+import java.io.IOException;
+import java.io.OutputStream;
+
import org.apache.fop.afp.util.BinaryUtils;
/**
* The Object Area Size triplet is used to specify the extent of an object area
* in the X and Y directions
*/
-public class ObjectAreaSizeTriplet extends Triplet {
+public class ObjectAreaSizeTriplet extends AbstractTriplet {
+
+ private final int x;
+ private final int y;
+ private final byte type;
/**
* Main constructor
- *
+ *
* @param x the object area extent for the X axis
* @param y the object area extent for the Y axis
* @param type the object area size type
*/
public ObjectAreaSizeTriplet(int x, int y, byte type) {
- super(Triplet.OBJECT_AREA_SIZE);
- byte[] xOASize = BinaryUtils.convert(x, 3);
- byte[] yOASize = BinaryUtils.convert(y, 3);
- byte[] data = new byte[] {
- type, // SizeType
- xOASize[0], // XoaSize - Object area extent for X axis
- xOASize[1],
- xOASize[2],
- yOASize[0], // YoaSize - Object area extent for Y axis
- yOASize[1],
- yOASize[2]
- };
- super.setData(data);
+ super(AbstractTriplet.OBJECT_AREA_SIZE);
+ this.x = x;
+ this.y = y;
+ this.type = type;
}
/**
* Main constructor
- *
+ *
* @param x the object area extent for the X axis
* @param y the object area extent for the Y axis
*/
public ObjectAreaSizeTriplet(int x, int y) {
this(x, y, (byte)0x02);
}
+
+ /** {@inheritDoc} */
+ public int getDataLength() {
+ return 9;
+ }
+
+ /** {@inheritDoc} */
+ public void writeToStream(OutputStream os) throws IOException {
+ byte[] data = getData();
+
+ data[2] = type; // SizeType
+
+ byte[] xOASize = BinaryUtils.convert(x, 3);
+ data[3] = xOASize[0]; // XoaSize - Object area extent for X axis
+ data[4] = xOASize[1];
+ data[5] = xOASize[2];
+
+ byte[] yOASize = BinaryUtils.convert(y, 3);
+ data[6] = yOASize[0]; // YoaSize - Object area extent for Y axis
+ data[7] = yOASize[1];
+ data[8] = yOASize[2];
+
+ os.write(data);
+ }
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/ObjectByteExtentTriplet.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/ObjectByteExtentTriplet.java?rev=718262&r1=718261&r2=718262&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/ObjectByteExtentTriplet.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/ObjectByteExtentTriplet.java Mon Nov 17 07:26:06 2008
@@ -19,12 +19,17 @@
package org.apache.fop.afp.modca.triplets;
+import java.io.IOException;
+import java.io.OutputStream;
+
import org.apache.fop.afp.util.BinaryUtils;
/**
* The Object Byte Extent triplet is used to specify the number of bytes contained in an object
*/
-public class ObjectByteExtentTriplet extends Triplet {
+public class ObjectByteExtentTriplet extends AbstractTriplet {
+
+ private final int byteExt;
/**
* Main constructor
@@ -33,7 +38,19 @@
*/
public ObjectByteExtentTriplet(int byteExt) {
super(OBJECT_BYTE_EXTENT);
- byte[] data = BinaryUtils.convert(byteExt, 4);
- super.setData(data);
+ this.byteExt = byteExt;
+ }
+
+ /** {@inheritDoc} */
+ public int getDataLength() {
+ return 6;
+ }
+
+ /** {@inheritDoc} */
+ public void writeToStream(OutputStream os) throws IOException {
+ byte[] data = getData();
+ byte[] extData = BinaryUtils.convert(byteExt, 4);
+ System.arraycopy(extData, 0, data, 2, extData.length);
+ os.write(data);
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/ObjectClassificationTriplet.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/ObjectClassificationTriplet.java?rev=718262&r1=718261&r2=718262&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/ObjectClassificationTriplet.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/ObjectClassificationTriplet.java Mon Nov 17 07:26:06 2008
@@ -19,7 +19,8 @@
package org.apache.fop.afp.modca.triplets;
-import java.io.UnsupportedEncodingException;
+import java.io.IOException;
+import java.io.OutputStream;
import org.apache.fop.afp.AFPConstants;
import org.apache.fop.afp.modca.Registry.ObjectType;
@@ -29,7 +30,7 @@
* The Object Classification is used to classify and identify object data.
* The object data may or may not be defined by an IBM presentation architecture
*/
-public class ObjectClassificationTriplet extends Triplet {
+public class ObjectClassificationTriplet extends AbstractTriplet {
/**
* The scope of this object is the including page or overlay
@@ -64,6 +65,28 @@
*/
public static final byte CLASS_DATA_OBJECT_FONT = 0x41;
+ /** the object class */
+ private final byte objectClass;
+
+ /** the object type */
+ private final ObjectType objectType;
+
+ /** whether the container has an object environment group */
+ private final boolean containerHasOEG;
+
+ /** whether the data resides within the container */
+ private final boolean dataInContainer;
+
+ /** whether the data resides within the object container data */
+ private final boolean dataInOCD;
+
+ /** the object level (version) */
+ private final String objectLevel;
+
+ /** the company/organization name */
+ private final String companyName;
+
+
/**
* Main constructor
*
@@ -79,11 +102,6 @@
this(objectClass, objectType, dataInContainer, containerHasOEG, dataInOCD, null, null);
}
-
- private static final int OBJECT_LEVEL_LEN = 8;
- private static final int OBJECT_TYPE_NAME_LEN = 32;
- private static final int COMPANY_NAME_LEN = 32;
-
/**
* Fully parameterized constructor
*
@@ -100,56 +118,16 @@
String objLev, String compName) {
super(OBJECT_CLASSIFICATION);
+ this.objectClass = objectClass;
if (objectType == null) {
throw new IllegalArgumentException("MO:DCA Registry object type is null");
}
-
- byte[] data = new byte[94];
- data[0] = 0x00; // reserved (must be zero)
- data[1] = objectClass; // ObjClass
- data[2] = 0x00; // reserved (must be zero)
- data[3] = 0x00; // reserved (must be zero)
-
- // StrucFlgs - Information on the structure of the object container
- byte[] strucFlgs = getStrucFlgs(dataInContainer, containerHasOEG, dataInOCD);
- data[4] = strucFlgs[0];
- data[5] = strucFlgs[1];
-
- byte[] oid = objectType.getOID();
- // RegObjId - MOD:CA-registered ASN.1 OID for object type (8-23)
- System.arraycopy(oid, 0, data, 6, oid.length);
-
- // ObjTpName - name of object type (24-55)
- byte[] objTpName;
- try {
- objTpName = StringUtils.rpad(objectType.getName(), ' ', OBJECT_TYPE_NAME_LEN).getBytes(
- AFPConstants.EBCIDIC_ENCODING);
- System.arraycopy(objTpName, 0, data, 22, objTpName.length);
- } catch (UnsupportedEncodingException e) {
- throw new IllegalArgumentException("an encoding exception occurred");
- }
-
- // ObjLev - release level or version number of object type (56-63)
- byte[] objectLevel;
- try {
- objectLevel = StringUtils.rpad(objLev, ' ', OBJECT_LEVEL_LEN).getBytes(
- AFPConstants.EBCIDIC_ENCODING);
- } catch (UnsupportedEncodingException e) {
- throw new IllegalArgumentException("an encoding exception occurred");
- }
- System.arraycopy(objectLevel, 0, data, 54, objectLevel.length);
-
- // CompName - name of company or organization that owns object definition (64-95)
- byte[] companyName;
- try {
- companyName = StringUtils.rpad(compName, ' ', COMPANY_NAME_LEN).getBytes(
- AFPConstants.EBCIDIC_ENCODING);
- } catch (UnsupportedEncodingException e) {
- throw new IllegalArgumentException("an encoding exception occurred");
- }
- System.arraycopy(companyName, 0, data, 62, companyName.length);
-
- super.setData(data);
+ this.objectType = objectType;
+ this.dataInContainer = dataInContainer;
+ this.containerHasOEG = containerHasOEG;
+ this.dataInOCD = dataInOCD;
+ this.objectLevel = objLev;
+ this.companyName = compName;
}
/**
@@ -161,7 +139,7 @@
*
* @return the byte value of this structure
*/
- public byte[] getStrucFlgs(boolean dataInContainer, boolean containerHasOEG,
+ public byte[] getStructureFlagsAsBytes(boolean dataInContainer, boolean containerHasOEG,
boolean dataInOCD) {
byte[] strucFlgs = new byte[2];
// Object Container (BOC/EOC)
@@ -185,4 +163,52 @@
strucFlgs[1] = 0x00;
return strucFlgs;
}
+
+ /** {@inheritDoc} */
+ public int getDataLength() {
+ return 95;
+ }
+
+ private static final int OBJECT_LEVEL_LEN = 8;
+ private static final int OBJECT_TYPE_NAME_LEN = 32;
+ private static final int COMPANY_NAME_LEN = 32;
+
+ /** {@inheritDoc} */
+ public void writeToStream(OutputStream os) throws IOException {
+ byte[] data = getData();
+ data[2] = 0x00; // reserved (must be zero)
+ data[3] = objectClass; // ObjClass
+ data[4] = 0x00; // reserved (must be zero)
+ data[5] = 0x00; // reserved (must be zero)
+
+ // StrucFlgs - Information on the structure of the object container
+ byte[] structureFlagsBytes = getStructureFlagsAsBytes(dataInContainer, containerHasOEG, dataInOCD);
+ data[6] = structureFlagsBytes[0];
+ data[7] = structureFlagsBytes[1];
+
+ byte[] objectIdBytes = objectType.getOID();
+ // RegObjId - MOD:CA-registered ASN.1 OID for object type (8-23)
+ System.arraycopy(objectIdBytes, 0, data, 8, objectIdBytes.length);
+
+ // ObjTpName - name of object type (24-55)
+ byte[] objectTypeNameBytes;
+ objectTypeNameBytes
+ = StringUtils.rpad(objectType.getName(), ' ', OBJECT_TYPE_NAME_LEN).getBytes(
+ AFPConstants.EBCIDIC_ENCODING);
+ System.arraycopy(objectTypeNameBytes, 0, data, 24, objectTypeNameBytes.length);
+
+ // ObjLev - release level or version number of object type (56-63)
+ byte[] objectLevelBytes;
+ objectLevelBytes = StringUtils.rpad(objectLevel, ' ', OBJECT_LEVEL_LEN).getBytes(
+ AFPConstants.EBCIDIC_ENCODING);
+ System.arraycopy(objectLevelBytes, 0, data, 56, objectLevelBytes.length);
+
+ // CompName - name of company or organization that owns object definition (64-95)
+ byte[] companyNameBytes;
+ companyNameBytes = StringUtils.rpad(companyName, ' ', COMPANY_NAME_LEN).getBytes(
+ AFPConstants.EBCIDIC_ENCODING);
+ System.arraycopy(companyNameBytes, 0, data, 64, companyNameBytes.length);
+
+ os.write(data);
+ }
}
\ No newline at end of file
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/PresentationSpaceMixingRulesTriplet.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/PresentationSpaceMixingRulesTriplet.java?rev=718262&r1=718261&r2=718262&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/PresentationSpaceMixingRulesTriplet.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/PresentationSpaceMixingRulesTriplet.java Mon Nov 17 07:26:06 2008
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,28 +19,31 @@
package org.apache.fop.afp.modca.triplets;
+import java.io.IOException;
+import java.io.OutputStream;
+
/**
* This triplet is used to specify the resulting appearance when data in a new
* presentation space is merged with data in an existing presentation space.
*/
-public class PresentationSpaceMixingRulesTriplet extends Triplet {
+public class PresentationSpaceMixingRulesTriplet extends AbstractTriplet {
- /** background on background mixing rule */
+ /** background on background mixing rule */
public static final byte RULE_BACK_ON_BACK = 0x70;
- /** background on foreground mixing rule */
+ /** background on foreground mixing rule */
public static final byte RULE_BACK_ON_FORE = 0x71;
- /** foreground on background mixing rule */
+ /** foreground on background mixing rule */
public static final byte RULE_FORE_ON_BACK = 0x72;
- /** foreground on foreground mixing rule */
+ /** foreground on foreground mixing rule */
public static final byte RULE_FORE_ON_FORE = 0x73;
-
+
/** overpaint */
public static final byte OVERPAINT = (byte)0x01;
-
+
/** underpaint */
public static final byte UNDERPAINT = (byte)0x02;
@@ -49,14 +52,29 @@
/** MO:DCA default mixing */
public static final byte DEFAULT = (byte)0xFF;
-
-
+
+ /** the mixing rules */
+ private final byte[] rules;
+
/**
* Main constructor
- *
+ *
* @param rules the mixing rules
*/
public PresentationSpaceMixingRulesTriplet(byte[] rules) {
- super(PRESENTATION_SPACE_MIXING_RULE, rules);
+ super(PRESENTATION_SPACE_MIXING_RULE);
+ this.rules = rules;
+ }
+
+ /** {@inheritDoc} */
+ public int getDataLength() {
+ return 2 + rules.length;
+ }
+
+ /** {@inheritDoc} */
+ public void writeToStream(OutputStream os) throws IOException {
+ byte[] data = getData();
+ System.arraycopy(rules, 0, data, 2, rules.length);
+ os.write(data);
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/PresentationSpaceResetMixingTriplet.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/PresentationSpaceResetMixingTriplet.java?rev=718262&r1=718261&r2=718262&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/PresentationSpaceResetMixingTriplet.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/PresentationSpaceResetMixingTriplet.java Mon Nov 17 07:26:06 2008
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,30 +19,48 @@
package org.apache.fop.afp.modca.triplets;
+import java.io.IOException;
+import java.io.OutputStream;
+
/**
* This triplet is used to specify the resulting appearance when data in a new
* presentation space is merged with data in an existing presentation space.
*/
-public class PresentationSpaceResetMixingTriplet extends Triplet {
+public class PresentationSpaceResetMixingTriplet extends AbstractTriplet {
/**
* Do not reset to the color of the medium prior to
* placing data into this MO:DCA presentation space.
*/
public static final byte NOT_RESET = 0x00;
-
+
/**
* Reset to the color of the medium prior to placing
* data into this MO:DCA presentation space.
*/
public static final byte RESET = 0x01;
-
+
+ private final byte backgroundMixFlag;
+
/**
* Main constructor
- *
+ *
* @param backgroundMixFlag the background mixing flag
*/
public PresentationSpaceResetMixingTriplet(byte backgroundMixFlag) {
- super(PRESENTATION_SPACE_RESET_MIXING, backgroundMixFlag);
+ super(PRESENTATION_SPACE_RESET_MIXING);
+ this.backgroundMixFlag = backgroundMixFlag;
+ }
+
+ /** {@inheritDoc} */
+ public int getDataLength() {
+ return 3;
+ }
+
+ /** {@inheritDoc} */
+ public void writeToStream(OutputStream os) throws IOException {
+ byte[] data = getData();
+ data[2] = backgroundMixFlag;
+ os.write(data);
}
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/ResourceObjectTypeTriplet.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/ResourceObjectTypeTriplet.java?rev=718262&r1=718261&r2=718262&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/ResourceObjectTypeTriplet.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/modca/triplets/ResourceObjectTypeTriplet.java Mon Nov 17 07:26:06 2008
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,3 +19,36 @@
package org.apache.fop.afp.modca.triplets;
+import java.io.IOException;
+import java.io.OutputStream;
+
+/** resource object type triplet */
+public class ResourceObjectTypeTriplet extends AbstractTriplet {
+
+ private static final byte RESOURCE_OBJECT = 0x21;
+
+ /** the resource object type */
+ private final byte objectType;
+
+ /**
+ * Main constructor
+ *
+ * @param objectType the resource object type
+ */
+ public ResourceObjectTypeTriplet(byte objectType) {
+ super(RESOURCE_OBJECT);
+ this.objectType = objectType;
+ }
+
+ /** {@inheritDoc} */
+ public int getDataLength() {
+ return 10;
+ }
+
+ /** {@inheritDoc} */
+ public void writeToStream(OutputStream os) throws IOException {
+ byte[] data = getData();
+ data[2] = objectType;
+ os.write(data);
+ }
+}
Copied: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/svg/AFPGraphicsConfiguration.java (from r713745, xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPGraphicsConfiguration.java)
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/svg/AFPGraphicsConfiguration.java?p2=xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/svg/AFPGraphicsConfiguration.java&p1=xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPGraphicsConfiguration.java&r1=713745&r2=718262&rev=718262&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPGraphicsConfiguration.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/svg/AFPGraphicsConfiguration.java Mon Nov 17 07:26:06 2008
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,7 +17,7 @@
/* $Id$ */
-package org.apache.fop.afp;
+package org.apache.fop.afp.svg;
import java.awt.GraphicsDevice;
import java.awt.Rectangle;
@@ -77,10 +77,10 @@
/**
* TODO: This should return the page bounds in Pts,
* I couldn't figure out how to get this for the current
- * page from the PDFDocument (this still works for now,
+ * page (this still works for now,
* but it should be fixed...).
*
- * @return the bounds of the PDF document page
+ * @return the bounds of the page
*/
public Rectangle getBounds() {
return null;
@@ -109,10 +109,10 @@
}
private static final Log log = LogFactory.getLog(AFPGraphicsConfiguration.class);
-
+
private AffineTransform defaultTransform = null;
private AffineTransform normalizingTransform = null;
- private GraphicsDevice graphicsDevice = null;
+ private final GraphicsDevice graphicsDevice = new AFPGraphicsDevice(this);;
/**
* The default transform (1:1).
@@ -122,7 +122,7 @@
public AffineTransform getDefaultTransform() {
log.debug("getDefaultTransform()");
if (defaultTransform == null) {
- defaultTransform = new AffineTransform();
+ defaultTransform = new AffineTransform();
}
return defaultTransform;
}
@@ -142,14 +142,9 @@
return normalizingTransform;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public GraphicsDevice getDevice() {
log.debug("getDevice()");
- if (graphicsDevice == null) {
- graphicsDevice = new AFPGraphicsDevice(this);
- }
return graphicsDevice;
}
}
Copied: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/svg/AFPGraphicsDevice.java (from r713745, xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPGraphicsDevice.java)
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/svg/AFPGraphicsDevice.java?p2=xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/svg/AFPGraphicsDevice.java&p1=xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPGraphicsDevice.java&r1=713745&r2=718262&rev=718262&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/AFPGraphicsDevice.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/afp/svg/AFPGraphicsDevice.java Mon Nov 17 07:26:06 2008
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,12 +17,11 @@
/* $Id$ */
-package org.apache.fop.afp;
+package org.apache.fop.afp.svg;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
-
/**
* This implements the GraphicsDevice interface as appropriate for
* an AFPGraphics2D.
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/PDFGraphics2D.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/PDFGraphics2D.java?rev=718262&r1=718261&r2=718262&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/PDFGraphics2D.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/svg/PDFGraphics2D.java Mon Nov 17 07:26:06 2008
@@ -101,7 +101,6 @@
* @see org.apache.batik.ext.awt.g2d.AbstractGraphics2D
*/
public class PDFGraphics2D extends AbstractGraphics2D implements NativeImageHandler {
-
private static final AffineTransform IDENTITY_TRANSFORM = new AffineTransform();
/** The number of decimal places. */
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org