Author: jeremias
Date: Mon Jul 28 06:01:58 2008
New Revision: 680338
URL: http://svn.apache.org/viewvc?rev=680338&view=rev
Log:
Reduce code duplication and make the toString() methods available to the
outside (need them for debugging later).
Modified:
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/AbstractXMLWritingIFPainter.java
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFSerializer.java
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/sandbox/org/apache/fop/render/svg/AbstractSVGPainter.java
Modified:
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/AbstractXMLWritingIFPainter.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/AbstractXMLWritingIFPainter.java?rev=680338&r1=680337&r2=680338&view=diff
==============================================================================
---
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/AbstractXMLWritingIFPainter.java
(original)
+++
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/AbstractXMLWritingIFPainter.java
Mon Jul 28 06:01:58 2008
@@ -120,7 +120,7 @@
* @param sb the StringBuffer to write the transform method to
* @return the StringBuffer passed to this method
*/
- protected StringBuffer toString(AffineTransform transform, StringBuffer
sb) {
+ public static StringBuffer toString(AffineTransform transform,
StringBuffer sb) {
if (transform.isIdentity()) {
return sb;
}
@@ -146,6 +146,40 @@
}
/**
+ * Converts an [EMAIL PROTECTED] AffineTransform} array to an SVG style
transform method sequence.
+ * @param transforms the transformation matrix array
+ * @param sb the StringBuffer to write the transform method sequence to
+ * @return the StringBuffer passed to this method
+ */
+ public static StringBuffer toString(AffineTransform[] transforms,
StringBuffer sb) {
+ for (int i = 0, c = transforms.length; i < c; i++) {
+ if (i > 0) {
+ sb.append(' ');
+ }
+ toString(transforms[i], sb);
+ }
+ return sb;
+ }
+
+ /**
+ * Converts an [EMAIL PROTECTED] AffineTransform} array to an SVG style
transform method sequence.
+ * @param transforms the transformation matrix array
+ * @return the formatted array
+ */
+ public static String toString(AffineTransform[] transforms) {
+ return toString(transforms, new StringBuffer()).toString();
+ }
+
+ /**
+ * Converts an [EMAIL PROTECTED] AffineTransform} instance to an SVG style
transform method.
+ * @param transform the transformation matrix
+ * @return the formatted array
+ */
+ public static String toString(AffineTransform transform) {
+ return toString(transform, new StringBuffer()).toString();
+ }
+
+ /**
* Convenience method to generate a startElement SAX event.
* @param localName the local name of the element
* @param atts the attributes
Modified:
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFSerializer.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFSerializer.java?rev=680338&r1=680337&r2=680338&view=diff
==============================================================================
---
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFSerializer.java
(original)
+++
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/render/intermediate/IFSerializer.java
Mon Jul 28 06:01:58 2008
@@ -202,22 +202,13 @@
/** [EMAIL PROTECTED] */
public void startViewport(AffineTransform transform, Dimension size,
Rectangle clipRect)
throws IFException {
- StringBuffer sb = new StringBuffer();
- toString(transform, sb);
- startViewport(sb.toString(), size, clipRect);
+ startViewport(toString(transform), size, clipRect);
}
/** [EMAIL PROTECTED] */
public void startViewport(AffineTransform[] transforms, Dimension size,
Rectangle clipRect)
throws IFException {
- StringBuffer sb = new StringBuffer();
- for (int i = 0, c = transforms.length; i < c; i++) {
- if (i > 0) {
- sb.append(' ');
- }
- toString(transforms[i], sb);
- }
- startViewport(sb.toString(), size, clipRect);
+ startViewport(toString(transforms), size, clipRect);
}
private void startViewport(String transform, Dimension size, Rectangle
clipRect) throws IFException {
@@ -248,21 +239,12 @@
/** [EMAIL PROTECTED] */
public void startGroup(AffineTransform[] transforms) throws IFException {
- StringBuffer sb = new StringBuffer();
- for (int i = 0, c = transforms.length; i < c; i++) {
- if (i > 0) {
- sb.append(' ');
- }
- toString(transforms[i], sb);
- }
- startGroup(sb.toString());
+ startGroup(toString(transforms));
}
/** [EMAIL PROTECTED] */
public void startGroup(AffineTransform transform) throws IFException {
- StringBuffer sb = new StringBuffer();
- toString(transform, sb);
- startGroup(sb.toString());
+ startGroup(toString(transform));
}
private void startGroup(String transform) throws IFException {
Modified:
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/sandbox/org/apache/fop/render/svg/AbstractSVGPainter.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/sandbox/org/apache/fop/render/svg/AbstractSVGPainter.java?rev=680338&r1=680337&r2=680338&view=diff
==============================================================================
---
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/sandbox/org/apache/fop/render/svg/AbstractSVGPainter.java
(original)
+++
xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/sandbox/org/apache/fop/render/svg/AbstractSVGPainter.java
Mon Jul 28 06:01:58 2008
@@ -85,20 +85,7 @@
/** [EMAIL PROTECTED] */
public void startViewport(AffineTransform transform, Dimension size,
Rectangle clipRect)
throws IFException {
- StringBuffer sb = new StringBuffer();
- toString(transform, sb);
- startViewport(sb.toString(), size, clipRect);
- }
-
- private String toString(AffineTransform[] transforms) {
- StringBuffer sb = new StringBuffer();
- for (int i = 0, c = transforms.length; i < c; i++) {
- if (i > 0) {
- sb.append(' ');
- }
- toString(transforms[i], sb);
- }
- return sb.toString();
+ startViewport(toString(transform), size, clipRect);
}
/** [EMAIL PROTECTED] */
@@ -166,9 +153,7 @@
/** [EMAIL PROTECTED] */
public void startGroup(AffineTransform transform) throws IFException {
- StringBuffer sb = new StringBuffer();
- toString(transform, sb);
- startGroup(sb.toString());
+ startGroup(toString(transform));
}
private void startGroup(String transform) throws IFException {
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]