[FOray-commit] SF.net SVN: foray: [8709] trunk/foray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2007-02-15 14:27:27
|
Revision: 8709
http://svn.sourceforge.net/foray/?rev=8709&view=rev
Author: victormote
Date: 2007-02-15 06:27:26 -0800 (Thu, 15 Feb 2007)
Log Message:
-----------
Clean up some constant usages.
Modified Paths:
--------------
trunk/foray/foray-common/src/java/org/foray/common/WKConstants.java
trunk/foray/foray-render/src/java/org/foray/render/Renderer.java
Modified: trunk/foray/foray-common/src/java/org/foray/common/WKConstants.java
===================================================================
--- trunk/foray/foray-common/src/java/org/foray/common/WKConstants.java 2007-02-15 01:52:04 UTC (rev 8708)
+++ trunk/foray/foray-common/src/java/org/foray/common/WKConstants.java 2007-02-15 14:27:26 UTC (rev 8709)
@@ -158,6 +158,9 @@
/** Constant defining an invalid character value. */
public static final char INVALID_UNICODE_CHARACTER = Character.MAX_VALUE;
+ /** Constant defining the largest integral color value, that is, 255. */
+ public static final short MAXIMUM_INTEGRAL_COLOR_VALUE = 255;
+
/**
* Private constructor. This is a utility class, and should never be
* instantiated.
Modified: trunk/foray/foray-render/src/java/org/foray/render/Renderer.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/Renderer.java 2007-02-15 01:52:04 UTC (rev 8708)
+++ trunk/foray/foray-render/src/java/org/foray/render/Renderer.java 2007-02-15 14:27:26 UTC (rev 8709)
@@ -33,6 +33,7 @@
package org.foray.render;
+import org.foray.common.FOrayConstants;
import org.foray.common.MUserAgent;
import org.foray.common.SVGUserAgent;
import org.foray.common.WKConstants;
@@ -80,6 +81,7 @@
import java.awt.Color;
import java.awt.Rectangle;
+import java.awt.Transparency;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
import java.io.IOException;
@@ -93,19 +95,15 @@
public abstract class Renderer extends OutputTarget
implements org.axsl.output.Renderer, org.axsl.areaR.RenderVisitor {
- /** The number of millipoints in a point. */
- public static final float MILLIPOINT_CONVERSION_FACTOR = 1000f;
-
- /** The number of pixels in an inch. */
- public static final byte PIXELS_PER_INCH = 96;
-
- /** */
- public static final int MAXIMUM_INTEGRAL_COLOR_VALUE = 255;
-
+ /** Magic-number constant used in the conversion of color to gray. */
protected static final float SHADING_WEIGHT_RED = 0.3f;
+ /* TODO: Replace these magic numbers for color-to-gray conversion with
+ * AWT methods that convert from one colorspace to another. */
+ /** Magic-number constant used in the conversion of color to gray. */
protected static final float SHADING_WEIGHT_GREEN = 0.59f;
+ /** Magic-number constant used in the conversion of color to gray. */
protected static final float SHADING_WEIGHT_BLUE = 0.11f;
private AreaTree areaTree;
@@ -156,7 +154,7 @@
}
final Color backgroundColor = area.traitBackgroundColor();
- if (backgroundColor.getAlpha() == MAXIMUM_INTEGRAL_COLOR_VALUE) {
+ if (backgroundColor.getTransparency() == Transparency.OPAQUE) {
this.drawRectangle(x, y, w, -h, false, null, true, backgroundColor);
}
}
@@ -268,7 +266,7 @@
* @return The pixel density, per inch.
*/
public int getPixelsPerInch() {
- return PIXELS_PER_INCH;
+ return FOrayConstants.DEFAULT_SCREEN_RESOLUTION;
}
/**
@@ -604,12 +602,12 @@
* @return The converted value in points.
*/
protected static float toPoints(final int millipoints) {
- return millipoints / MILLIPOINT_CONVERSION_FACTOR;
+ return millipoints / WKConstants.MILLIPOINTS_PER_POINT;
}
/**
* Converts a color value in the range 0 - 255 to its floating-point
- * equivelant, that is, a value in the range 0 - 1.
+ * equivalant, that is, a value in the range 0 - 1.
* @param integralColorComponent The integral color value to be converted, a
* value in the range 0 - 255.
* @return The floating point value, a value in the range 0 - 1.
@@ -617,8 +615,8 @@
protected static float colorToFloat(final int integralColorComponent) {
int colorValue = Math.max(integralColorComponent, 0);
colorValue = Math.min(integralColorComponent,
- MAXIMUM_INTEGRAL_COLOR_VALUE);
- return colorValue / MAXIMUM_INTEGRAL_COLOR_VALUE;
+ WKConstants.MAXIMUM_INTEGRAL_COLOR_VALUE);
+ return colorValue / WKConstants.MAXIMUM_INTEGRAL_COLOR_VALUE;
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|