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 ph...@apache.org on 2012/04/12 16:17:06 UTC
svn commit: r1325277 - in /xmlgraphics/fop/trunk: ./
src/documentation/content/xdocs/trunk/ src/java/org/apache/fop/afp/
src/java/org/apache/fop/afp/modca/ src/java/org/apache/fop/render/afp/
Author: phancock
Date: Thu Apr 12 14:17:05 2012
New Revision: 1325277
URL: http://svn.apache.org/viewvc?rev=1325277&view=rev
Log:
Bugzilla#49893: A global setting to wrap F11 images in page segments.
Modified:
xmlgraphics/fop/trunk/src/documentation/content/xdocs/trunk/output.xml
xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPPaintingState.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/modca/ImageObject.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPCustomizable.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPImageHandlerRenderedImage.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java
xmlgraphics/fop/trunk/status.xml
Modified: xmlgraphics/fop/trunk/src/documentation/content/xdocs/trunk/output.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/documentation/content/xdocs/trunk/output.xml?rev=1325277&r1=1325276&r2=1325277&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/documentation/content/xdocs/trunk/output.xml (original)
+++ xmlgraphics/fop/trunk/src/documentation/content/xdocs/trunk/output.xml Thu Apr 12 14:17:05 2012
@@ -797,6 +797,17 @@ Note that the value of the encoding attr
<source><![CDATA[
<images mode="b+w" bits-per-pixel="1" dithering-quality="maximum"/>]]></source>
<p>
+ When the boolean attribute pseg (default false) is set to true, non-inline FS11 and FS45 IOCA images are wrapped in page segment.
+ This option is provided to support printers/print servers that require this MO:DCA structure.
+ </p>
+ <source><![CDATA[
+ <images mode="b+w" bits-per-pixel="8" pseg="true"/>]]></source>
+ <p>
+ Setting the boolean attribute fs45 to true (default false) will force all images to FS45.
+ </p>
+ <source><![CDATA[
+ <images mode="b+w" bits-per-pixel="8" fs45="true"/>]]></source>
+ <p>
By default, JPEG images are rasterized to a bitmap and the bitmap is included in the AFP doc.
However it is possible to encode in a lossless way to maintain maximum quality. But due
to lack of support for compression schemes like LZW (patent concerns), bitmap data is currently
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPPaintingState.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPPaintingState.java?rev=1325277&r1=1325276&r2=1325277&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPPaintingState.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPPaintingState.java Thu Apr 12 14:17:05 2012
@@ -84,6 +84,13 @@ public class AFPPaintingState extends or
/** determines whether to stroke text in GOCA mode or to use text operators where possible */
private boolean strokeGocaText = false;
+
+ /** use page segment with F11 and F45 images*/
+ private boolean pSeg;
+
+ /** use FS45 images*/
+ private boolean fs45;
+
/** the current page */
private transient AFPPagePaintingState pagePaintingState = new AFPPagePaintingState();
@@ -356,6 +363,41 @@ public class AFPPaintingState extends or
return this.strokeGocaText;
}
+ /**
+ * Whether FS11 and SF45 non-inline images should be wrapped in a page segment
+ * @return true iff images should be wrapped
+ */
+ public boolean getWrapPSeg() {
+ return pSeg;
+ }
+
+ /**
+ * Sets whether FS11 and FS45 non-inline images should be wrapped in a page segment
+ * @param pSeg true iff images should be wrapped
+ */
+ public void setWrapPSeg(boolean pSeg) {
+ this.pSeg = pSeg;
+ }
+
+
+ /**
+ * gets whether images should be FS45
+ * @return true iff images should be FS45
+ */
+ public boolean getFS45() {
+ return fs45;
+ }
+
+ /**
+ * sets whether images should be FS45
+ * @param fs45 true iff images should be FS45
+ */
+ public void setFS45(boolean fs45) {
+ this.fs45 = fs45;
+ }
+
+
+
/** {@inheritDoc} */
@Override
protected AbstractData instantiateData() {
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/modca/ImageObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/modca/ImageObject.java?rev=1325277&r1=1325276&r2=1325277&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/modca/ImageObject.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/modca/ImageObject.java Thu Apr 12 14:17:05 2012
@@ -75,10 +75,11 @@ public class ImageObject extends Abstrac
int dataHeightRes = imageObjectInfo.getDataWidthRes();
ImageDataDescriptor imageDataDescriptor
= factory.createImageDataDescriptor(dataWidth, dataHeight, dataWidthRes, dataHeightRes);
- if (imageObjectInfo.getBitsPerPixel() == 1) {
- imageDataDescriptor.setFunctionSet(ImageDataDescriptor.FUNCTION_SET_FS10);
- } else if (MimeConstants.MIME_AFP_IOCA_FS45.equals(imageObjectInfo.getMimeType())) {
+
+ if (MimeConstants.MIME_AFP_IOCA_FS45.equals(imageObjectInfo.getMimeType())) {
imageDataDescriptor.setFunctionSet(ImageDataDescriptor.FUNCTION_SET_FS45);
+ } else if (imageObjectInfo.getBitsPerPixel() == 1) {
+ imageDataDescriptor.setFunctionSet(ImageDataDescriptor.FUNCTION_SET_FS10);
}
getObjectEnvironmentGroup().setDataDescriptor(imageDataDescriptor);
getObjectEnvironmentGroup().setMapImageObject(
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPCustomizable.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPCustomizable.java?rev=1325277&r1=1325276&r2=1325277&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPCustomizable.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPCustomizable.java Thu Apr 12 14:17:05 2012
@@ -90,6 +90,30 @@ public interface AFPCustomizable {
void setResolution(int resolution);
/**
+ * Sets whether FS11 and FS45 non-inline images should be wrapped in a page segment
+ * @param pSeg true iff images should be wrapped
+ */
+ void setWrapPSeg(boolean pSeg);
+
+ /**
+ * set true if images should be FS45
+ * @param fs45 true iff images should be FS45
+ */
+ void setFS45(boolean fs45);
+
+ /**
+ * gets whether FS11 and FS45 non-inline images should be wrapped in a page segment
+ * @return true iff images should be wrapped
+ */
+ boolean getWrapPSeg();
+
+ /**
+ * gets whether images should be FS45
+ * @return true iff images should be FS45
+ */
+ boolean getFS45();
+
+ /**
* Returns the output/device resolution.
*
* @return the resolution in dpi
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java?rev=1325277&r1=1325276&r2=1325277&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java Thu Apr 12 14:17:05 2012
@@ -468,6 +468,26 @@ public class AFPDocumentHandler extends
}
/** {@inheritDoc} */
+ public void setWrapPSeg(boolean pSeg) {
+ paintingState.setWrapPSeg(pSeg);
+ }
+
+ /** {@inheritDoc} */
+ public void setFS45(boolean fs45) {
+ paintingState.setFS45(fs45);
+ }
+
+ /** {@inheritDoc} */
+ public boolean getWrapPSeg() {
+ return paintingState.getWrapPSeg();
+ }
+
+ /** {@inheritDoc} */
+ public boolean getFS45() {
+ return paintingState.getFS45();
+ }
+
+ /** {@inheritDoc} */
public void setDefaultResourceGroupFilePath(String filePath) {
resourceManager.setDefaultResourceGroupFilePath(filePath);
}
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPImageHandlerRenderedImage.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPImageHandlerRenderedImage.java?rev=1325277&r1=1325276&r2=1325277&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPImageHandlerRenderedImage.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPImageHandlerRenderedImage.java Thu Apr 12 14:17:05 2012
@@ -149,6 +149,25 @@ public class AFPImageHandlerRenderedImag
private static final class RenderedImageEncoder {
+ private enum FunctionSet {
+
+ FS10(MimeConstants.MIME_AFP_IOCA_FS10),
+ FS11(MimeConstants.MIME_AFP_IOCA_FS11),
+ FS45(MimeConstants.MIME_AFP_IOCA_FS45);
+
+ private String mimeType;
+
+ FunctionSet(String mimeType) {
+ this.mimeType = mimeType;
+ }
+
+ private String getMimeType() {
+ return mimeType;
+ }
+ };
+
+
+
private ImageRendered imageRendered;
private Dimension targetSize;
@@ -223,7 +242,7 @@ public class AFPImageHandlerRenderedImag
throws IOException {
RenderedImage renderedImage = imageRendered.getRenderedImage();
- int functionSet = useFS10 ? 10 : 11;
+ FunctionSet functionSet = useFS10 ? FunctionSet.FS10 : FunctionSet.FS11;
if (usePageSegments) {
assert resampledDim != null;
@@ -285,7 +304,7 @@ public class AFPImageHandlerRenderedImag
log.debug("Encoding image directly...");
imageObjectInfo.setBitsPerPixel(encodedColorModel.getPixelSize());
if (pixelSize == 32) {
- functionSet = 45; //IOCA FS45 required for CMYK
+ functionSet = FunctionSet.FS45; //IOCA FS45 required for CMYK
}
//Lossy or loss-less?
@@ -315,23 +334,17 @@ public class AFPImageHandlerRenderedImag
log.debug("Encoding image via RGB...");
imageData = encodeViaRGB(renderedImage, imageObjectInfo, paintingState, baos);
}
-
- switch (functionSet) {
- case 10:
- imageObjectInfo.setMimeType(MimeConstants.MIME_AFP_IOCA_FS10);
- break;
- case 11:
- imageObjectInfo.setMimeType(MimeConstants.MIME_AFP_IOCA_FS11);
- break;
- case 45:
- imageObjectInfo.setMimeType(MimeConstants.MIME_AFP_IOCA_FS45);
- break;
- default:
- throw new IllegalStateException("Invalid IOCA function set: " + functionSet);
- }
-
+ // Should image be FS45?
+ if (paintingState.getFS45()) {
+ functionSet = FunctionSet.FS45;
+ }
+ //Wrapping 300+ resolution FS11 IOCA in a page segment is apparently necessary(?)
+ imageObjectInfo.setCreatePageSegment(
+ (functionSet.equals(FunctionSet.FS11) || functionSet.equals(FunctionSet.FS45))
+ && paintingState.getWrapPSeg()
+ );
+ imageObjectInfo.setMimeType(functionSet.getMimeType());
imageObjectInfo.setData(imageData);
-
return imageObjectInfo;
}
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java?rev=1325277&r1=1325276&r2=1325277&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java Thu Apr 12 14:17:05 2012
@@ -415,6 +415,14 @@ public class AFPRendererConfigurator ext
customizable.canEmbedJpeg(allowEmbedding);
customizable.setBitmapEncodingQuality(ieq);
+ //FS11 and FS45 page segment wrapping
+ boolean pSeg = imagesCfg.getAttributeAsBoolean("pseg", false);
+ customizable.setWrapPSeg(pSeg);
+
+ //FS45 image forcing
+ boolean fs45 = imagesCfg.getAttributeAsBoolean("fs45", false);
+ customizable.setFS45(fs45);
+
// shading (filled rectangles)
Configuration shadingCfg = cfg.getChild("shading");
AFPShadingMode shadingMode = AFPShadingMode.valueOf(
Modified: xmlgraphics/fop/trunk/status.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/status.xml?rev=1325277&r1=1325276&r2=1325277&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/status.xml (original)
+++ xmlgraphics/fop/trunk/status.xml Thu Apr 12 14:17:05 2012
@@ -62,6 +62,9 @@
documents. Example: the fix of marks layering will be such a case when it's done.
-->
<release version="FOP Trunk" date="TBD">
+ <action context="Code" dev="PH" type="add" fixes-bug="49893">
+ A global setting to wrap F11 images in page segments.
+ </action>
<action context="Code" dev="GA" type="fix" fixes-bug="52763">
Support list-block in marker, thus preventing NPE.
</action>
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org