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 vh...@apache.org on 2008/07/25 12:56:32 UTC
svn commit: r679758 [24/34] - in
/xmlgraphics/fop/branches/Temp_AFPGOCAResources: ./
examples/embedding/java/embedding/ examples/embedding/java/embedding/events/
examples/embedding/java/embedding/intermediate/
examples/embedding/java/embedding/model/ e...
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/Overlay.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/Overlay.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/Overlay.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/Overlay.java Fri Jul 25 03:55:49 2008
@@ -26,7 +26,7 @@
/**
* An overlay is a MO:DCA-P resource object.
- *
+ *
* It may be stored in an external resource library or it may be
* carried in a resource group. An overlay is similar to a page in
* that it defines its own environment and carries the same data objects.
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/PageDescriptor.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/PageDescriptor.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/PageDescriptor.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/PageDescriptor.java Fri Jul 25 03:55:49 2008
@@ -55,14 +55,14 @@
data[3] = (byte) 0xD3;
data[4] = (byte) 0xA6;
data[5] = (byte) 0xAF;
-
- data[6] = 0x00; // Flags
- data[7] = 0x00; // Reserved
+
+ data[6] = 0x00; // Flags
+ data[7] = 0x00; // Reserved
data[8] = 0x00; // Reserved
-
- data[9] = 0x00; // XpgBase = 10 inches
- data[10] = 0x00; // YpgBase = 10 inches
-
+
+ data[9] = 0x00; // XpgBase = 10 inches
+ data[10] = 0x00; // YpgBase = 10 inches
+
// XpgUnits
byte[] xdpi = BinaryUtils.convert(widthRes * 10, 2);
data[11] = xdpi[0];
@@ -72,7 +72,7 @@
byte[] ydpi = BinaryUtils.convert(heightRes * 10, 2);
data[13] = ydpi[0];
data[14] = ydpi[1];
-
+
// XpgSize
byte[] x = BinaryUtils.convert(width, 3);
data[15] = x[0];
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/tools/BinaryUtils.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/tools/BinaryUtils.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/tools/BinaryUtils.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/tools/BinaryUtils.java Fri Jul 25 03:55:49 2008
@@ -50,7 +50,7 @@
size++;
}
}
- return convert(buf.toString());
+ return convert(buf.toString());
}
/**
@@ -92,7 +92,7 @@
} else {
throw new IllegalArgumentException("Bad hexadecimal digit");
}
-
+
if ((c2 >= '0') && (c2 <= '9')) {
b += (c2 - '0');
} else if ((c2 >= 'a') && (c2 <= 'f')) {
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/tools/StructuredFieldReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/tools/StructuredFieldReader.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/tools/StructuredFieldReader.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/tools/StructuredFieldReader.java Fri Jul 25 03:55:49 2008
@@ -110,7 +110,7 @@
length[0] = bufferData[b];
length[1] = bufferData[a];
- int reclength = ((length[0] & 0xFF) << 8)
+ int reclength = ((length[0] & 0xFF) << 8)
+ (length[1] & 0xFF) - identifier.length - 2;
byte[] retval = new byte[reclength];
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/AWTRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/AWTRenderer.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/AWTRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/AWTRenderer.java Fri Jul 25 03:55:49 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.
@@ -67,17 +67,17 @@
private boolean previewAsMainWindow;
/**
- * Renderable instance that can be used to reload and re-render a document after
+ * Renderable instance that can be used to reload and re-render a document after
* modifications.
*/
protected Renderable renderable;
/**
- * Will be notified when rendering progresses
+ * Will be notified when rendering progresses
*/
protected StatusListener statusListener = null;
-
+
/**
* Creates a new AWTRenderer instance.
*/
@@ -98,7 +98,7 @@
public void setUserAgent(FOUserAgent foUserAgent) {
super.setUserAgent(foUserAgent);
if (dialogDisplay) {
- setStatusListener(PreviewDialog.createPreviewDialog(userAgent, this.renderable,
+ setStatusListener(PreviewDialog.createPreviewDialog(userAgent, this.renderable,
this.previewAsMainWindow));
}
}
@@ -111,7 +111,7 @@
public void setRenderable(Renderable renderable) {
this.renderable = renderable;
}
-
+
/**
* Sets whether the preview dialog should be created and displayed when
* the rendering is finished.
@@ -121,7 +121,7 @@
dialogDisplay = show;
}
- /**
+ /**
* {@inheritDoc}
*/
public void renderPage(PageViewport pageViewport) throws IOException {
@@ -164,15 +164,15 @@
if (pageIndex >= getNumberOfPages()) {
return null;
}
-
+
PageFormat pageFormat = new PageFormat();
-
+
Paper paper = new Paper();
-
+
Rectangle2D dim = getPageViewport(pageIndex).getViewArea();
double width = dim.getWidth();
double height = dim.getHeight();
-
+
// if the width is greater than the height assume lanscape mode
// and swap the width and height values in the paper format
if (width > height) {
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/AWTRendererMaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/AWTRendererMaker.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/AWTRendererMaker.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/AWTRendererMaker.java Fri Jul 25 03:55:49 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.
@@ -30,8 +30,8 @@
public class AWTRendererMaker extends AbstractRendererMaker {
private static final String[] MIMES = new String[] {MimeConstants.MIME_FOP_AWT_PREVIEW};
-
-
+
+
/** {@inheritDoc} */
public Renderer makeRenderer(FOUserAgent ua) {
return new AWTRenderer();
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/viewer/Command.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/viewer/Command.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/viewer/Command.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/viewer/Command.java Fri Jul 25 03:55:49 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.
@@ -16,7 +16,7 @@
*/
/* $Id$ */
-
+
package org.apache.fop.render.awt.viewer;
//Java
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/viewer/GoToPageDialog.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/viewer/GoToPageDialog.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/viewer/GoToPageDialog.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/viewer/GoToPageDialog.java Fri Jul 25 03:55:49 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.
@@ -16,7 +16,7 @@
*/
/* $Id$ */
-
+
package org.apache.fop.render.awt.viewer;
import java.awt.Dimension;
@@ -42,7 +42,7 @@
* Stanislav Gorkhover: Stanislav.Gorkhover@jCatalog.com
*/
public class GoToPageDialog extends JDialog {
-
+
private JTextField pageNumberField;
private int pageNumber = -1;
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/viewer/ImageProxyPanel.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/viewer/ImageProxyPanel.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/viewer/ImageProxyPanel.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/viewer/ImageProxyPanel.java Fri Jul 25 03:55:49 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.
@@ -129,7 +129,7 @@
int x = (getWidth() - image.getWidth()) / 2;
int y = (getHeight() - image.getHeight()) / 2;
-
+
graphics.drawImage(image, x, y, image.getWidth(), image.getHeight(), null);
} catch (FOPException fopEx) {
fopEx.printStackTrace();
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java Fri Jul 25 03:55:49 2008
@@ -77,7 +77,7 @@
/** The FOUserAgent associated with this window */
protected FOUserAgent foUserAgent;
/**
- * Renderable instance that can be used to reload and re-render a document after
+ * Renderable instance that can be used to reload and re-render a document after
* modifications.
*/
protected Renderable renderable;
@@ -253,14 +253,14 @@
new Insets(0, 0, 0, 0), 0, 0));
getContentPane().add(statusBar, BorderLayout.SOUTH);
}
-
+
/**
- * Creates and initialize the AWT Viewer main window.
+ * Creates and initialize the AWT Viewer main window.
* @param foUserAgent the FO user agent
* @param renderable the target for the rendering
* @return the newly initialized preview dialog
*/
- public static PreviewDialog createPreviewDialog(FOUserAgent foUserAgent,
+ public static PreviewDialog createPreviewDialog(FOUserAgent foUserAgent,
Renderable renderable, boolean asMainWindow) {
PreviewDialog frame = new PreviewDialog(foUserAgent, renderable);
@@ -295,7 +295,7 @@
public PreviewDialog(FOUserAgent foUserAgent) {
this(foUserAgent, null);
}
-
+
/**
* Creates a new menubar to be shown in this window.
* @return the newly created menubar
@@ -454,7 +454,7 @@
setStatus(translator.getString("Status.Show"));
previewPanel.reload();
}
-
+
/**
* Changes the current visible page
* @param number the page number to go to
@@ -541,7 +541,7 @@
fopEx.printStackTrace();
}
}
-
+
public void setScaleToFitWidth() {
try {
setScale(previewPanel.getScaleToFitWidth() * 100);
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/viewer/PreviewPanel.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/viewer/PreviewPanel.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/viewer/PreviewPanel.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/viewer/PreviewPanel.java Fri Jul 25 03:55:49 2008
@@ -51,7 +51,7 @@
* <p>Use PreviewPanel when you want to embed a preview in your own application
* with your own controls. Use PreviewDialog when you want to use the standard
* Fop controls.
- * </p>
+ * </p>
* <p>In order to embed a PreviewPanel in your own app, create your own renderer,
* and your own agent. In order to support reloads, you may also implement your
* own Renderable extension or the default InputHandler. Setting the Renderable
@@ -109,7 +109,7 @@
/** The FOUserAgent associated with this panel - often shared with PreviewDialog */
protected FOUserAgent foUserAgent;
/**
- * Renderable instance that can be used to reload and re-render a document after
+ * Renderable instance that can be used to reload and re-render a document after
* modifications.
*/
protected Renderable renderable;
@@ -142,7 +142,7 @@
*/
private ViewportScroller scroller;
-
+
/**
* Creates a new PreviewPanel instance.
* @param foUserAgent the user agent
@@ -170,7 +170,7 @@
previewArea.setMinimumSize(new Dimension(50, 50));
add(previewArea);
}
-
+
/**
* @return the currently visible page
*/
@@ -242,12 +242,12 @@
private int startPosX = 0;
/** Starting position of a mouse drag - Y co-ordinate */
private int startPosY = 0;
-
+
ViewportScroller(JViewport vp) {
viewport = vp;
}
- // ***** MouseMotionListener *****
+ // ***** MouseMotionListener *****
public synchronized void mouseDragged(MouseEvent e) {
if (viewport == null) {
@@ -261,7 +261,7 @@
int viewHeight = viewport.getExtentSize().height;
int imageWidth = viewport.getViewSize().width;
int imageHeight = viewport.getViewSize().height;
-
+
Point viewPoint = viewport.getViewPosition();
int viewX = Math.max(0, Math.min(imageWidth - viewWidth, viewPoint.x - xmove));
int viewY = Math.max(0, Math.min(imageHeight - viewHeight, viewPoint.y - ymove));
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/viewer/Renderable.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/viewer/Renderable.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/viewer/Renderable.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/viewer/Renderable.java Fri Jul 25 03:55:49 2008
@@ -35,5 +35,5 @@
*/
void renderTo(FOUserAgent userAgent, String outputFormat)
throws FOPException;
-
+
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/viewer/StatusListener.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/viewer/StatusListener.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/viewer/StatusListener.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/viewer/StatusListener.java Fri Jul 25 03:55:49 2008
@@ -26,9 +26,9 @@
/** Called when a page has been renderered. */
void notifyPageRendered();
-
+
/** Called when the renderer has stopped. */
void notifyRendererStopped();
-
+
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/viewer/Translator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/viewer/Translator.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/viewer/Translator.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/awt/viewer/Translator.java Fri Jul 25 03:55:49 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.
@@ -16,7 +16,7 @@
*/
/* $Id$ */
-
+
package org.apache.fop.render.awt.viewer;
//Java
@@ -29,7 +29,7 @@
* Stanislav.Gorkhover@jCatalog.com
*/
public class Translator {
-
+
private ResourceBundle bundle;
private static String bundleBaseName = "org/apache/fop/render/awt/viewer/resources/Viewer";
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/bitmap/BitmapRendererEventProducer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/bitmap/BitmapRendererEventProducer.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/bitmap/BitmapRendererEventProducer.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/bitmap/BitmapRendererEventProducer.java Fri Jul 25 03:55:49 2008
@@ -33,7 +33,7 @@
/** Provider class for the event producer. */
class Provider {
-
+
/**
* Returns an event producer.
* @param broadcaster the event broadcaster to use
@@ -52,23 +52,23 @@
public EventModel createEventModel() {
return loadModel(getClass(), "event-model.xml");
}
-
+
}
-
+
/**
* No filename information available. Stopping early after the first page.
* @param source the event source
* @event.severity WARN
*/
void stoppingAfterFirstPageNoFilename(Object source);
-
+
/**
* Image writer does not support multiple images. Only the first page has been produced.
* @param source the event source
* @event.severity WARN
*/
void stoppingAfterFirstPageNoMultiWriter(Object source);
-
+
/**
* No ImageWriter found.
* @param source the event source
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/bitmap/MultiFileRenderingUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/bitmap/MultiFileRenderingUtil.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/bitmap/MultiFileRenderingUtil.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/bitmap/MultiFileRenderingUtil.java Fri Jul 25 03:55:49 2008
@@ -7,7 +7,7 @@
import java.io.OutputStream;
/**
- * This utility class helps renderers who generate one file per page,
+ * This utility class helps renderers who generate one file per page,
* like the PNG renderer.
*/
public class MultiFileRenderingUtil {
@@ -16,10 +16,10 @@
private String filePrefix;
private String fileExtension;
-
+
/** The output directory where images are to be written */
private File outputDir;
-
+
/**
* Creates a new instance.
* <p>
@@ -60,7 +60,7 @@
filePrefix = s.substring(0, i);
}
}
-
+
public OutputStream createOutputStream(int pageNumber) throws IOException {
if (filePrefix == null) {
return null;
@@ -71,5 +71,5 @@
return os;
}
}
-
+
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/bitmap/PNGRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/bitmap/PNGRenderer.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/bitmap/PNGRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/bitmap/PNGRenderer.java Fri Jul 25 03:55:49 2008
@@ -48,7 +48,7 @@
/** The OutputStream for the first Image */
private OutputStream firstOutputStream;
-
+
/** Helper class for generating multiple files */
private MultiFileRenderingUtil multiFileUtil;
@@ -60,7 +60,7 @@
/** {@inheritDoc} */
public void startRenderer(OutputStream outputStream) throws IOException {
log.info("rendering areas to PNG");
- multiFileUtil = new MultiFileRenderingUtil(PNG_FILE_EXTENSION,
+ multiFileUtil = new MultiFileRenderingUtil(PNG_FILE_EXTENSION,
getUserAgent().getOutputFile());
this.firstOutputStream = outputStream;
}
@@ -84,7 +84,7 @@
// Do the rendering: get the image for this page
PageViewport pv = (PageViewport)pageViewportList.get(i);
RenderedImage image = (RenderedImage)getPageImage(pv);
-
+
// Encode this image
if (log.isDebugEnabled()) {
log.debug("Encoding page " + (i + 1));
@@ -102,7 +102,7 @@
private void writeImage(OutputStream os, RenderedImage image) throws IOException {
ImageWriterParams params = new ImageWriterParams();
params.setResolution(Math.round(userAgent.getTargetResolution()));
-
+
// Encode PNG image
ImageWriter writer = ImageWriterRegistry.getInstance().getWriterFor(getMimeType());
if (writer == null) {
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/bitmap/PNGRendererMaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/bitmap/PNGRendererMaker.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/bitmap/PNGRendererMaker.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/bitmap/PNGRendererMaker.java Fri Jul 25 03:55:49 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.
@@ -32,8 +32,8 @@
public class PNGRendererMaker extends AbstractRendererMaker {
private static final String[] MIMES = new String[] {MimeConstants.MIME_PNG};
-
-
+
+
/** {@inheritDoc} */
public Renderer makeRenderer(FOUserAgent ua) {
return new PNGRenderer();
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/bitmap/PNGRenderer_onthefly.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/bitmap/PNGRenderer_onthefly.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/bitmap/PNGRenderer_onthefly.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/bitmap/PNGRenderer_onthefly.java Fri Jul 25 03:55:49 2008
@@ -96,7 +96,7 @@
fileSyntax = s.substring(0, i);
}
- /**
+ /**
* {@inheritDoc}
*/
public void renderPage(PageViewport pageViewport) throws IOException {
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/bitmap/TIFFRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/bitmap/TIFFRenderer.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/bitmap/TIFFRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/bitmap/TIFFRenderer.java Fri Jul 25 03:55:49 2008
@@ -80,13 +80,13 @@
//private static final String COMPRESSION_ZLIB = "ZLib";
public static final String COMPRESSION_CCITT_T6 = "CCITT T.6"; //CCITT Group 4
public static final String COMPRESSION_CCITT_T4 = "CCITT T.4"; //CCITT Group 3
-
+
/** ImageWriter parameters */
private ImageWriterParams writerParams;
-
+
/** Image Type as parameter for the BufferedImage constructor (see BufferedImage.TYPE_*) */
private int bufferedImageType = BufferedImage.TYPE_INT_ARGB;
-
+
private OutputStream outputStream;
/** {@inheritDoc} */
@@ -160,7 +160,7 @@
clearViewportList();
log.debug("TIFF encoding done.");
}
-
+
/** {@inheritDoc} */
protected BufferedImage getBufferedImage(int bitmapWidth, int bitmapHeight) {
return new BufferedImage(bitmapWidth, bitmapHeight, bufferedImageType);
@@ -210,7 +210,7 @@
//Decorate the image with a packed sample model for encoding by the codec
SinglePixelPackedSampleModel sppsm;
sppsm = (SinglePixelPackedSampleModel)pageImage.getSampleModel();
-
+
int bands = sppsm.getNumBands();
int[] off = new int[bands];
int w = pageImage.getWidth();
@@ -220,7 +220,7 @@
}
SampleModel sm = new PixelInterleavedSampleModel(
DataBuffer.TYPE_BYTE, w, h, bands, w * bands, off);
-
+
RenderedImage rimg = new FormatRed(GraphicsUtil.wrap(pageImage), sm);
return rimg;
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/bitmap/TIFFRendererConfigurator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/bitmap/TIFFRendererConfigurator.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/bitmap/TIFFRendererConfigurator.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/bitmap/TIFFRendererConfigurator.java Fri Jul 25 03:55:49 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.
@@ -28,7 +28,7 @@
import org.apache.fop.render.Renderer;
/**
- * TIFF Renderer configurator
+ * TIFF Renderer configurator
*/
public class TIFFRendererConfigurator extends PrintRendererConfigurator {
@@ -47,7 +47,7 @@
* @throws FOPException fop exception
* {@inheritDoc}
*/
- public void configure(Renderer renderer) throws FOPException {
+ public void configure(Renderer renderer) throws FOPException {
Configuration cfg = super.getRendererConfig(renderer);
if (cfg != null) {
TIFFRenderer tiffRenderer = (TIFFRenderer)renderer;
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/bitmap/TIFFRendererMaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/bitmap/TIFFRendererMaker.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/bitmap/TIFFRendererMaker.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/bitmap/TIFFRendererMaker.java Fri Jul 25 03:55:49 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.
@@ -31,7 +31,7 @@
public class TIFFRendererMaker extends AbstractRendererMaker {
private static final String[] MIMES = new String[] {MimeConstants.MIME_TIFF};
-
+
/** {@inheritDoc} */
public Renderer makeRenderer(FOUserAgent userAgent) {
return new TIFFRenderer();
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Base14FontCollection.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Base14FontCollection.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Base14FontCollection.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Base14FontCollection.java Fri Jul 25 03:55:49 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.
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/CustomFontMetricsMapper.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/CustomFontMetricsMapper.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/CustomFontMetricsMapper.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/CustomFontMetricsMapper.java Fri Jul 25 03:55:49 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.
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/FontMetricsMapper.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/FontMetricsMapper.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/FontMetricsMapper.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/FontMetricsMapper.java Fri Jul 25 03:55:49 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.
@@ -34,5 +34,5 @@
* @return font with the desired characteristics.
*/
java.awt.Font getFont(int size);
-
+
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/InstalledFontCollection.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/InstalledFontCollection.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/InstalledFontCollection.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/InstalledFontCollection.java Fri Jul 25 03:55:49 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.
@@ -61,7 +61,7 @@
/**
* Main constructor
- *
+ *
* @param graphics2D a graphics 2D
*/
public InstalledFontCollection(Graphics2D graphics2D) {
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Java2DFontMetrics.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Java2DFontMetrics.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Java2DFontMetrics.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Java2DFontMetrics.java Fri Jul 25 03:55:49 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.
@@ -16,7 +16,7 @@
*/
/* $Id$ */
-
+
package org.apache.fop.render.java2d;
// Java
@@ -63,17 +63,17 @@
* The typical height of a small cap latter (often derived from "x", value in mpt)
*/
private int xHeight = 0;
-
+
/**
* The highest point of the font above the baseline (usually derived from "d", value in mpt)
*/
private int ascender = 0;
-
+
/**
* The lowest point of the font under the baseline (usually derived from "p", value in mpt)
*/
private int descender = 0;
-
+
/**
* Buffered font.
* f1 is bufferd for metric measurements during layout.
@@ -103,7 +103,7 @@
/** A LineMetrics to access high-resolution metrics information. */
private LineMetrics lineMetrics;
-
+
/**
* Temp graphics object needed to get the font metrics
*/
@@ -130,7 +130,7 @@
setFont(family, style, size);
return Math.round(lineMetrics.getAscent() * FONT_FACTOR);
}
-
+
/**
* Determines the font ascent of the Font described by this
* FontMetrics object
@@ -159,7 +159,7 @@
* Rectangle FontMetrics.getStringBounds(..) method can be called.
* The y value of the rectangle is the offset from the origin
* (baseline) apparently needed by the sample test program
- *
+ *
* xxxxx@xxxxx 2001-05-15
*/
/* I don't think this is right.
@@ -231,7 +231,7 @@
Rectangle2D rect = fmt.getStringBounds(ch, 0, 1, this.graphics);
return (int)Math.round(rect.getWidth() * 1000);
}
-
+
/**
* Return widths (in 1/1000ths of point size) of all
* characters
@@ -265,7 +265,7 @@
atts.put(TextAttribute.SIZE, new Float(size)); //size in pt
return new Font(atts);
}
-
+
/**
* Checks whether the font for which values are
* requested is the one used immediately before or
@@ -301,17 +301,17 @@
TextLayout layout = new TextLayout("x", f1, graphics.getFontRenderContext());
Rectangle2D rect = layout.getBounds();
xHeight = (int)Math.round(-rect.getY() * 1000);
-
+
//PostScript-compatible ascent
layout = new TextLayout("d", f1, graphics.getFontRenderContext());
rect = layout.getBounds();
ascender = (int)Math.round(-rect.getY() * 1000);
-
+
//PostScript-compatible descent
layout = new TextLayout("p", f1, graphics.getFontRenderContext());
rect = layout.getBounds();
descender = (int)Math.round((rect.getY() + rect.getHeight()) * -1000);
-
+
//Alternative way to get metrics but the ascender is again wrong for our purposes
lineMetrics = f1.getLineMetrics("", graphics.getFontRenderContext());
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Java2DGraphics2DAdapter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Java2DGraphics2DAdapter.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Java2DGraphics2DAdapter.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Java2DGraphics2DAdapter.java Fri Jul 25 03:55:49 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.
@@ -16,7 +16,7 @@
*/
/* $Id$ */
-
+
package org.apache.fop.render.java2d;
import java.awt.Color;
@@ -40,12 +40,12 @@
public void paintImage(Graphics2DImagePainter painter,
RendererContext context,
int x, int y, int width, int height) throws IOException {
-
+
float fwidth = width / 1000f;
float fheight = height / 1000f;
float fx = x / 1000f;
float fy = y / 1000f;
-
+
// get the 'width' and 'height' attributes of the SVG document
Dimension dim = painter.getImageSize();
float imw = (float)dim.getWidth() / 1000f;
@@ -56,12 +56,12 @@
Java2DRenderer renderer = (Java2DRenderer)context.getRenderer();
Java2DGraphicsState state = renderer.state;
-
+
//Create copy and paint on that
Graphics2D g2d = (Graphics2D)state.getGraph().create();
g2d.setColor(Color.black);
g2d.setBackground(Color.black);
-
+
//TODO Clip to the image area.
// transform so that the coordinates (0,0) is from the top left
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Java2DGraphicsState.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Java2DGraphicsState.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Java2DGraphicsState.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Java2DGraphicsState.java Fri Jul 25 03:55:49 2008
@@ -73,14 +73,14 @@
* @param org the instance to copy
*/
public Java2DGraphicsState(Java2DGraphicsState org) {
- this.currentGraphics = (Graphics2D)org.currentGraphics.create();
+ this.currentGraphics = (Graphics2D)org.currentGraphics.create();
this.fontInfo = org.fontInfo;
this.initialTransform = org.initialTransform;
this.currentStroke = org.currentStroke;
this.currentStrokeStyle = org.currentStrokeStyle;
this.currentStrokeWidth = org.currentStrokeWidth;
}
-
+
/**
* @return the currently valid state
*/
@@ -92,7 +92,7 @@
public void dispose() {
this.currentGraphics.dispose();
this.currentGraphics = null;
-
+
}
/**
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Java2DRendererConfigurator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Java2DRendererConfigurator.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Java2DRendererConfigurator.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Java2DRendererConfigurator.java Fri Jul 25 03:55:49 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.
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Java2DRendererContextConstants.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Java2DRendererContextConstants.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Java2DRendererContextConstants.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Java2DRendererContextConstants.java Fri Jul 25 03:55:49 2008
@@ -29,5 +29,5 @@
/** The current Java2DGraphicsState. */
String JAVA2D_STATE = "state";
-
+
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Java2DSVGHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Java2DSVGHandler.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Java2DSVGHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/Java2DSVGHandler.java Fri Jul 25 03:55:49 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.
@@ -94,7 +94,7 @@
+ "currentYPosition = " + currentYPosition + "}";
}
}
-
+
/** {@inheritDoc} */
protected void renderSVGDocument(RendererContext context,
Document doc) {
@@ -105,12 +105,12 @@
int x = info.currentXPosition;
int y = info.currentYPosition;
-
+
SVGUserAgent ua = new SVGUserAgent(context.getUserAgent(), new AffineTransform());
-
+
GVTBuilder builder = new GVTBuilder();
BridgeContext ctx = new BridgeContext(ua);
-
+
GraphicsNode root;
try {
root = builder.build(ctx, doc);
@@ -120,20 +120,20 @@
eventProducer.svgNotBuilt(this, e, getDocumentURI(doc));
return;
}
-
+
// If no viewbox is defined in the svg file, a viewbox of 100x100 is
// assumed, as defined in SVGUserAgent.getViewportSize()
float iw = (float) ctx.getDocumentSize().getWidth() * 1000f;
float ih = (float) ctx.getDocumentSize().getHeight() * 1000f;
-
+
float w = (float) info.width;
float h = (float) info.height;
AffineTransform origTransform = info.state.getGraph().getTransform();
-
+
// correct integer roundoff
info.state.getGraph().translate(x / 1000f, y / 1000f);
-
+
//SVGSVGElement svg = ((SVGDocument) doc).getRootElement();
// Aspect ratio preserved by layout engine, not here
AffineTransform at = AffineTransform.getScaleInstance(w / iw, h / ih);
@@ -148,10 +148,10 @@
context.getUserAgent().getEventBroadcaster());
eventProducer.svgRenderingError(this, e, getDocumentURI(doc));
}
-
+
info.state.getGraph().setTransform(origTransform);
}
-
+
/** {@inheritDoc} */
public boolean supportsRenderer(Renderer renderer) {
return (renderer instanceof Java2DRenderer);
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/SystemFontMetricsMapper.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/SystemFontMetricsMapper.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/SystemFontMetricsMapper.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/java2d/SystemFontMetricsMapper.java Fri Jul 25 03:55:49 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.
@@ -16,7 +16,7 @@
*/
/* $Id$ */
-
+
package org.apache.fop.render.java2d;
// Java
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pcl/DefaultMonochromeBitmapConverter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pcl/DefaultMonochromeBitmapConverter.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pcl/DefaultMonochromeBitmapConverter.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pcl/DefaultMonochromeBitmapConverter.java Fri Jul 25 03:55:49 2008
@@ -36,10 +36,10 @@
public void setHint(String name, String value) {
//ignore, not supported
}
-
+
/** {@inheritDoc} */
public RenderedImage convertToMonochrome(BufferedImage img) {
- BufferedImage buf = new BufferedImage(img.getWidth(), img.getHeight(),
+ BufferedImage buf = new BufferedImage(img.getWidth(), img.getHeight(),
BufferedImage.TYPE_BYTE_BINARY);
RenderingHints hints = new RenderingHints(null);
//This hint doesn't seem to make a difference :-(
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pcl/JAIMonochromeBitmapConverter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pcl/JAIMonochromeBitmapConverter.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pcl/JAIMonochromeBitmapConverter.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pcl/JAIMonochromeBitmapConverter.java Fri Jul 25 03:55:49 2008
@@ -46,20 +46,20 @@
MonochromeBitmapConverter {
private boolean isErrorDiffusion = false;
-
+
/** {@inheritDoc} */
public void setHint(String name, String value) {
if ("quality".equalsIgnoreCase(name)) {
isErrorDiffusion = "true".equalsIgnoreCase(value);
}
}
-
+
/** {@inheritDoc} */
public RenderedImage convertToMonochrome(BufferedImage img) {
if (img.getColorModel().getColorSpace().getNumComponents() != 1) {
throw new IllegalArgumentException("Source image must be a grayscale image!");
}
-
+
// Load the ParameterBlock for the dithering operation
// and set the operation name.
ParameterBlock pb = new ParameterBlock();
@@ -78,7 +78,7 @@
pb.add(colorMap);
pb.add(KernelJAI.DITHER_MASK_441);
}
-
+
//Create an image layout for a monochrome b/w image
ImageLayout layout = new ImageLayout();
byte[] map = new byte[] {(byte)0x00, (byte)0xff};
@@ -89,8 +89,8 @@
RenderingHints hints = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, layout);
// Dither the image.
- PlanarImage dst = JAI.create(opName, pb, hints);
-
+ PlanarImage dst = JAI.create(opName, pb, hints);
+
//Convert it to a BufferedImage
return dst.getAsBufferedImage();
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pcl/MonochromeBitmapConverter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pcl/MonochromeBitmapConverter.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pcl/MonochromeBitmapConverter.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pcl/MonochromeBitmapConverter.java Fri Jul 25 03:55:49 2008
@@ -33,12 +33,12 @@
* @param value the value
*/
void setHint(String name, String value);
-
+
/**
- * Converts a grayscale bitmap image to a monochrome (1-bit) b/w bitmap image.
+ * Converts a grayscale bitmap image to a monochrome (1-bit) b/w bitmap image.
* @param img the grayscale image
* @return the converted monochrome image
*/
RenderedImage convertToMonochrome(BufferedImage img);
-
+
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pcl/PCLEventProducer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pcl/PCLEventProducer.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pcl/PCLEventProducer.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pcl/PCLEventProducer.java Fri Jul 25 03:55:49 2008
@@ -31,7 +31,7 @@
/** Provider class for the event producer. */
class Provider {
-
+
/**
* Returns an event producer.
* @param broadcaster the event broadcaster to use
@@ -50,9 +50,9 @@
public EventModel createEventModel() {
return loadModel(getClass(), "event-model.xml");
}
-
+
}
-
+
/**
* Paper type could not be determined. Falling back to another.
* @param source the event source
@@ -62,5 +62,5 @@
* @event.severity WARN
*/
void paperTypeUnavailable(Object source, long pageWidth, long pageHeight, String fallbackPaper);
-
+
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pcl/PCLGenerator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pcl/PCLGenerator.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pcl/PCLGenerator.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pcl/PCLGenerator.java Fri Jul 25 03:55:49 2008
@@ -55,24 +55,24 @@
/** The ESC (escape) character */
public static final char ESC = '\033';
-
+
/** A list of all supported resolutions in PCL (values in dpi) */
public static final int[] PCL_RESOLUTIONS = new int[] {75, 100, 150, 200, 300, 600};
-
+
/** Selects a 4x4 Bayer dither matrix (17 grayscales) */
public static final int DITHER_MATRIX_4X4 = 4;
/** Selects a 8x8 Bayer dither matrix (65 grayscales) */
public static final int DITHER_MATRIX_8X8 = 8;
-
- private final DecimalFormatSymbols symbols = new DecimalFormatSymbols(Locale.US);
+
+ private final DecimalFormatSymbols symbols = new DecimalFormatSymbols(Locale.US);
private final DecimalFormat df2 = new DecimalFormat("0.##", symbols);
private final DecimalFormat df4 = new DecimalFormat("0.####", symbols);
-
+
private OutputStream out;
-
+
private boolean currentSourceTransparency = true;
private boolean currentPatternTransparency = true;
-
+
private int maxBitmapResolution = PCL_RESOLUTIONS[PCL_RESOLUTIONS.length - 1];
/**
@@ -80,7 +80,7 @@
* to create custom dither patterns for better grayscale quality.
*/
private boolean usePCLShades = false;
-
+
/**
* Main constructor.
* @param out the OutputStream to write the PCL stream to
@@ -88,7 +88,7 @@
public PCLGenerator(OutputStream out) {
this.out = out;
}
-
+
/**
* Main constructor.
* @param out the OutputStream to write the PCL stream to
@@ -108,17 +108,17 @@
}
this.maxBitmapResolution = maxResolution;
}
-
+
/** @return the OutputStream that this generator writes to */
public OutputStream getOutputStream() {
return this.out;
}
-
+
/** @return the maximum resolution to encode bitmap images at */
public int getMaximumBitmapResolution() {
return this.maxBitmapResolution;
}
-
+
/**
* Writes a PCL escape command to the output stream.
* @param cmd the command (without the ESCAPE character)
@@ -128,7 +128,7 @@
out.write(27); //ESC
out.write(cmd.getBytes("US-ASCII"));
}
-
+
/**
* Writes raw text (in ISO-8859-1 encoding) to the output stream.
* @param s the text
@@ -140,7 +140,7 @@
/**
* Formats a double value with two decimal positions for PCL output.
- *
+ *
* @param value value to format
* @return the formatted value
*/
@@ -150,7 +150,7 @@
/**
* Formats a double value with four decimal positions for PCL output.
- *
+ *
* @param value value to format
* @return the formatted value
*/
@@ -165,7 +165,7 @@
public void universalEndOfLanguage() throws IOException {
writeCommand("%-12345X");
}
-
+
/**
* Resets the printer and restores the user default environment.
* @throws IOException In case of an I/O error
@@ -173,7 +173,7 @@
public void resetPrinter() throws IOException {
writeCommand("E");
}
-
+
/**
* Sends the job separation command.
* @throws IOException In case of an I/O error
@@ -181,7 +181,7 @@
public void separateJobs() throws IOException {
writeCommand("&l1T");
}
-
+
/**
* Sends the form feed character.
* @throws IOException In case of an I/O error
@@ -198,7 +198,7 @@
public void setUnitOfMeasure(int value) throws IOException {
writeCommand("&u" + value + "D");
}
-
+
/**
* Sets the raster graphics resolution
* @param value the resolution value (units per inch)
@@ -207,7 +207,7 @@
public void setRasterGraphicsResolution(int value) throws IOException {
writeCommand("*t" + value + "R");
}
-
+
/**
* Selects the page size.
* @param selector the integer representing the page size
@@ -218,7 +218,7 @@
}
/**
- * Selects the paper source. The parameter is usually printer-specific. Usually, "1" is the
+ * Selects the paper source. The parameter is usually printer-specific. Usually, "1" is the
* default tray, "2" is the manual paper feed, "3" is the manual envelope feed, "4" is the
* "lower" tray and "7" is "auto-select". Consult the technical reference for your printer
* for all available values.
@@ -230,8 +230,8 @@
}
/**
- * Selects the duplexing mode for the page.
- * The parameter is usually printer-specific.
+ * Selects the duplexing mode for the page.
+ * The parameter is usually printer-specific.
* "0" means Simplex,
* "1" means Duplex, Long-Edge Binding,
* "2" means Duplex, Short-Edge Binding.
@@ -249,7 +249,7 @@
public void clearHorizontalMargins() throws IOException {
writeCommand("9");
}
-
+
/**
* The Top Margin command designates the number of lines between
* the top of the logical page and the top of the text area.
@@ -303,7 +303,7 @@
public void pushCursorPos() throws IOException {
writeCommand("&f0S");
}
-
+
/**
* Pops the current cursor position from the stack.
* @throws IOException In case of an I/O error
@@ -311,7 +311,7 @@
public void popCursorPos() throws IOException {
writeCommand("&f1S");
}
-
+
/**
* Changes the current print direction while maintaining the current cursor position.
* @param rotate the rotation angle (counterclockwise), one of 0, 90, 180 and 270.
@@ -320,10 +320,10 @@
public void changePrintDirection(int rotate) throws IOException {
writeCommand("&a" + rotate + "P");
}
-
+
/**
* Enters the HP GL/2 mode.
- * @param restorePreviousHPGL2Cursor true if the previous HP GL/2 pen position should be
+ * @param restorePreviousHPGL2Cursor true if the previous HP GL/2 pen position should be
* restored, false if the current position is maintained
* @throws IOException In case of an I/O error
*/
@@ -334,7 +334,7 @@
writeCommand("%1B");
}
}
-
+
/**
* Enters the PCL mode.
* @param restorePreviousPCLCursor true if the previous PCL cursor position should be restored,
@@ -348,7 +348,7 @@
writeCommand("%1A");
}
}
-
+
/**
* Generate a filled rectangle at the current cursor position.
*
@@ -367,10 +367,10 @@
//y += h;
}
setPatternTransparencyMode(false);
- if (usePCLShades
+ if (usePCLShades
|| Color.black.equals(col)
|| Color.white.equals(col)) {
- writeCommand("*c" + formatDouble4(w / 100.0) + "h"
+ writeCommand("*c" + formatDouble4(w / 100.0) + "h"
+ formatDouble4(h / 100.0) + "V");
int lineshade = convertToPCLShade(col);
writeCommand("*c" + lineshade + "G");
@@ -378,7 +378,7 @@
} else {
defineGrayscalePattern(col, 32, DITHER_MATRIX_4X4);
- writeCommand("*c" + formatDouble4(w / 100.0) + "h"
+ writeCommand("*c" + formatDouble4(w / 100.0) + "h"
+ formatDouble4(h / 100.0) + "V");
writeCommand("*c32G");
writeCommand("*c4P"); //User-defined pattern
@@ -391,19 +391,19 @@
private static final int[] BAYER_D2 = new int[] {0, 2, 3, 1};
private static final int[] BAYER_D4;
private static final int[] BAYER_D8;
-
+
static {
BAYER_D4 = deriveBayerMatrix(BAYER_D2);
BAYER_D8 = deriveBayerMatrix(BAYER_D4);
}
-
+
private static void setValueInMatrix(int[] dn, int half, int part, int idx, int value) {
int xoff = (part & 1) * half;
int yoff = (part & 2) * half * half;
int matrixIndex = yoff + ((int)(idx / half) * half * 2) + (idx % half) + xoff;
dn[matrixIndex] = value;
}
-
+
private static int[] deriveBayerMatrix(int[] d) {
int[] dn = new int[d.length * 4];
int half = (int)Math.sqrt(d.length);
@@ -414,7 +414,7 @@
}
return dn;
}
-
+
/**
* Generates a user-defined pattern for a dithering pattern matching the grayscale value
* of the color given.
@@ -423,7 +423,7 @@
* @param ditherMatrixSize the size of the Bayer dither matrix to use (4 or 8 supported)
* @throws IOException In case of an I/O error
*/
- public void defineGrayscalePattern(Color col, int patternID, int ditherMatrixSize)
+ public void defineGrayscalePattern(Color col, int patternID, int ditherMatrixSize)
throws IOException {
ByteArrayOutputStream baout = new ByteArrayOutputStream();
DataOutputStream data = new DataOutputStream(baout);
@@ -436,36 +436,36 @@
//data.writeShort(600); //X Resolution (didn't manage to get that to work)
//data.writeShort(600); //Y Resolution
int gray255 = convertToGray(col.getRed(), col.getGreen(), col.getBlue());
-
+
byte[] pattern;
if (ditherMatrixSize == 8) {
int gray65 = gray255 * 65 / 255;
-
+
pattern = new byte[BAYER_D8.length / 8];
-
+
for (int i = 0, c = BAYER_D8.length; i < c; i++) {
boolean dot = !(BAYER_D8[i] < gray65 - 1);
if (dot) {
int byteIdx = i / 8;
- pattern[byteIdx] |= 1 << (i % 8);
+ pattern[byteIdx] |= 1 << (i % 8);
}
}
} else {
int gray17 = gray255 * 17 / 255;
-
- //Since a 4x4 pattern did not work, the 4x4 pattern is applied 4 times to an
- //8x8 pattern. Maybe this could be changed to use an 8x8 bayer dither pattern
+
+ //Since a 4x4 pattern did not work, the 4x4 pattern is applied 4 times to an
+ //8x8 pattern. Maybe this could be changed to use an 8x8 bayer dither pattern
//instead of the 4x4 one.
pattern = new byte[BAYER_D4.length / 8 * 4];
-
+
for (int i = 0, c = BAYER_D4.length; i < c; i++) {
boolean dot = !(BAYER_D4[i] < gray17 - 1);
if (dot) {
int byteIdx = i / 4;
- pattern[byteIdx] |= 1 << (i % 4);
- pattern[byteIdx] |= 1 << ((i % 4) + 4);
- pattern[byteIdx + 4] |= 1 << (i % 4);
- pattern[byteIdx + 4] |= 1 << ((i % 4) + 4);
+ pattern[byteIdx] |= 1 << (i % 4);
+ pattern[byteIdx] |= 1 << ((i % 4) + 4);
+ pattern[byteIdx + 4] |= 1 << (i % 4);
+ pattern[byteIdx + 4] |= 1 << ((i % 4) + 4);
}
}
}
@@ -525,7 +525,7 @@
public final int convertToGray(int r, int g, int b) {
return (r * 30 + g * 59 + b * 11) / 100;
}
-
+
/**
* Convert a Color value to a PCL shade value (0-100).
* @param col the color
@@ -535,7 +535,7 @@
float gray = convertToGray(col.getRed(), col.getGreen(), col.getBlue()) / 255f;
return (int)(100 - (gray * 100f));
}
-
+
/**
* Selects the current grayscale color (the given color is converted to grayscales).
* @param col the color
@@ -555,7 +555,7 @@
}
}
}
-
+
/**
* Select the current pattern
* @param patternID the pattern ID (<ESC>*c#G command)
@@ -583,7 +583,7 @@
return false;
}
}
-
+
/**
* Indicates whether an image is a grayscale image.
* @param img the image
@@ -592,7 +592,7 @@
public static boolean isGrayscaleImage(RenderedImage img) {
return (img.getColorModel().getColorSpace().getNumComponents() == 1);
}
-
+
private MonochromeBitmapConverter createMonochromeBitmapConverter() {
MonochromeBitmapConverter converter = null;
try {
@@ -621,7 +621,7 @@
private int calculatePCLResolution(int resolution) {
return calculatePCLResolution(resolution, false);
}
-
+
/**
* Calculates the ideal PCL resolution for a given resolution.
* @param resolution the input resolution
@@ -653,35 +653,35 @@
}
return PCL_RESOLUTIONS[choice];
}
-
+
private boolean isValidPCLResolution(int resolution) {
return resolution == calculatePCLResolution(resolution);
}
-
- private Dimension getAdjustedDimension(Dimension orgDim, double orgResolution,
+
+ 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);
+ 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
for (int i = 0; i < 256; i++) {
THRESHOLD_TABLE[i] = (byte) ((i < 240) ? 255 : 0);
}
- }
-
+ }
+
private RenderedImage getMask(RenderedImage img, Dimension targetDim) {
- ColorModel cm = img.getColorModel();
+ ColorModel cm = img.getColorModel();
if (cm.hasAlpha()) {
- BufferedImage alpha = new BufferedImage(img.getWidth(), img.getHeight(),
+ BufferedImage alpha = new BufferedImage(img.getWidth(), img.getHeight(),
BufferedImage.TYPE_BYTE_GRAY);
Raster raster = img.getData();
GraphicsUtil.copyBand(raster, cm.getNumColorComponents(), alpha.getRaster(), 0);
@@ -700,7 +700,7 @@
targetDim.width, targetDim.height, 1, 1, null);
mask = new BufferedImage(colorModel, wraster, false, null);
}
-
+
Graphics2D g2d = mask.createGraphics();
try {
AffineTransform at = new AffineTransform();
@@ -732,7 +732,7 @@
* @param sourceTransparency true if the background should not be erased
* @throws IOException In case of an I/O error
*/
- public void paintBitmap(RenderedImage img, Dimension targetDim, boolean sourceTransparency)
+ public void paintBitmap(RenderedImage img, Dimension targetDim, boolean sourceTransparency)
throws IOException {
double targetResolution = img.getWidth() / UnitConv.mpt2in(targetDim.width);
int resolution = (int)Math.round(targetResolution);
@@ -745,7 +745,7 @@
if (!monochrome) {
//Transparency mask disabled. Doesn't work reliably
final boolean transparencyDisabled = true;
- RenderedImage mask = (transparencyDisabled ? null : getMask(img, effDim));
+ RenderedImage mask = (transparencyDisabled ? null : getMask(img, effDim));
if (mask != null) {
pushCursorPos();
selectCurrentPattern(0, 1); //Solid white
@@ -753,11 +753,11 @@
paintMonochromeBitmap(mask, effResolution);
popCursorPos();
}
-
+
BufferedImage src = null;
if (img instanceof BufferedImage && !scaled) {
if (!isGrayscaleImage(img) || img.getColorModel().hasAlpha()) {
- src = new BufferedImage(effDim.width, effDim.height,
+ src = new BufferedImage(effDim.width, effDim.height,
BufferedImage.TYPE_BYTE_GRAY);
ColorConvertOp op = new ColorConvertOp(
ColorSpace.getInstance(ColorSpace.CS_GRAY), null);
@@ -767,7 +767,7 @@
}
}
if (src == null) {
- src = new BufferedImage(effDim.width, effDim.height,
+ src = new BufferedImage(effDim.width, effDim.height,
BufferedImage.TYPE_BYTE_GRAY);
Graphics2D g2d = src.createGraphics();
try {
@@ -784,7 +784,7 @@
converter.setHint("quality", "false");
BufferedImage buf = (BufferedImage)converter.convertToMonochrome(src);
-
+
RenderedImage red = buf;
selectCurrentPattern(0, 0); //Solid black
setTransparencyMode(sourceTransparency || mask != null, true);
@@ -793,7 +793,7 @@
//TODO untested!
RenderedImage effImg = img;
if (scaled) {
- BufferedImage buf = new BufferedImage(effDim.width, effDim.height,
+ BufferedImage buf = new BufferedImage(effDim.width, effDim.height,
BufferedImage.TYPE_BYTE_BINARY);
Graphics2D g2d = buf.createGraphics();
try {
@@ -831,7 +831,7 @@
if (!monochrome) {
throw new IllegalArgumentException("img must be a monochrome image");
}
-
+
int x = 0;
int y = 0;
int imgw = img.getWidth();
@@ -856,7 +856,7 @@
if ((sample == 0)) {
ib |= (1 << (7 - (x % 8)));
}
-
+
//RLE encoding
if ((x % 8) == 7 || ((x + 1) == imgw)) {
if (rlewidth < bytewidth) {
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pcl/PCLGraphics2D.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pcl/PCLGraphics2D.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pcl/PCLGraphics2D.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pcl/PCLGraphics2D.java Fri Jul 25 03:55:49 2008
@@ -54,10 +54,10 @@
/** The PCL generator */
protected PCLGenerator gen;
-
+
private boolean failOnUnsupportedFeature = true;
private boolean clippingDisabled = false;
-
+
/**
* Create a new PCLGraphics2D.
* @param gen the PCL Generator to paint with
@@ -103,7 +103,7 @@
public void setClippingDisabled(boolean value) {
this.clippingDisabled = value;
}
-
+
/**
* Central handler for IOExceptions for this class.
* @param ioe IOException to handle
@@ -124,7 +124,7 @@
throw new UnsupportedOperationException(msg);
}
}
-
+
/** {@inheritDoc} */
public GraphicsConfiguration getDeviceConfiguration() {
return GraphicsEnvironment.getLocalGraphicsEnvironment().
@@ -142,7 +142,7 @@
float[] da = bs.getDashArray();
if (da != null) {
-
+
gen.writeText("UL1,");
int len = Math.min(20, da.length);
float patternLen = 0.0f;
@@ -161,7 +161,7 @@
}
if (len == 1) {
gen.writeText("," + gen.formatDouble2(da[0] * 100 / patternLen ));
-
+
}
gen.writeText(";");
/* TODO Dash phase NYI
@@ -209,7 +209,7 @@
float ml = bs.getMiterLimit();
gen.writeText(",3" + gen.formatDouble4(ml));
-
+
float lw = bs.getLineWidth();
Point2D ptSrc = new Point2D.Double(lw, 0);
//Pen widths are set as absolute metric values (WU0;)
@@ -217,7 +217,7 @@
double transDist = UnitConv.pt2mm(ptDest.distance(0, 0));
//System.out.println("--" + ptDest.distance(0, 0) + " " + transDist);
gen.writeText(";PW" + gen.formatDouble4(transDist) + ";");
-
+
} else {
handleUnsupportedFeature("Unsupported Stroke: " + stroke.getClass().getName());
}
@@ -246,7 +246,7 @@
//gen.writeText("IW;");
} else {
handleUnsupportedFeature("Clipping is not supported. Shape: " + imclip);
- /* This is an attempt to clip using the "InputWindow" (IW) but this only allows to
+ /* This is an attempt to clip using the "InputWindow" (IW) but this only allows to
* clip a rectangular area. Force falling back to bitmap mode for now.
Rectangle2D bounds = imclip.getBounds2D();
Point2D p1 = new Point2D.Double(bounds.getX(), bounds.getY());
@@ -266,16 +266,16 @@
public void draw(Shape s) {
try {
AffineTransform trans = getTransform();
-
+
Shape imclip = getClip();
writeClip(imclip);
-
+
if (!Color.black.equals(getColor())) {
//TODO PCL 5 doesn't support colored pens, PCL5c has a pen color (PC) command
handleUnsupportedFeature("Only black is supported as stroke color: " + getColor());
}
applyStroke(getStroke());
-
+
PathIterator iter = s.getPathIterator(trans);
processPathIteratorStroke(iter);
writeClip(null);
@@ -290,7 +290,7 @@
AffineTransform trans = getTransform();
Shape imclip = getClip();
writeClip(imclip);
-
+
applyPaint(getPaint());
PathIterator iter = s.getPathIterator(trans);
@@ -371,7 +371,7 @@
sb.append("\n");
gen.writeText(sb.toString());
}
-
+
/**
* Processes a path iterator generating the nexessary painting operations.
* @param iter PathIterator to process
@@ -440,7 +440,7 @@
sb.append("\n");
gen.writeText(sb.toString());
}
-
+
private void fillPolygon(int windingRule, StringBuffer sb) {
int fillMethod = (windingRule == PathIterator.WIND_EVEN_ODD ? 0 : 1);
sb.append("FP").append(fillMethod).append(";");
@@ -461,16 +461,16 @@
sb.append(",").append(gen.formatDouble4(y3)).append(";");
}
- private void quadraticBezierAbsolute(double originX, double originY,
+ private void quadraticBezierAbsolute(double originX, double originY,
double x1, double y1, double x2, double y2, StringBuffer sb) {
//Quadratic Bezier curve can be mapped to a normal bezier curve
//See http://pfaedit.sourceforge.net/bezier.html
double nx1 = originX + (2.0 / 3.0) * (x1 - originX);
double ny1 = originY + (2.0 / 3.0) * (y1 - originY);
-
+
double nx2 = nx1 + (1.0 / 3.0) * (x2 - originX);
double ny2 = ny1 + (1.0 / 3.0) * (y2 - originY);
-
+
bezierAbsolute(nx1, ny1, nx2, ny2, x2, y2, sb);
}
@@ -554,7 +554,7 @@
at.transform(p1, p1);
pclContext.getTransform().transform(p1, p1);
gen.setCursorPos(p1.getX(), p1.getY());
- gen.paintBitmap(buf, 72);
+ gen.paintBitmap(buf, 72);
gen.enterHPGL2Mode(false);
} catch (IOException ioe) {
handleIOException(ioe);
@@ -596,7 +596,7 @@
return new BufferedImage(size.width, size.height,
BufferedImage.TYPE_BYTE_GRAY);
}
-
+
/** {@inheritDoc} */
public java.awt.FontMetrics getFontMetrics(java.awt.Font f) {
return fmg.getFontMetrics(f);
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pcl/PCLGraphics2DAdapter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pcl/PCLGraphics2DAdapter.java?rev=679758&r1=679757&r2=679758&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pcl/PCLGraphics2DAdapter.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pcl/PCLGraphics2DAdapter.java Fri Jul 25 03:55:49 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.
@@ -16,7 +16,7 @@
*/
/* $Id$ */
-
+
package org.apache.fop.render.pcl;
import java.awt.Dimension;
@@ -49,15 +49,15 @@
*/
public PCLGraphics2DAdapter() {
}
-
+
/** {@inheritDoc} */
- public void paintImage(Graphics2DImagePainter painter,
+ public void paintImage(Graphics2DImagePainter painter,
RendererContext context,
int x, int y, int width, int height) throws IOException {
PCLRendererContext pclContext = PCLRendererContext.wrapRendererContext(context);
PCLRenderer pcl = (PCLRenderer)context.getRenderer();
PCLGenerator gen = pcl.gen;
-
+
// get the 'width' and 'height' attributes of the image/document
Dimension dim = painter.getImageSize();
float imw = (float)dim.getWidth();
@@ -80,11 +80,11 @@
graphics.setClippingDisabled(pclContext.isClippingDisabled());
Rectangle2D area = new Rectangle2D.Double(0.0, 0.0, imw, imh);
painter.paint(graphics, area);
-
+
//If we arrive here, the graphic is natively paintable, so write the graphic
pcl.saveGraphicsState();
pcl.setCursorPos(x, y);
- gen.writeCommand("*c" + gen.formatDouble4(width / 100f) + "x"
+ gen.writeCommand("*c" + gen.formatDouble4(width / 100f) + "x"
+ gen.formatDouble4(height / 100f) + "Y");
gen.writeCommand("*c0T");
gen.enterHPGL2Mode(false);
@@ -92,7 +92,7 @@
gen.writeText("SP1;");
//One Plotter unit is 0.025mm!
double scale = imw / UnitConv.mm2pt(imw * 0.025);
- gen.writeText("SC0," + gen.formatDouble4(scale)
+ gen.writeText("SC0," + gen.formatDouble4(scale)
+ ",0,-" + gen.formatDouble4(scale) + ",2;");
gen.writeText("IR0,100,0,100;");
gen.writeText("PU;PA0,0;\n");
@@ -104,11 +104,11 @@
painted = true;
} catch (UnsupportedOperationException uoe) {
log.debug(
- "Cannot paint graphic natively. Falling back to bitmap painting. Reason: "
+ "Cannot paint graphic natively. Falling back to bitmap painting. Reason: "
+ uoe.getMessage());
}
}
-
+
if (!painted) {
//Fallback solution: Paint to a BufferedImage
int resolution = (int)Math.round(context.getUserAgent().getTargetResolution());
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org