[FOray-commit] SF.net SVN: foray: [9067] trunk/foray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2007-04-02 23:14:38
|
Revision: 9067
http://svn.sourceforge.net/foray/?rev=9067&view=rev
Author: victormote
Date: 2007-04-02 16:14:39 -0700 (Mon, 02 Apr 2007)
Log Message:
-----------
Javadoc improvements.
Modified Paths:
--------------
trunk/foray/foray-render/src/java/org/foray/render/PrintRenderer.java
trunk/foray/foray-render/src/java/org/foray/render/TempImage.java
trunk/foray/foray-render/src/java/org/foray/render/pcl/PCLRenderer.java
trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java
trunk/foray/foray-render/src/java/org/foray/render/ps/PSGraphics2D.java
trunk/foray/scripts/checkstyle-suppressions.xml
Modified: trunk/foray/foray-render/src/java/org/foray/render/PrintRenderer.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/PrintRenderer.java 2007-04-02 22:24:21 UTC (rev 9066)
+++ trunk/foray/foray-render/src/java/org/foray/render/PrintRenderer.java 2007-04-02 23:14:39 UTC (rev 9067)
@@ -47,6 +47,10 @@
*/
public abstract class PrintRenderer extends Renderer {
+ /** A magic-number constant used to compute the width of leaders when they
+ * are "double". Presumably the logic is that the width is divided into
+ * three portions, one for one of the double components, one for the other,
+ * and one for the space between them. */
private static final byte DOUBLE_LEADER_CONSTANT = 3;
/**
Modified: trunk/foray/foray-render/src/java/org/foray/render/TempImage.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/TempImage.java 2007-04-02 22:24:21 UTC (rev 9066)
+++ trunk/foray/foray-render/src/java/org/foray/render/TempImage.java 2007-04-02 23:14:39 UTC (rev 9067)
@@ -43,15 +43,33 @@
*/
public class TempImage implements Graphic {
+ /** The image height, in millipoints. */
private int height;
+
+ /** The image width, in millipoints. */
private int width;
+
+ /** The image color space. */
private ColorSpace colorSpace;
+
+ /** The bitmap data for the image. */
private byte[] bitmaps;
+
+ /** The transparent color. */
private Color transparent = Color.white;
+
+ /** The image's URL. */
private URL url;
+ /**
+ * Constructor.
+ * @param url The image's URL.
+ * @param width The image width, in millipoints.
+ * @param height The image height, in millipoints.
+ * @param result The bitmap data for the image.
+ */
public TempImage(final URL url, final int width, final int height,
- final byte[] result) throws GraphicException {
+ final byte[] result) {
this.url = url;
this.height = height;
this.width = width;
Modified: trunk/foray/foray-render/src/java/org/foray/render/pcl/PCLRenderer.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/pcl/PCLRenderer.java 2007-04-02 22:24:21 UTC (rev 9066)
+++ trunk/foray/foray-render/src/java/org/foray/render/pcl/PCLRenderer.java 2007-04-02 23:14:39 UTC (rev 9067)
@@ -66,53 +66,81 @@
*/
public class PCLRenderer extends PrintRenderer {
+ /** Magic number adjustment to allow for an implicit PCL margin. */
private static final int OFFSET_LANDSCAPE = -180;
+ /** Magic number adjustment to allow for an implicit PCL margin. */
private static final int OFFSET_PORTRAIT = -144;
+ /** Constant indicating a portait orientation. */
+ private static final int ORIENTATION_1 = 1;
+
+ /** Constant indicating a (different ??) portait orientation. */
private static final int ORIENTATION_3 = 3;
- private static final int ORIENTATION_1 = 1;
-
+ /** The "dash-on" value for the "dashed" dash pattern. */
private static final int DASHPATTERN_DASHED_DASHON = 3;
+ /** The "dash-off" value for the "dashed" dash pattern. */
private static final int DASHPATTERN_DASHED_DASHOFF = 3;
+ /** The "dash-on" value for the "dotted" dash pattern. */
private static final int DASHPATTERN_DOTTED_DASHON = 1;
+ /** The "dash-off" value for the "dotted" dash pattern. */
private static final int DASHPATTERN_DOTTED_DASHOFF = 3;
+ /** The value into which the font size for the Courier typefaces is divided
+ * when setting their values in the PCL stream. Presumably this is because
+ * they area measured in picas instead of points??? */
private static final float COURIER_FONT_SIZE_FACTOR = 120.01f;
- private static final int FONT_CODE_ZAPF_DINGBATS = 14;
+ /** Constant indicating the font "Helvetica". */
+ private static final int FONT_CODE_HELVETICA = 1;
- private static final int FONT_CODE_SYMBOL = 13;
+ /** Constant indicating the font "Helvetica Oblique". */
+ private static final int FONT_CODE_HELVETICA_OBLIQUE = 2;
- private static final int FONT_CODE_COURIER_BOLD_OBLIQUE = 12;
+ /** Constant indicating the font "Helvetica Bold". */
+ private static final int FONT_CODE_HELVETICA_BOLD = 3;
- private static final int FONT_CODE_COURIER_BOLD = 11;
+ /** Constant indicating the font "Helvetica Bold Oblique". */
+ private static final int FONT_CODE_HELVETICA_BOLD_OBLIQUE = 4;
- private static final int FONT_CODE_COURIER_OBLIQUE = 10;
+ /** Constant indicating the font "Times Roman". */
+ private static final int FONT_CODE_TIMES_ROMAN = 5;
- private static final int FONT_CODE_COURIER = 9;
+ /** Constant indicating the font "Times Italic". */
+ private static final int FONT_CODE_TIMES_ITALIC = 6;
+ /** Constant indicating the font "Times Bold". */
+ private static final int FONT_CODE_TIMES_BOLD = 7;
+
+ /** Constant indicating the font "Times Bold Italic". */
private static final int FONT_CODE_TIMES_BOLD_ITALIC = 8;
- private static final int FONT_CODE_TIMES_BOLD = 7;
+ /** Constant indicating the font "Courier". */
+ private static final int FONT_CODE_COURIER = 9;
- private static final int FONT_CODE_TIMES_ITALIC = 6;
+ /** Constant indicating the font "Courier Oblique". */
+ private static final int FONT_CODE_COURIER_OBLIQUE = 10;
- private static final int FONT_CODE_TIMES_ROMAN = 5;
+ /** Constant indicating the font "Courier Bold". */
+ private static final int FONT_CODE_COURIER_BOLD = 11;
- private static final int FONT_CODE_HELVETICA_BOLD_OBLIQUE = 4;
+ /** Constant indicating the font "Courier Bold Oblique". */
+ private static final int FONT_CODE_COURIER_BOLD_OBLIQUE = 12;
- private static final int FONT_CODE_HELVETICA_BOLD = 3;
+ /** Constant indicating the font "Symbol". */
+ private static final int FONT_CODE_SYMBOL = 13;
- private static final int FONT_CODE_HELVETICA_OBLIQUE = 2;
+ /** Constant indicating the font "Zapf Dingbats". */
+ private static final int FONT_CODE_ZAPF_DINGBATS = 14;
- private static final int FONT_CODE_HELVETICA = 1;
+ /** The thresholds triggering normalization change in resolution. */
+ private static final short[] RESOLUTION_THRESHOLDS = {300, 150, 100, 75};
- private static final short[] RESOLUTION_THRESHOLDS = {300, 150, 100, 75};
+ /** The resolution values to which threshold values should be normalized. */
private static final short[] RESOLUTION_NORMALIZED = {600, 300, 150, 100};
/** Some unexplained margin constant, apparently expressed in decipoints. */
@@ -137,13 +165,29 @@
* WKConstants.POINTS_PER_INCH
* WKConstants.DECIPOINTS_PER_POINT);
- // These variables control the virtual pagination functionality.
+ /** The "curdiv" variable for virtual pagination. */
private int curdiv = 0;
+
+ /** The "divisions" variable for virtual pagination. */
private int divisions = -1;
- private int paperheight = -1; // Paper height in decipoints?
- private int orientation = 0; // 0=default/portrait, 1=landscape.
- private int topmargin = -1; // Top margin in decipoints?
- private int leftmargin = -1; // Left margin in decipoints?
+
+ /** The "paperheight" variable for virtual pagination. This is the paper
+ * height, in decipoints?? */
+ private int paperheight = -1;
+
+ /** The "orientation" variable for virtual pagination. 0 = default/portrait,
+ * 1 = landscape.*/
+ private int orientation = 0;
+
+ /** The "topmargin" variable, in decipoints (??), for virtual pagination. */
+ private int topmargin = -1;
+
+ /** The "leftmargin" variable, in decipoints (??), for virtual
+ * pagination. */
+ private int leftmargin = -1;
+
+ /** The "fullmargin" variable, in decipoints (??), for virtual
+ * pagination. */
private int fullmargin = 0;
/** X Offset to allow for PCL implicit 1/4" left margin. */
@@ -330,6 +374,16 @@
/* TODO: Implement this. */
}
+ /**
+ * Prints the bitmapped image.
+ * @param img The image to print.
+ * @param x The x location on the page.
+ * @param y The y location on the page.
+ * @param w The width of the image.
+ * @param h The height of the image.
+ * @return True iff the printing is successful.
+ * @throws GraphicException For errors during printing.
+ */
boolean printBMP(final Graphic img, final int x, final int y, final int w,
final int h) throws GraphicException {
// Print the passed image file in PCL.
@@ -542,7 +596,12 @@
// currentStream.add("Q\n");
}
-
+ /**
+ * Sets the font to a specifed value.
+ * @param font The font to be set.
+ * @param size The font size to be set, in points.
+ * @param name The "F1", "F2" name of the font???
+ */
public void setFont(final Font font, final float size, final String name) {
int fontcode = 0;
if (name.length() > 1 && name.charAt(0) == 'F') {
Modified: trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java 2007-04-02 22:24:21 UTC (rev 9066)
+++ trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java 2007-04-02 23:14:39 UTC (rev 9067)
@@ -458,6 +458,10 @@
}
}
+ /**
+ * Marks a specified area as being a link.
+ * @param area The area which should be marked as a link.
+ */
protected void createBasicLink(final Area area) {
boolean externalLink = false;
if (area.linkType() == LinkType.EXTERNAL) {
Modified: trunk/foray/foray-render/src/java/org/foray/render/ps/PSGraphics2D.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/ps/PSGraphics2D.java 2007-04-02 22:24:21 UTC (rev 9066)
+++ trunk/foray/foray-render/src/java/org/foray/render/ps/PSGraphics2D.java 2007-04-02 23:14:39 UTC (rev 9067)
@@ -120,6 +120,7 @@
/**
* Constructor supporting the {@link #create()} method.
+ * @param g The wrapped graphic.
*/
public PSGraphics2D(final PSGraphics2D g) {
super(g);
@@ -150,9 +151,9 @@
if (width == -1 || height == -1) {
return false;
}
-
final Dimension size = new Dimension(width, height);
- final BufferedImage buf = buildBufferedImage(size);
+ final BufferedImage buf = new BufferedImage(size.width, size.height,
+ BufferedImage.TYPE_INT_ARGB);
final int colorComponents = ColorSpace.getInstance(ColorSpace.CS_sRGB)
.getNumComponents();
@@ -225,11 +226,6 @@
return true;
}
- public BufferedImage buildBufferedImage(final Dimension size) {
- return new BufferedImage(size.width, size.height,
- BufferedImage.TYPE_INT_ARGB);
- }
-
/**
* {@inheritDoc}
*/
@@ -355,6 +351,12 @@
this.psRenderer.write("clippath");
}
+ /**
+ * Apply the paint to this graphic.
+ * @param paint The paint to use.
+ * @param fill Indicates whether the paint is for fill (true) or stroke
+ * (false).
+ */
protected void applyPaint(final Paint paint, final boolean fill) {
if (paint instanceof GradientPaint) {
final GradientPaint gp = (GradientPaint) paint;
@@ -395,6 +397,10 @@
} else if (paint instanceof TexturePaint) { }
}
+ /**
+ * Draw the graphic using a specified Stroke.
+ * @param stroke The stroke to use for drawing.
+ */
protected void applyStroke(final Stroke stroke) {
if (stroke instanceof BasicStroke) {
final BasicStroke bs = (BasicStroke) stroke;
@@ -666,6 +672,12 @@
this.psRenderer.write("grestore");
}
+ /**
+ * Write the command to the renderer.
+ * @param fill Set to true if filling.
+ * @param stroke Set to true if stroking.
+ * @param nonzero An unknown parameter which seems to have no effect.
+ */
protected void doDrawing(final boolean fill, final boolean stroke,
final boolean nonzero) {
if (fill) {
Modified: trunk/foray/scripts/checkstyle-suppressions.xml
===================================================================
--- trunk/foray/scripts/checkstyle-suppressions.xml 2007-04-02 22:24:21 UTC (rev 9066)
+++ trunk/foray/scripts/checkstyle-suppressions.xml 2007-04-02 23:14:39 UTC (rev 9067)
@@ -17,7 +17,7 @@
<suppress checks="Javadoc[MV].*"
files="org.foray.pdf.*"/>
<suppress checks="Javadoc[MV].*"
- files="org.foray.render.*"/>
+ files="org.foray.render.awt.*"/>
<!-- Suppress Javadoc package documentation for test directories. -->
<suppress checks="PackageHtml"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|