[FOray-commit] SF.net SVN: foray: [10246] trunk/foray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2007-10-05 20:15:32
|
Revision: 10246
http://foray.svn.sourceforge.net/foray/?rev=10246&view=rev
Author: victormote
Date: 2007-10-05 13:15:33 -0700 (Fri, 05 Oct 2007)
Log Message:
-----------
Conform to axsl changes removing unnecessary parameter.
Modified Paths:
--------------
trunk/foray/foray-graphic/src/java/org/foray/graphic/SVGGraphic.java
trunk/foray/foray-render/src/java/org/foray/render/awt/AWTRenderer.java
Added Paths:
-----------
trunk/foray/foray-common/src/java/org/foray/common/Java2dUtil.java
Added: trunk/foray/foray-common/src/java/org/foray/common/Java2dUtil.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/Java2dUtil.java (rev 0)
+++ trunk/foray/foray-common/src/java/org/foray/common/Java2dUtil.java 2007-10-05 20:15:33 UTC (rev 10246)
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2007 The FOray Project.
+ * http://www.foray.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This work is in part derived from the following work(s), used with the
+ * permission of the licensor:
+ * Apache FOP, licensed by the Apache Software Foundation
+ *
+ */
+
+/*
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ * $LastChangedBy$
+ */
+
+package org.foray.common;
+
+import java.awt.geom.Rectangle2D;
+
+/**
+ * Utilities for Java2D.
+ */
+public final class Java2dUtil {
+
+ /**
+ * Private Constructor. This class is a utility class, and should never be
+ * instantiated.
+ */
+ private Java2dUtil() { }
+
+ /**
+ * Converts a rectangle from the FOray area tree coordinate system to the
+ * Java2D user space coordinate system.
+ * The FOray coordinate system maps 0,0 to the lower left corner of the
+ * page.
+ * The Java2D coordinate system maps 0,0 to the upper left corner of the
+ * page.
+ * @param inputRectangle The rectangle expressed in FOray area tree
+ * coordinates.
+ * @param pageHeight The height of the page on which the rectangle will be
+ * placed.
+ * @return A new Rectangle2D instance with the coordinates expressed in
+ * Java2D user space.
+ */
+ public static Rectangle2D.Float areaToJava2dCoordinates(
+ final Rectangle2D.Float inputRectangle, final float pageHeight) {
+ final Rectangle2D.Float outputRectangle = new Rectangle2D.Float();
+ outputRectangle.setRect(inputRectangle.x, pageHeight - inputRectangle.y,
+ inputRectangle.width, inputRectangle.height);
+ return outputRectangle;
+ }
+
+}
Property changes on: trunk/foray/foray-common/src/java/org/foray/common/Java2dUtil.java
___________________________________________________________________
Name: svn:keywords
+ "Author Id Rev Date URL"
Name: svn:eol-style
+ native
Modified: trunk/foray/foray-graphic/src/java/org/foray/graphic/SVGGraphic.java
===================================================================
--- trunk/foray/foray-graphic/src/java/org/foray/graphic/SVGGraphic.java 2007-10-05 18:26:52 UTC (rev 10245)
+++ trunk/foray/foray-graphic/src/java/org/foray/graphic/SVGGraphic.java 2007-10-05 20:15:33 UTC (rev 10246)
@@ -230,15 +230,9 @@
* {@inheritDoc}
*/
public void drawGraphics2D(final Graphics2D graphics,
- final Rectangle2D.Float contentRectangle, final int pageHeight) {
+ final Rectangle2D.Float contentRectangle) throws GraphicException {
SVGDocument svgDocument;
- try {
- svgDocument = this.getSvgDocument();
- } catch (final GraphicException e) {
- /* For some reason the SVGDocument is not usable. There is nothing
- * to do. */
- return;
- }
+ svgDocument = this.getSvgDocument();
final float x = contentRectangle.x;
final float y = contentRectangle.y;
final float w = contentRectangle.width;
@@ -248,7 +242,7 @@
return;
}
- graphics.translate(x, pageHeight - y);
+ graphics.translate(x, y);
final SVGSVGElement svg = svgDocument.getRootElement();
final AffineTransform at = ViewBox.getPreserveAspectRatioTransform(svg,
@@ -271,7 +265,7 @@
if (inverse != null && !inverse.isIdentity()) {
graphics.transform(inverse);
}
- graphics.translate(- x, y - pageHeight);
+ graphics.translate(-x, -y);
}
/**
Modified: trunk/foray/foray-render/src/java/org/foray/render/awt/AWTRenderer.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/awt/AWTRenderer.java 2007-10-05 18:26:52 UTC (rev 10245)
+++ trunk/foray/foray-render/src/java/org/foray/render/awt/AWTRenderer.java 2007-10-05 20:15:33 UTC (rev 10246)
@@ -744,8 +744,7 @@
final Rectangle2D.Float contentRectangle,
final Rectangle2D.Float clipRectangle) {
try {
- graphic.drawGraphics2D(this.graphics, contentRectangle,
- this.pageHeight);
+ graphic.drawGraphics2D(this.graphics, contentRectangle);
} catch (final GraphicException e) {
/* TODO: Consider logging/displaying a warning. */
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|