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 je...@apache.org on 2011/02/10 15:09:46 UTC
svn commit: r1069397 [6/6] - in /xmlgraphics/fop/branches/Temp_Color: ./
lib/ lib/build/ src/codegen/java/org/apache/fop/tools/
src/documentation/content/xdocs/ src/documentation/content/xdocs/trunk/
src/documentation/resources/images/ src/java/org/apa...
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java Thu Feb 10 14:09:42 2011
@@ -875,7 +875,7 @@ public class LineLayoutManager extends I
*/
private List postProcessLineBreaks(int alignment, LayoutContext context) {
- List returnList = new LinkedList();
+ List<ListElement> returnList = new LinkedList<ListElement>();
int endIndex = -1;
for (int p = 0; p < knuthParagraphs.size(); p++) {
@@ -893,7 +893,7 @@ public class LineLayoutManager extends I
KnuthSequence seq = (KnuthSequence) knuthParagraphs.get(p);
if (!seq.isInlineSequence()) {
- List targetList = new LinkedList();
+ List<ListElement> targetList = new LinkedList<ListElement>();
ListIterator listIter = seq.listIterator();
while (listIter.hasNext()) {
ListElement tempElement;
@@ -933,10 +933,10 @@ public class LineLayoutManager extends I
endIndex = ((LineBreakPosition) llPoss.getChosenPosition(i)).getLeafPos();
// create a list of the FootnoteBodyLM handling footnotes
// whose citations are in this line
- List footnoteList = new LinkedList();
- ListIterator elementIterator = seq.listIterator(startIndex);
+ List<LayoutManager> footnoteList = new LinkedList<LayoutManager>();
+ ListIterator<KnuthElement> elementIterator = seq.listIterator(startIndex);
while (elementIterator.nextIndex() <= endIndex) {
- KnuthElement element = (KnuthElement) elementIterator.next();
+ KnuthElement element = elementIterator.next();
if (element instanceof KnuthInlineBox
&& ((KnuthInlineBox) element).isAnchor()) {
footnoteList.add(((KnuthInlineBox) element).getFootnoteBodyLM());
@@ -949,15 +949,6 @@ public class LineLayoutManager extends I
returnList.add(new KnuthBlockBox
(lbp.lineHeight + lbp.spaceBefore + lbp.spaceAfter,
footnoteList, lbp, false));
- /* // add stretch and shrink to the returnlist
- if (!seq.isInlineSequence()
- && lbp.availableStretch != 0 || lbp.availableShrink != 0) {
- returnList.add(new KnuthPenalty(0, -KnuthElement.INFINITE,
- false, new Position(this), false));
- returnList.add(new KnuthGlue(0, lbp.availableStretch, lbp.availableShrink,
- new Position(this), false));
- }
- */
}
}
}
@@ -965,7 +956,7 @@ public class LineLayoutManager extends I
return returnList;
}
- private void createElements(List list, LineLayoutPossibilities llPoss,
+ private void createElements(List<ListElement> list, LineLayoutPossibilities llPoss,
Position elementPosition) {
/* number of normal, inner lines */
int innerLines = 0;
@@ -984,36 +975,27 @@ public class LineLayoutManager extends I
/* number of the last unbreakable lines */
int lastLines = fobj.getWidows();
/* sub-sequence used to separate the elements representing different lines */
- List breaker = new LinkedList();
+ List<KnuthElement> breaker = new LinkedList<KnuthElement>();
/* comment out the next lines in order to test particular situations */
if (fobj.getOrphans() + fobj.getWidows() <= llPoss.getMinLineCount()) {
- innerLines = llPoss.getMinLineCount()
- - (fobj.getOrphans() + fobj.getWidows());
- optionalLines = llPoss.getMaxLineCount()
- - llPoss.getOptLineCount();
- eliminableLines = llPoss.getOptLineCount()
- - llPoss.getMinLineCount();
+ innerLines = llPoss.getMinLineCount() - (fobj.getOrphans() + fobj.getWidows());
+ optionalLines = llPoss.getMaxLineCount() - llPoss.getOptLineCount();
+ eliminableLines = llPoss.getOptLineCount() - llPoss.getMinLineCount();
} else if (fobj.getOrphans() + fobj.getWidows() <= llPoss.getOptLineCount()) {
- optionalLines = llPoss.getMaxLineCount()
- - llPoss.getOptLineCount();
- eliminableLines = llPoss.getOptLineCount()
- - (fobj.getOrphans() + fobj.getWidows());
- conditionalEliminableLines = (fobj.getOrphans() + fobj.getWidows())
- - llPoss.getMinLineCount();
+ optionalLines = llPoss.getMaxLineCount() - llPoss.getOptLineCount();
+ eliminableLines = llPoss.getOptLineCount() - (fobj.getOrphans() + fobj.getWidows());
+ conditionalEliminableLines
+ = (fobj.getOrphans() + fobj.getWidows()) - llPoss.getMinLineCount();
} else if (fobj.getOrphans() + fobj.getWidows() <= llPoss.getMaxLineCount()) {
- optionalLines = llPoss.getMaxLineCount()
- - (fobj.getOrphans() + fobj.getWidows());
- conditionalOptionalLines = (fobj.getOrphans() + fobj.getWidows())
- - llPoss.getOptLineCount();
- conditionalEliminableLines = llPoss.getOptLineCount()
- - llPoss.getMinLineCount();
+ optionalLines = llPoss.getMaxLineCount() - (fobj.getOrphans() + fobj.getWidows());
+ conditionalOptionalLines
+ = (fobj.getOrphans() + fobj.getWidows()) - llPoss.getOptLineCount();
+ conditionalEliminableLines = llPoss.getOptLineCount() - llPoss.getMinLineCount();
firstLines -= conditionalOptionalLines;
} else {
- conditionalOptionalLines = llPoss.getMaxLineCount()
- - llPoss.getOptLineCount();
- conditionalEliminableLines = llPoss.getOptLineCount()
- - llPoss.getMinLineCount();
+ conditionalOptionalLines = llPoss.getMaxLineCount() - llPoss.getOptLineCount();
+ conditionalEliminableLines = llPoss.getOptLineCount() - llPoss.getMinLineCount();
firstLines = llPoss.getOptLineCount();
lastLines = 0;
}
@@ -1044,12 +1026,6 @@ public class LineLayoutManager extends I
breaker.add(new KnuthPenalty(0, 0, false, elementPosition, false));
}
- //log.debug("first=" + firstLines + " inner=" + innerLines
- // + " optional=" + optionalLines + " eliminable=" + eliminableLines
- // + " last=" + lastLines
- // + " (condOpt=" + conditionalOptionalLines
- // + " condEl=" + conditionalEliminableLines + ")");
-
// creation of the elements:
// first group of lines
list.add(new KnuthBox(firstLines * constantLineHeight, elementPosition,
@@ -1562,7 +1538,7 @@ public class LineLayoutManager extends I
lc.setAlignmentContext(alignmentContext);
setChildContext(lc);
- PositionIterator childPosIter = new StackingIter(positionList.listIterator());
+ PositionIterator childPosIter = new PositionIterator(positionList.listIterator());
LayoutContext blocklc = new LayoutContext(0);
blocklc.setLeadingSpace(new SpaceSpecifier(true));
blocklc.setTrailingSpace(new SpaceSpecifier(false));
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java Thu Feb 10 14:09:42 2011
@@ -65,20 +65,6 @@ public class ListBlockLayoutManager exte
private MinOptMax effSpaceBefore;
private MinOptMax effSpaceAfter;
- private static class StackingIter extends PositionIterator {
- StackingIter(Iterator parentIter) {
- super(parentIter);
- }
-
- protected LayoutManager getLM(Object nextObj) {
- return ((Position) nextObj).getLM();
- }
-
- protected Position getPos(Object nextObj) {
- return ((Position) nextObj);
- }
- }
-
/**
* Create a new list block layout manager.
* @param node list-block to create the layout manager for
@@ -96,6 +82,7 @@ public class ListBlockLayoutManager exte
}
/** {@inheritDoc} */
+ @Override
public void initialize() {
foSpaceBefore = new SpaceVal(
getListBlockFO().getCommonMarginBlock().spaceBefore, this).getSpace();
@@ -115,6 +102,7 @@ public class ListBlockLayoutManager exte
}
/** {@inheritDoc} */
+ @Override
public List getNextKnuthElements(LayoutContext context, int alignment) {
resetSpaces();
List returnList = super.getNextKnuthElements(context, alignment);
@@ -135,6 +123,7 @@ public class ListBlockLayoutManager exte
}
/** {@inheritDoc} */
+ @Override
public List getChangedKnuthElements(List oldList, int alignment) {
//log.debug("LBLM.getChangedKnuthElements>");
return super.getChangedKnuthElements(oldList, alignment);
@@ -147,6 +136,7 @@ public class ListBlockLayoutManager exte
* @param parentIter the position iterator
* @param layoutContext the layout context for adding areas
*/
+ @Override
public void addAreas(PositionIterator parentIter,
LayoutContext layoutContext) {
getParentArea(null);
@@ -170,10 +160,10 @@ public class ListBlockLayoutManager exte
// "unwrap" the NonLeafPositions stored in parentIter
// and put them in a new list;
- LinkedList positionList = new LinkedList();
+ LinkedList<Position> positionList = new LinkedList<Position>();
Position pos;
while (parentIter.hasNext()) {
- pos = (Position)parentIter.next();
+ pos = parentIter.next();
if (pos.getIndex() >= 0) {
if (firstPos == null) {
firstPos = pos;
@@ -194,7 +184,7 @@ public class ListBlockLayoutManager exte
addMarkersToPage(true, isFirst(firstPos), isLast(lastPos));
- StackingIter childPosIter = new StackingIter(positionList.listIterator());
+ PositionIterator childPosIter = new PositionIterator(positionList.listIterator());
while ((childLM = childPosIter.getNextChildLM()) != null) {
// Add the block areas to Area
// set the space adjustment ratio
@@ -235,6 +225,7 @@ public class ListBlockLayoutManager exte
* @param childArea the child area
* @return the parent area of the child
*/
+ @Override
public Area getParentArea(Area childArea) {
if (curBlockArea == null) {
curBlockArea = new Block();
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java Thu Feb 10 14:09:42 2011
@@ -19,7 +19,6 @@
package org.apache.fop.layoutmgr.list;
-import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -49,20 +48,6 @@ public class ListItemContentLayoutManage
private int xoffset;
private int itemIPD;
- private static class StackingIter extends PositionIterator {
- StackingIter(Iterator parentIter) {
- super(parentIter);
- }
-
- protected LayoutManager getLM(Object nextObj) {
- return ((Position) nextObj).getLM();
- }
-
- protected Position getPos(Object nextObj) {
- return ((Position) nextObj);
- }
- }
-
/**
* Create a new Cell layout manager.
* @param node list-item-label node
@@ -99,6 +84,7 @@ public class ListItemContentLayoutManage
}
/** {@inheritDoc} */
+ @Override
public List getChangedKnuthElements(List oldList, int alignment) {
//log.debug(" ListItemContentLayoutManager.getChanged>");
return super.getChangedKnuthElements(oldList, alignment);
@@ -112,6 +98,7 @@ public class ListItemContentLayoutManage
* @param parentIter the iterator of the break positions
* @param layoutContext the layout context for adding the areas
*/
+ @Override
public void addAreas(PositionIterator parentIter,
LayoutContext layoutContext) {
getParentArea(null);
@@ -127,10 +114,10 @@ public class ListItemContentLayoutManage
// "unwrap" the NonLeafPositions stored in parentIter
// and put them in a new list;
- LinkedList positionList = new LinkedList();
+ LinkedList<Position> positionList = new LinkedList<Position>();
Position pos;
while (parentIter.hasNext()) {
- pos = (Position)parentIter.next();
+ pos = parentIter.next();
if (pos == null) {
continue;
}
@@ -156,7 +143,7 @@ public class ListItemContentLayoutManage
addMarkersToPage(true, isFirst(firstPos), isLast(lastPos));
- StackingIter childPosIter = new StackingIter(positionList.listIterator());
+ PositionIterator childPosIter = new PositionIterator(positionList.listIterator());
while ((childLM = childPosIter.getNextChildLM()) != null) {
// Add the block areas to Area
lc.setFlags(LayoutContext.FIRST_AREA, childLM == firstLM);
@@ -189,6 +176,7 @@ public class ListItemContentLayoutManage
* @param childArea the child area to get the parent for
* @return the parent area
*/
+ @Override
public Area getParentArea(Area childArea) {
if (curBlockArea == null) {
curBlockArea = new Block();
@@ -215,6 +203,7 @@ public class ListItemContentLayoutManage
*
* @param childArea the child to add to the cell
*/
+ @Override
public void addChildArea(Area childArea) {
if (curBlockArea != null) {
curBlockArea.addBlock((Block) childArea);
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/pdf/PDFICCBasedColorSpace.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/pdf/PDFICCBasedColorSpace.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/pdf/PDFICCBasedColorSpace.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/pdf/PDFICCBasedColorSpace.java Thu Feb 10 14:09:42 2011
@@ -25,6 +25,7 @@ import java.io.IOException;
import java.io.InputStream;
import org.apache.commons.io.IOUtils;
+import org.apache.xmlgraphics.java2d.color.profile.ColorProfileUtil;
/**
* Represents an ICCBased color space in PDF.
@@ -134,21 +135,19 @@ public class PDFICCBasedColorSpace exten
public static PDFICCStream setupsRGBColorProfile(PDFDocument pdfDoc) {
ICC_Profile profile;
PDFICCStream sRGBProfile = pdfDoc.getFactory().makePDFICCStream();
- synchronized (PDFICCBasedColorSpace.class) {
- InputStream in = PDFDocument.class.getResourceAsStream("sRGB Color Space Profile.icm");
- if (in != null) {
- try {
- profile = ICC_Profile.getInstance(in);
- } catch (IOException ioe) {
- throw new RuntimeException(
- "Unexpected IOException loading the sRGB profile: " + ioe.getMessage());
- } finally {
- IOUtils.closeQuietly(in);
- }
- } else {
- // Fallback: Use the sRGB profile from the JRE (about 140KB)
- profile = ICC_Profile.getInstance(ColorSpace.CS_sRGB);
+ InputStream in = PDFDocument.class.getResourceAsStream("sRGB Color Space Profile.icm");
+ if (in != null) {
+ try {
+ profile = ColorProfileUtil.getICC_Profile(in);
+ } catch (IOException ioe) {
+ throw new RuntimeException(
+ "Unexpected IOException loading the sRGB profile: " + ioe.getMessage());
+ } finally {
+ IOUtils.closeQuietly(in);
}
+ } else {
+ // Fallback: Use the sRGB profile from the JRE (about 140KB)
+ profile = ColorProfileUtil.getICC_Profile(ColorSpace.CS_sRGB);
}
sRGBProfile.setColorSpace(profile, null);
return sRGBProfile;
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/pdf/PDFResources.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/pdf/PDFResources.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/pdf/PDFResources.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/pdf/PDFResources.java Thu Feb 10 14:09:42 2011
@@ -27,12 +27,12 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Set;
+import org.apache.xmlgraphics.java2d.color.profile.ColorProfileUtil;
import org.apache.fop.fonts.FontDescriptor;
import org.apache.fop.fonts.FontInfo;
import org.apache.fop.fonts.Typeface;
import org.apache.fop.fonts.base14.Symbol;
import org.apache.fop.fonts.base14.ZapfDingbats;
-import org.apache.fop.util.ColorProfileUtil;
/**
* Class representing a /Resources object.
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java Thu Feb 10 14:09:42 2011
@@ -77,17 +77,17 @@ public class AFPDocumentHandler extends
private DataStream dataStream;
/** the map of page segments */
- private Map/*<String,PageSegmentDescriptor>*/pageSegmentMap
- = new java.util.HashMap/*<String,PageSegmentDescriptor>*/();
+ private Map<String, PageSegmentDescriptor> pageSegmentMap
+ = new java.util.HashMap<String, PageSegmentDescriptor>();
/** Medium Map referenced on previous page **/
private String lastMediumMap;
- private static final int LOC_ELSEWHERE = 0;
- private static final int LOC_FOLLOWING_PAGE_SEQUENCE = 1;
- private static final int LOC_IN_PAGE_HEADER = 2;
+ private static enum Location {
+ ELSEWHERE, IN_DOCUMENT_HEADER, FOLLOWING_PAGE_SEQUENCE, IN_PAGE_HEADER
+ }
- private int location = LOC_ELSEWHERE;
+ private Location location = Location.ELSEWHERE;
/** the shading mode for filled rectangles */
private AFPShadingMode shadingMode = AFPShadingMode.COLOR;
@@ -117,6 +117,7 @@ public class AFPDocumentHandler extends
}
/** {@inheritDoc} */
+ @Override
public void setDefaultFontInfo(FontInfo fontInfo) {
FontManager fontManager = getUserAgent().getFactory().getFontManager();
FontCollection[] fontCollections = new FontCollection[] {
@@ -152,6 +153,7 @@ public class AFPDocumentHandler extends
}
/** {@inheritDoc} */
+ @Override
public void startDocument() throws IFException {
super.startDocument();
try {
@@ -165,11 +167,23 @@ public class AFPDocumentHandler extends
}
}
+
+ /** {@inheritDoc} */
+ @Override
+ public void startDocumentHeader() throws IFException {
+ super.startDocumentHeader();
+ this.location = Location.IN_DOCUMENT_HEADER;
+ }
+
/** {@inheritDoc} */
+ @Override
public void endDocumentHeader() throws IFException {
+ super.endDocumentHeader();
+ this.location = Location.ELSEWHERE;
}
/** {@inheritDoc} */
+ @Override
public void endDocument() throws IFException {
try {
this.dataStream.endDocument();
@@ -189,7 +203,7 @@ public class AFPDocumentHandler extends
} catch (IOException ioe) {
throw new IFException("I/O error in startPageSequence()", ioe);
}
- this.location = LOC_FOLLOWING_PAGE_SEQUENCE;
+ this.location = Location.FOLLOWING_PAGE_SEQUENCE;
}
/** {@inheritDoc} */
@@ -212,7 +226,7 @@ public class AFPDocumentHandler extends
/** {@inheritDoc} */
public void startPage(int index, String name, String pageMasterName, Dimension size)
throws IFException {
- this.location = LOC_ELSEWHERE;
+ this.location = Location.ELSEWHERE;
paintingState.clear();
AffineTransform baseTransform = getBaseTransform();
@@ -232,14 +246,16 @@ public class AFPDocumentHandler extends
}
/** {@inheritDoc} */
+ @Override
public void startPageHeader() throws IFException {
super.startPageHeader();
- this.location = LOC_IN_PAGE_HEADER;
+ this.location = Location.IN_PAGE_HEADER;
}
/** {@inheritDoc} */
+ @Override
public void endPageHeader() throws IFException {
- this.location = LOC_ELSEWHERE;
+ this.location = Location.ELSEWHERE;
super.endPageHeader();
}
@@ -272,17 +288,36 @@ public class AFPDocumentHandler extends
AFPPageSetup aps = (AFPPageSetup)extension;
String element = aps.getElementName();
if (AFPElementMapping.TAG_LOGICAL_ELEMENT.equals(element)) {
- if (this.location != LOC_IN_PAGE_HEADER
- && this.location != LOC_FOLLOWING_PAGE_SEQUENCE) {
+ switch (this.location) {
+ case FOLLOWING_PAGE_SEQUENCE:
+ case IN_PAGE_HEADER:
+ String name = aps.getName();
+ String value = aps.getValue();
+ dataStream.createTagLogicalElement(name, value);
+ break;
+ default:
throw new IFException(
"TLE extension must be in the page header or between page-sequence"
+ " and the first page: " + aps, null);
}
- String name = aps.getName();
- String value = aps.getValue();
- dataStream.createTagLogicalElement(name, value);
+ } else if (AFPElementMapping.NO_OPERATION.equals(element)) {
+ switch (this.location) {
+ case IN_DOCUMENT_HEADER:
+ case FOLLOWING_PAGE_SEQUENCE:
+ case IN_PAGE_HEADER:
+ String content = aps.getContent();
+ if (content != null) {
+ dataStream.createNoOperation(content);
+ }
+ break;
+ default:
+ throw new IFException(
+ "NOP extension must be in the document header, the page header"
+ + " or between page-sequence"
+ + " and the first page: " + aps, null);
+ }
} else {
- if (this.location != LOC_IN_PAGE_HEADER) {
+ if (this.location != Location.IN_PAGE_HEADER) {
throw new IFException(
"AFP page setup extension encountered outside the page header: " + aps,
null);
@@ -294,16 +329,11 @@ public class AFPDocumentHandler extends
String source = apse.getValue();
String uri = apse.getResourceSrc();
pageSegmentMap.put(source, new PageSegmentDescriptor(name, uri));
- } else if (AFPElementMapping.NO_OPERATION.equals(element)) {
- String content = aps.getContent();
- if (content != null) {
- dataStream.createNoOperation(content);
- }
}
}
} else if (extension instanceof AFPPageOverlay) {
AFPPageOverlay ipo = (AFPPageOverlay)extension;
- if (this.location != LOC_IN_PAGE_HEADER) {
+ if (this.location != Location.IN_PAGE_HEADER) {
throw new IFException(
"AFP page overlay extension encountered outside the page header: " + ipo,
null);
@@ -313,8 +343,8 @@ public class AFPDocumentHandler extends
dataStream.createIncludePageOverlay(overlay, ipo.getX(), ipo.getY());
}
} else if (extension instanceof AFPInvokeMediumMap) {
- if (this.location != LOC_FOLLOWING_PAGE_SEQUENCE
- && this.location != LOC_IN_PAGE_HEADER) {
+ if (this.location != Location.FOLLOWING_PAGE_SEQUENCE
+ && this.location != Location.IN_PAGE_HEADER) {
throw new IFException(
"AFP IMM extension must be between page-sequence"
@@ -401,7 +431,7 @@ public class AFPDocumentHandler extends
* @return the page segment descriptor or null if there's no page segment for the given URI
*/
PageSegmentDescriptor getPageSegmentNameFor(String uri) {
- return (PageSegmentDescriptor)pageSegmentMap.get(uri);
+ return pageSegmentMap.get(uri);
}
}
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/afp/AFPImageHandlerRenderedImage.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/afp/AFPImageHandlerRenderedImage.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/afp/AFPImageHandlerRenderedImage.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/afp/AFPImageHandlerRenderedImage.java Thu Feb 10 14:09:42 2011
@@ -24,8 +24,10 @@ import java.awt.Rectangle;
import java.awt.image.ColorModel;
import java.awt.image.DataBuffer;
import java.awt.image.DataBufferByte;
+import java.awt.image.MultiPixelPackedSampleModel;
import java.awt.image.Raster;
import java.awt.image.RenderedImage;
+import java.awt.image.SampleModel;
import java.io.IOException;
import java.io.OutputStream;
@@ -254,6 +256,12 @@ public class AFPImageHandlerRenderedImag
if (tiles > 1) {
return false;
}
+ SampleModel sampleModel = renderedImage.getSampleModel();
+ SampleModel expectedSampleModel = new MultiPixelPackedSampleModel(DataBuffer.TYPE_BYTE,
+ renderedImage.getWidth(), renderedImage.getHeight(), 1);
+ if (!expectedSampleModel.equals(sampleModel)) {
+ return false; //Pixels are not packed
+ }
imageObjectInfo.setBitsPerPixel(1);
@@ -290,6 +298,7 @@ public class AFPImageHandlerRenderedImag
}
/** {@inheritDoc} */
+ @Override
protected AFPDataObjectInfo createDataObjectInfo() {
return new AFPImageObjectInfo();
}
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/afp/extensions/AFPPageSetupElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/afp/extensions/AFPPageSetupElement.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/afp/extensions/AFPPageSetupElement.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/afp/extensions/AFPPageSetupElement.java Thu Feb 10 14:09:42 2011
@@ -54,6 +54,7 @@ public class AFPPageSetupElement extends
}
/** {@inheritDoc} */
+ @Override
protected void startOfNode() throws FOPException {
super.startOfNode();
if (AFPElementMapping.TAG_LOGICAL_ELEMENT.equals(getLocalName())) {
@@ -63,14 +64,17 @@ public class AFPPageSetupElement extends
"rule.childOfPageSequenceOrSPM");
}
} else {
- if (parent.getNameId() != Constants.FO_SIMPLE_PAGE_MASTER) {
+ if (parent.getNameId() != Constants.FO_SIMPLE_PAGE_MASTER
+ && parent.getNameId() != Constants.FO_PAGE_SEQUENCE
+ && parent.getNameId() != Constants.FO_DECLARATIONS) {
invalidChildError(getLocator(), parent.getName(), getNamespaceURI(), getName(),
- "rule.childOfSPM");
+ "rule.childOfSPMorPSorDeclarations");
}
}
}
/** {@inheritDoc} */
+ @Override
protected void characters(char[] data, int start, int length,
PropertyList pList, Locator locator) throws FOPException {
StringBuffer sb = new StringBuffer();
@@ -83,6 +87,7 @@ public class AFPPageSetupElement extends
}
/** {@inheritDoc} */
+ @Override
public void processNode(String elementName, Locator locator,
Attributes attlist, PropertyList propertyList)
throws FOPException {
@@ -106,6 +111,7 @@ public class AFPPageSetupElement extends
}
/** {@inheritDoc} */
+ @Override
protected ExtensionAttachment instantiateExtensionAttachment() {
return new AFPPageSetup(getLocalName());
}
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/pcl/PCLDocumentHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/pcl/PCLDocumentHandler.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/pcl/PCLDocumentHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/pcl/PCLDocumentHandler.java Thu Feb 10 14:09:42 2011
@@ -88,6 +88,7 @@ public class PCLDocumentHandler extends
}
/** {@inheritDoc} */
+ @Override
public void setContext(IFContext context) {
super.setContext(context);
this.pclUtil = new PCLRenderingUtil(context.getUserAgent());
@@ -99,6 +100,7 @@ public class PCLDocumentHandler extends
}
/** {@inheritDoc} */
+ @Override
public void setDefaultFontInfo(FontInfo fontInfo) {
FontInfo fi = Java2DUtil.buildDefaultJava2DBasedFontInfo(fontInfo, getUserAgent());
setFontInfo(fi);
@@ -114,7 +116,7 @@ public class PCLDocumentHandler extends
/** @return the target resolution */
protected int getResolution() {
- int resolution = (int)Math.round(getUserAgent().getTargetResolution());
+ int resolution = Math.round(getUserAgent().getTargetResolution());
if (resolution <= 300) {
return 300;
} else {
@@ -125,10 +127,12 @@ public class PCLDocumentHandler extends
//----------------------------------------------------------------------------------------------
/** {@inheritDoc} */
+ @Override
public void startDocument() throws IFException {
super.startDocument();
try {
this.gen = new PCLGenerator(this.outputStream, getResolution());
+ this.gen.setDitheringQuality(pclUtil.getDitheringQuality());
if (!pclUtil.isPJLDisabled()) {
gen.universalEndOfLanguage();
@@ -148,10 +152,12 @@ public class PCLDocumentHandler extends
}
/** {@inheritDoc} */
+ @Override
public void endDocumentHeader() throws IFException {
}
/** {@inheritDoc} */
+ @Override
public void endDocument() throws IFException {
try {
gen.separateJobs();
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/pcl/PCLGenerator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/pcl/PCLGenerator.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/pcl/PCLGenerator.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/pcl/PCLGenerator.java Thu Feb 10 14:09:42 2011
@@ -49,7 +49,6 @@ import org.apache.xmlgraphics.util.UnitC
import org.apache.fop.util.bitmap.BitmapImageUtil;
import org.apache.fop.util.bitmap.DitherUtil;
-import org.apache.fop.util.bitmap.MonochromeBitmapConverter;
/**
* This class provides methods for generating PCL print files.
@@ -76,6 +75,7 @@ public class PCLGenerator {
private boolean currentPatternTransparency = true;
private int maxBitmapResolution = PCL_RESOLUTIONS[PCL_RESOLUTIONS.length - 1];
+ private float ditheringQuality = 0.5f;
/**
* true: Standard PCL shades are used (poor quality). false: user-defined pattern are used
@@ -541,13 +541,31 @@ public class PCLGenerator {
}
/**
+ * Sets the dithering quality used when encoding gray or color images. If not explicitely
+ * set a medium setting (0.5f) is used.
+ * @param quality a quality setting between 0.0f (worst/fastest) and 1.0f (best/slowest)
+ */
+ public void setDitheringQuality(float quality) {
+ quality = Math.min(Math.max(0f, quality), 1.0f);
+ this.ditheringQuality = quality;
+ }
+
+ /**
+ * Returns the dithering quality used when encoding gray or color images.
+ * @return the quality setting between 0.0f (worst/fastest) and 1.0f (best/slowest)
+ */
+ public float getDitheringQuality() {
+ return this.ditheringQuality;
+ }
+
+ /**
* Indicates whether an image is a monochrome (b/w) image.
* @param img the image
* @return true if it's a monochrome image
*/
public static boolean isMonochromeImage(RenderedImage img) {
return BitmapImageUtil.isMonochromeImage(img);
- }
+ }
/**
* Indicates whether an image is a grayscale image.
@@ -618,18 +636,6 @@ public class PCLGenerator {
return resolution == calculatePCLResolution(resolution);
}
- private Dimension getAdjustedDimension(Dimension orgDim, double orgResolution,
- int pclResolution) {
- if (orgResolution == pclResolution) {
- return orgDim;
- } else {
- Dimension result = new Dimension();
- result.width = (int)Math.round((double)orgDim.width * pclResolution / orgResolution);
- result.height = (int)Math.round((double)orgDim.height * pclResolution / orgResolution);
- return result;
- }
- }
-
//Threshold table to convert an alpha channel (8-bit) into a clip mask (1-bit)
private static final byte[] THRESHOLD_TABLE = new byte[256];
static { // Initialize the arrays
@@ -724,34 +730,8 @@ public class PCLGenerator {
popCursorPos();
}
- BufferedImage src = null;
- if (img instanceof BufferedImage && !scaled) {
- if (!isGrayscaleImage(img) || img.getColorModel().hasAlpha()) {
- /* Disabled as this doesn't work reliably, use the fallback below
- src = new BufferedImage(effDim.width, effDim.height,
- BufferedImage.TYPE_BYTE_GRAY);
- Graphics2D g2d = src.createGraphics();
- try {
- clearBackground(g2d, effDim);
- } finally {
- g2d.dispose();
- }
- ColorConvertOp op = new ColorConvertOp(
- ColorSpace.getInstance(ColorSpace.CS_GRAY), null);
- op.filter((BufferedImage)img, src);
- */
- } else {
- src = (BufferedImage)img;
- }
- }
- if (src == null) {
- src = BitmapImageUtil.convertToGrayscale(img, effDim);
- }
- MonochromeBitmapConverter converter
- = BitmapImageUtil.createDefaultMonochromeBitmapConverter();
- converter.setHint("quality", "false");
-
- RenderedImage red = converter.convertToMonochrome(src);
+ RenderedImage red = BitmapImageUtil.convertToMonochrome(
+ img, effDim, this.ditheringQuality);
selectCurrentPattern(0, 0); //Solid black
setTransparencyMode(sourceTransparency || mask != null, true);
paintMonochromeBitmap(red, effResolution);
@@ -766,12 +746,6 @@ public class PCLGenerator {
}
}
- private void clearBackground(Graphics2D g2d, Dimension effDim) {
- //white background
- g2d.setBackground(Color.WHITE);
- g2d.clearRect(0, 0, effDim.width, effDim.height);
- }
-
private int toGray(int rgb) {
// see http://www.jguru.com/faq/view.jsp?EID=221919
double greyVal = 0.072169d * (rgb & 0xff);
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/pcl/PCLImageHandlerGraphics2D.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/pcl/PCLImageHandlerGraphics2D.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/pcl/PCLImageHandlerGraphics2D.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/pcl/PCLImageHandlerGraphics2D.java Thu Feb 10 14:09:42 2011
@@ -85,6 +85,7 @@ public class PCLImageHandlerGraphics2D i
boolean painted = false;
ByteArrayOutputStream baout = new ByteArrayOutputStream();
PCLGenerator tempGen = new PCLGenerator(baout, gen.getMaximumBitmapResolution());
+ tempGen.setDitheringQuality(gen.getDitheringQuality());
try {
GraphicContext ctx = (GraphicContext)pclContext.getGraphicContext().clone();
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/pcl/PCLRenderingMode.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/pcl/PCLRenderingMode.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/pcl/PCLRenderingMode.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/pcl/PCLRenderingMode.java Thu Feb 10 14:09:42 2011
@@ -30,23 +30,26 @@ public final class PCLRenderingMode impl
private static final long serialVersionUID = 6359884255324755026L;
/** "Quality" rendering (mixed native and bitmap for improved quality) */
- public static final PCLRenderingMode QUALITY = new PCLRenderingMode("quality");
+ public static final PCLRenderingMode QUALITY = new PCLRenderingMode("quality", 1.0f);
/** "Speed" rendering (maximum speed with native rendering, reduced visual quality) */
- public static final PCLRenderingMode SPEED = new PCLRenderingMode("speed");
+ public static final PCLRenderingMode SPEED = new PCLRenderingMode("speed", 0.25f);
/**
* "Bitmap" rendering (pages are painted entirely as bitmaps, maximum quality,
* reduced performance)
*/
- public static final PCLRenderingMode BITMAP = new PCLRenderingMode("bitmap");
+ public static final PCLRenderingMode BITMAP = new PCLRenderingMode("bitmap", 1.0f);
private String name;
+ private float defaultDitheringQuality;
/**
* Constructor to add a new named item.
* @param name Name of the item.
+ * @param defaultDitheringQuality the default dithering quality (0.0f..1.0f)
*/
- private PCLRenderingMode(String name) {
+ private PCLRenderingMode(String name, float defaultDitheringQuality) {
this.name = name;
+ this.defaultDitheringQuality = defaultDitheringQuality;
}
/** @return the name of the enum */
@@ -55,6 +58,14 @@ public final class PCLRenderingMode impl
}
/**
+ * Returns the default dithering quality for this rendering mode.
+ * @return the default dithering quality (0.0f..1.0f)
+ */
+ public float getDefaultDitheringQuality() {
+ return this.defaultDitheringQuality;
+ }
+
+ /**
* Returns the enumeration/singleton object based on its name.
* @param name the name of the enumeration value
* @return the enumeration object
@@ -76,6 +87,7 @@ public final class PCLRenderingMode impl
}
/** {@inheritDoc} */
+ @Override
public String toString() {
return "PCLRenderingMode:" + name;
}
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/pcl/PCLRenderingUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/pcl/PCLRenderingUtil.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/pcl/PCLRenderingUtil.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/pcl/PCLRenderingUtil.java Thu Feb 10 14:09:42 2011
@@ -47,6 +47,9 @@ public class PCLRenderingUtil {
*/
private PCLRenderingMode renderingMode = PCLRenderingMode.SPEED;
+ /** Controls the dithering quality when rendering gray or color images. */
+ private float ditheringQuality = 0.5f;
+
/**
* Controls whether all text should be painted as text. This is a fallback setting in case
* the mixture of native and bitmapped text does not provide the necessary quality.
@@ -88,6 +91,7 @@ public class PCLRenderingUtil {
*/
public void setRenderingMode(PCLRenderingMode mode) {
this.renderingMode = mode;
+ this.ditheringQuality = mode.getDefaultDitheringQuality();
}
/**
@@ -99,6 +103,14 @@ public class PCLRenderingUtil {
}
/**
+ * Returns the dithering quality to be used when encoding gray or color images.
+ * @return the quality (0.0f..1.0f)
+ */
+ public float getDitheringQuality() {
+ return this.ditheringQuality;
+ }
+
+ /**
* Controls whether PJL commands shall be generated by the PCL renderer.
* @param disable true to disable PJL commands
*/
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/pdf/AbstractImageAdapter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/pdf/AbstractImageAdapter.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/pdf/AbstractImageAdapter.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/pdf/AbstractImageAdapter.java Thu Feb 10 14:09:42 2011
@@ -25,6 +25,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.xmlgraphics.image.loader.Image;
+import org.apache.xmlgraphics.java2d.color.profile.ColorProfileUtil;
import org.apache.fop.pdf.PDFColor;
import org.apache.fop.pdf.PDFConformanceException;
@@ -36,7 +37,6 @@ import org.apache.fop.pdf.PDFICCStream;
import org.apache.fop.pdf.PDFImage;
import org.apache.fop.pdf.PDFName;
import org.apache.fop.pdf.PDFReference;
-import org.apache.fop.util.ColorProfileUtil;
/**
* Abstract PDFImage implementation for the PDF renderer.
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/pdf/PDFRenderingUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/pdf/PDFRenderingUtil.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/pdf/PDFRenderingUtil.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/render/pdf/PDFRenderingUtil.java Thu Feb 10 14:09:42 2011
@@ -35,6 +35,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.xmlgraphics.image.loader.util.ImageUtil;
+import org.apache.xmlgraphics.java2d.color.profile.ColorProfileUtil;
import org.apache.xmlgraphics.xmp.Metadata;
import org.apache.xmlgraphics.xmp.schemas.XMPBasicAdapter;
import org.apache.xmlgraphics.xmp.schemas.XMPBasicSchema;
@@ -64,7 +65,6 @@ import org.apache.fop.pdf.PDFReference;
import org.apache.fop.pdf.PDFText;
import org.apache.fop.pdf.PDFXMode;
import org.apache.fop.render.pdf.extensions.PDFEmbeddedFileExtensionAttachment;
-import org.apache.fop.util.ColorProfileUtil;
/**
* Utility class which enables all sorts of features that are not directly connected to the
@@ -294,7 +294,7 @@ class PDFRenderingUtil implements PDFCon
in = new URL(src.getSystemId()).openStream();
}
try {
- profile = ICC_Profile.getInstance(in);
+ profile = ColorProfileUtil.getICC_Profile(in);
} finally {
IOUtils.closeQuietly(in);
}
Propchange: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/util/ColorExt.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Feb 10 14:09:42 2011
@@ -2,4 +2,4 @@
/xmlgraphics/fop/branches/Temp_Accessibility/src/java/org/apache/fop/util/ColorExt.java:745924-830281
/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/util/ColorExt.java:603620-746655
/xmlgraphics/fop/branches/fop-0_95/src/java/org/apache/fop/util/ColorExt.java:684572,688085,688696
-/xmlgraphics/fop/trunk/src/java/org/apache/fop/util/ColorExt.java:959946-1060234
+/xmlgraphics/fop/trunk/src/java/org/apache/fop/util/ColorExt.java:959946-1069383
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/util/ColorProfileUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/util/ColorProfileUtil.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/util/ColorProfileUtil.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/util/ColorProfileUtil.java Thu Feb 10 14:09:42 2011
@@ -19,13 +19,11 @@
package org.apache.fop.util;
-import java.awt.color.ColorSpace;
-import java.awt.color.ICC_ColorSpace;
import java.awt.color.ICC_Profile;
-import java.io.UnsupportedEncodingException;
/**
* Helper methods for handling color profiles.
+ * @deprecated use org.apache.xmlgraphics.java2d.color.profile.ColorProfileUtil directly
*/
public final class ColorProfileUtil {
@@ -36,21 +34,11 @@ public final class ColorProfileUtil {
* Returns the profile description of an ICC profile
* @param profile the profile
* @return the description
+ * @deprecated use org.apache.xmlgraphics.java2d.color.profile.ColorProfileUtil directly
*/
public static String getICCProfileDescription(ICC_Profile profile) {
- byte[] data = profile.getData(ICC_Profile.icSigProfileDescriptionTag);
- if (data == null) {
- return null;
- } else {
- //Info on the data format: http://www.color.org/ICC-1_1998-09.PDF
- int length = (data[8] << 3 * 8) | (data[9] << 2 * 8) | (data[10] << 8) | data[11];
- length--; //Remove trailing NUL character
- try {
- return new String(data, 12, length, "US-ASCII");
- } catch (UnsupportedEncodingException e) {
- throw new UnsupportedOperationException("Incompatible VM");
- }
- }
+ return org.apache.xmlgraphics.java2d.color.profile.ColorProfileUtil
+ .getICCProfileDescription(profile);
}
/**
@@ -58,14 +46,10 @@ public final class ColorProfileUtil {
* provided by the Java class library.
* @param profile the color profile to check
* @return true if it is the default sRGB profile
+ * @deprecated use org.apache.xmlgraphics.java2d.color.profile.ColorProfileUtil directly
*/
public static boolean isDefaultsRGB(ICC_Profile profile) {
- ColorSpace sRGB = ColorSpace.getInstance(ColorSpace.CS_sRGB);
- ICC_Profile sRGBProfile = null;
- if (sRGB instanceof ICC_ColorSpace) {
- sRGBProfile = ((ICC_ColorSpace)sRGB).getProfile();
- }
- return profile == sRGBProfile;
+ return org.apache.xmlgraphics.java2d.color.profile.ColorProfileUtil
+ .isDefaultsRGB(profile);
}
-
}
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/util/ColorSpaceCache.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/util/ColorSpaceCache.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/util/ColorSpaceCache.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/util/ColorSpaceCache.java Thu Feb 10 14:09:42 2011
@@ -30,6 +30,7 @@ import javax.xml.transform.stream.Stream
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.xmlgraphics.java2d.color.profile.ColorProfileUtil;
import org.apache.xmlgraphics.java2d.color.ICCColorSpaceWithIntent;
import org.apache.xmlgraphics.java2d.color.RenderingIntent;
@@ -81,7 +82,7 @@ public class ColorSpaceCache {
if (src != null && src instanceof StreamSource) {
// FOP URI resolver found ICC profile - create ICC profile
// from the Source
- iccProfile = ICC_Profile.getInstance(((StreamSource) src)
+ iccProfile = ColorProfileUtil.getICC_Profile(((StreamSource) src)
.getInputStream());
} else {
// TODO - Would it make sense to fall back on VM ICC
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/util/ListUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/util/ListUtil.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/util/ListUtil.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/util/ListUtil.java Thu Feb 10 14:09:42 2011
@@ -34,22 +34,22 @@ public final class ListUtil {
/**
* Retrieve the last element from a list.
*
- * @param list
- * The list to work on
+ * @param <T> the type of objects stored in the list
+ * @param list the list to work on
* @return last element
*/
- public static Object getLast(List list) {
+ public static <T> T getLast(List<T> list) {
return list.get(list.size() - 1);
}
/**
* Retrieve and remove the last element from a list.
*
- * @param list
- * The list to work on
+ * @param <T> the type of objects stored in the list
+ * @param list the list to work on
* @return previous last element
*/
- public static Object removeLast(List list) {
+ public static <T> T removeLast(List<T> list) {
return list.remove(list.size() - 1);
}
}
Modified: xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/util/bitmap/BitmapImageUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/util/bitmap/BitmapImageUtil.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/util/bitmap/BitmapImageUtil.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/util/bitmap/BitmapImageUtil.java Thu Feb 10 14:09:42 2011
@@ -213,7 +213,9 @@ public final class BitmapImageUtil {
WritableRaster wr = img.getColorModel().createCompatibleWritableRaster(
img.getWidth(), img.getHeight());
boolean premult = img.getColorModel().isAlphaPremultiplied();
- return new BufferedImage(img.getColorModel(), wr, premult, null);
+ BufferedImage buf = new BufferedImage(img.getColorModel(), wr, premult, null);
+ transferImage(img, buf);
+ return buf;
}
}
Modified: xmlgraphics/fop/branches/Temp_Color/status.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/status.xml?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/status.xml (original)
+++ xmlgraphics/fop/branches/Temp_Color/status.xml Thu Feb 10 14:09:42 2011
@@ -62,6 +62,32 @@
<action context="Renderers" dev="JM" type="add" fixes-bug="49403" due-to="Patrick Jaromin">
Initial work on spot colors (aka named colors) for PDF output.
</action>
+ <action context="Renderers" dev="JM" type="fix" fixes-bug="50705" due-to="Mehdi Houshmand">
+ Fix to preserve the order of AFP TLEs and NOPs as given in the XSL-FO document.
+ </action>
+ <action context="Fonts" dev="JM" type="add" fixes-bug="50699" due-to="Alexandros Papadakis">
+ Added support for lookup of alternative glyphs when additional single-byte encodings are
+ used, ex. replacing "Omegagreek" by "Omega" and vice versa.
+ </action>
+ <action context="Code" dev="AD" type="add" fixes-bug="48334">
+ Added support for resolution of relative URIs against a specified xml:base during
+ property refinement.
+ </action>
+ <action context="Renderers" dev="JM" type="add">
+ Allow afp:no-operation to also appear under fo:page-sequence and fo:declarations.
+ </action>
+ <action context="Code" dev="AD" type="fix" fixes-bug="50635" due-to="mkoegler.AT.auto.tuwien.ac.at">
+ Bugfix: fix issue in RenderPagesModel.checkPreparedPages() where the same page-sequence
+ is potentially started multiple times.
+ </action>
+ <action context="Code" dev="AD" type="fix" fixes-bug="50636" due-to="mkoegler.AT.auto.tuwien.ac.at">
+ Bugfix: fix performance issue when adding pages, if the total number of pages
+ is significantly large.
+ </action>
+ <action context="Code" dev="AD" type="fix" fixes-bug="50626" due-to="mkoegler.AT.auto.tuwien.ac.at">
+ Bugfix: fix performance issue when adding nodes, if the number of children
+ is significantly large.
+ </action>
<action context="Config" dev="SP" type="fix">
Bugfix: relative URIs in the configuration file (base, font-base, hyphenation-base) are evaluated relative to the base URI of the configuration file.
</action>
Modified: xmlgraphics/fop/branches/Temp_Color/test/java/org/apache/fop/StandardTestSuite.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/test/java/org/apache/fop/StandardTestSuite.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/test/java/org/apache/fop/StandardTestSuite.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/test/java/org/apache/fop/StandardTestSuite.java Thu Feb 10 14:09:42 2011
@@ -26,12 +26,14 @@ import org.apache.fop.fonts.DejaVuLGCSer
import org.apache.fop.image.loader.batik.ImageLoaderTestCase;
import org.apache.fop.image.loader.batik.ImagePreloaderTestCase;
import org.apache.fop.intermediate.IFMimickingTestCase;
+import org.apache.fop.render.afp.AFPTestSuite;
import org.apache.fop.render.extensions.prepress.PageBoundariesTest;
import org.apache.fop.render.extensions.prepress.PageScaleTest;
import org.apache.fop.render.pdf.PDFAConformanceTestCase;
import org.apache.fop.render.pdf.PDFCMapTestCase;
import org.apache.fop.render.pdf.PDFEncodingTestCase;
import org.apache.fop.render.pdf.PDFsRGBSettingsTestCase;
+import org.apache.fop.render.ps.PSTestSuite;
import org.apache.fop.render.rtf.RichTextFormatTestSuite;
import org.apache.fop.traits.MinOptMaxTest;
@@ -54,6 +56,8 @@ public class StandardTestSuite {
suite.addTest(new TestSuite(PDFCMapTestCase.class));
suite.addTest(new TestSuite(PDFsRGBSettingsTestCase.class));
suite.addTest(new TestSuite(DejaVuLGCSerifTest.class));
+ suite.addTest(AFPTestSuite.suite());
+ suite.addTest(PSTestSuite.suite());
suite.addTest(RichTextFormatTestSuite.suite());
suite.addTest(new TestSuite(ImageLoaderTestCase.class));
suite.addTest(new TestSuite(ImagePreloaderTestCase.class));
Modified: xmlgraphics/fop/branches/Temp_Color/test/java/org/apache/fop/UtilityCodeTestSuite.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/test/java/org/apache/fop/UtilityCodeTestSuite.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/test/java/org/apache/fop/UtilityCodeTestSuite.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/test/java/org/apache/fop/UtilityCodeTestSuite.java Thu Feb 10 14:09:42 2011
@@ -25,6 +25,7 @@ import junit.framework.TestSuite;
import org.apache.fop.events.BasicEventTestCase;
import org.apache.fop.pdf.PDFObjectTestCase;
import org.apache.fop.traits.BorderPropsTestCase;
+import org.apache.fop.util.BitmapImageUtilTestCase;
import org.apache.fop.util.ColorUtilTestCase;
import org.apache.fop.util.ElementListUtilsTestCase;
import org.apache.fop.util.PDFNumberTestCase;
@@ -51,6 +52,7 @@ public class UtilityCodeTestSuite {
suite.addTest(new TestSuite(BasicEventTestCase.class));
suite.addTest(new TestSuite(XMLResourceBundleTestCase.class));
suite.addTest(new TestSuite(URIResolutionTestCase.class));
+ suite.addTest(new TestSuite(BitmapImageUtilTestCase.class));
//$JUnit-END$
return suite;
}
Modified: xmlgraphics/fop/branches/Temp_Color/test/java/org/apache/fop/render/ps/AbstractPostScriptTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/test/java/org/apache/fop/render/ps/AbstractPostScriptTestCase.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/test/java/org/apache/fop/render/ps/AbstractPostScriptTestCase.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/test/java/org/apache/fop/render/ps/AbstractPostScriptTestCase.java Thu Feb 10 14:09:42 2011
@@ -21,20 +21,6 @@ package org.apache.fop.render.ps;
import java.io.File;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.MissingResourceException;
-
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.sax.SAXResult;
-import javax.xml.transform.stream.StreamSource;
-
-import junit.framework.TestCase;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
import org.apache.xmlgraphics.ps.PSResource;
import org.apache.xmlgraphics.ps.dsc.DSCException;
@@ -44,19 +30,13 @@ import org.apache.xmlgraphics.ps.dsc.eve
import org.apache.xmlgraphics.ps.dsc.events.DSCEvent;
import org.apache.fop.apps.FOUserAgent;
-import org.apache.fop.apps.Fop;
-import org.apache.fop.apps.FopFactory;
import org.apache.fop.apps.MimeConstants;
+import org.apache.fop.render.AbstractRenderingTestCase;
/**
* Abstract base class for PostScript verification tests.
*/
-public abstract class AbstractPostScriptTestCase extends TestCase {
-
- /** the JAXP TransformerFactory */
- protected TransformerFactory tFactory = TransformerFactory.newInstance();
- /** the FopFactory */
- protected FopFactory fopFactory = FopFactory.newInstance();
+public abstract class AbstractPostScriptTestCase extends AbstractRenderingTestCase {
/**
* Renders a test file.
@@ -68,35 +48,7 @@ public abstract class AbstractPostScript
*/
protected File renderFile(FOUserAgent ua, String resourceName, String suffix)
throws Exception {
- File outputFile = new File("build/test-results/" + resourceName + suffix + ".ps");
- File outputDir = outputFile.getParentFile();
- FileUtils.forceMkdir(outputDir);
-
- // Prepare input file
- InputStream in = getClass().getResourceAsStream(resourceName);
- if (in == null) {
- throw new MissingResourceException(resourceName + " not found in resources",
- getClass().getName(), null);
- }
- try {
- Source src = new StreamSource(in);
-
- // Create PostScript
- OutputStream out = new java.io.FileOutputStream(outputFile);
- out = new java.io.BufferedOutputStream(out);
- try {
- Fop fop = fopFactory.newFop(MimeConstants.MIME_POSTSCRIPT, ua, out);
- SAXResult res = new SAXResult(fop.getDefaultHandler());
-
- Transformer transformer = tFactory.newTransformer();
- transformer.transform(src, res);
- } finally {
- IOUtils.closeQuietly(out);
- }
- } finally {
- IOUtils.closeQuietly(in);
- }
- return outputFile;
+ return renderFile(ua, resourceName, suffix, MimeConstants.MIME_POSTSCRIPT);
}
/**
Modified: xmlgraphics/fop/branches/Temp_Color/test/java/org/apache/fop/render/ps/ImageHandlingTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/test/java/org/apache/fop/render/ps/ImageHandlingTestCase.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/test/java/org/apache/fop/render/ps/ImageHandlingTestCase.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/test/java/org/apache/fop/render/ps/ImageHandlingTestCase.java Thu Feb 10 14:09:42 2011
@@ -86,6 +86,7 @@ public class ImageHandlingTestCase exten
gotoDSCComment(parser, DSCConstants.BEGIN_RESOURCE);
gotoDSCComment(parser, DSCConstants.BEGIN_RESOURCE);
gotoDSCComment(parser, DSCConstants.BEGIN_RESOURCE);
+ gotoDSCComment(parser, DSCConstants.BEGIN_RESOURCE);
PSResource form2 = new PSResource(PSResource.TYPE_FORM, "FOPForm:2");
checkResourceComment(parser, DSCConstants.BEGIN_RESOURCE, form2);
Modified: xmlgraphics/fop/branches/Temp_Color/test/java/org/apache/fop/render/ps/ResourceOptimizationTestCase.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/test/java/org/apache/fop/render/ps/ResourceOptimizationTestCase.java?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/test/java/org/apache/fop/render/ps/ResourceOptimizationTestCase.java (original)
+++ xmlgraphics/fop/branches/Temp_Color/test/java/org/apache/fop/render/ps/ResourceOptimizationTestCase.java Thu Feb 10 14:09:42 2011
@@ -90,7 +90,7 @@ public class ResourceOptimizationTestCas
= (DSCCommentDocumentSuppliedResources)gotoDSCComment(parser,
DSCConstants.DOCUMENT_SUPPLIED_RESOURCES);
Set resources = supplied.getResources();
- assertEquals(4, resources.size());
+ assertEquals(5, resources.size());
assertTrue(resources.contains(form1));
assertTrue("Expected barcode.eps as supplied resource",
resources.contains(new PSResource(PSResource.TYPE_FILE,
Modified: xmlgraphics/fop/branches/Temp_Color/test/layoutengine/standard-testcases/fox_disable-column-balancing.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Color/test/layoutengine/standard-testcases/fox_disable-column-balancing.xml?rev=1069397&r1=1069396&r2=1069397&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_Color/test/layoutengine/standard-testcases/fox_disable-column-balancing.xml (original)
+++ xmlgraphics/fop/branches/Temp_Color/test/layoutengine/standard-testcases/fox_disable-column-balancing.xml Thu Feb 10 14:09:42 2011
@@ -216,6 +216,7 @@
</fo>
<checks>
<eval expected="0" xpath="//pageSequence[1]/pageViewport[2]//span[1]/flow[2]/@bpd"/>
+ <eval expected="0" xpath="//pageSequence[1]/pageViewport[2]//span[1]/flow[2]/@bpd"/>
<eval expected="12000" xpath="//pageSequence[1]/pageViewport[3]//span[2]/@bpd"/>
<!-- TODO Replace with the following test once bugs affecting multiple columns have been
corrected
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org