]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
changes for the new java bindings
authorKeiron Liddle <keiron@apache.org>
Tue, 18 Jul 2000 05:34:44 +0000 (05:34 +0000)
committerKeiron Liddle <keiron@apache.org>
Tue, 18 Jul 2000 05:34:44 +0000 (05:34 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193517 13f79535-47bb-0310-9956-ffa450edef68

src/org/apache/fop/datatypes/PathData.java
src/org/apache/fop/datatypes/TransformData.java

index 207e213b34dc39e2ee1451280143b0700dba75d9..bdb91cf63994f220c5970560d8c2fa54636d1818 100644 (file)
@@ -92,7 +92,7 @@ public class PathData {
                                float[][] vals = getPoints(2, st);
                                if(vals != null) {
                                        for(int count = 0; count < vals.length; count++) {
-                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.SVG_PATHSEG_MOVETO_ABS, vals[count]));
+                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_MOVETO_ABS, vals[count]));
                                        }
                                }
                        } else if(str.equals("m")) {
@@ -101,123 +101,123 @@ public class PathData {
                                float[][] vals = getPoints(2, st);
                                if(vals != null) {
                                        for(int count = 0; count < vals.length; count++) {
-                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.SVG_PATHSEG_MOVETO_REL, vals[count]));
+                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_MOVETO_REL, vals[count]));
                                        }
                                }
                        } else if(str.equals("L")) {
                                float[][] vals = getPoints(2, st);
                                if(vals != null) {
                                        for(int count = 0; count < vals.length; count++) {
-                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.SVG_PATHSEG_LINETO_ABS, vals[count]));
+                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_LINETO_ABS, vals[count]));
                                        }
                                }
                        } else if(str.equals("l")) {
                                float[][] vals = getPoints(2, st);
                                if(vals != null) {
                                        for(int count = 0; count < vals.length; count++) {
-                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.SVG_PATHSEG_LINETO_REL, vals[count]));
+                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_LINETO_REL, vals[count]));
                                        }
                                }
                        } else if(str.equals("H")) {
                                float[][] vals = getPoints(1, st);
                                if(vals != null) {
                                        for(int count = 0; count < vals.length; count++) {
-                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.SVG_PATHSEG_LINETO_HORIZONTAL_ABS, vals[count]));
+                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_ABS, vals[count]));
                                        }
                                }
                        } else if(str.equals("h")) {
                                float[][] vals = getPoints(1, st);
                                if(vals != null) {
                                        for(int count = 0; count < vals.length; count++) {
-                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.SVG_PATHSEG_LINETO_HORIZONTAL_REL, vals[count]));
+                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_LINETO_HORIZONTAL_REL, vals[count]));
                                        }
                                }
                        } else if(str.equals("V")) {
                                float[][] vals = getPoints(1, st);
                                if(vals != null) {
                                        for(int count = 0; count < vals.length; count++) {
-                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.SVG_PATHSEG_LINETO_VERTICAL_ABS, vals[count]));
+                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_LINETO_VERTICAL_ABS, vals[count]));
                                        }
                                }
                        } else if(str.equals("v")) {
                                float[][] vals = getPoints(1, st);
                                if(vals != null) {
                                        for(int count = 0; count < vals.length; count++) {
-                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.SVG_PATHSEG_LINETO_VERTICAL_REL, vals[count]));
+                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_LINETO_VERTICAL_REL, vals[count]));
                                        }
                                }
                        } else if(str.equals("C")) {
                                float[][] vals = getPoints(6, st);
                                if(vals != null) {
                                        for(int count = 0; count < vals.length; count++) {
-                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.SVG_PATHSEG_CURVETO_CUBIC_ABS, vals[count]));
+                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_CURVETO_CUBIC_ABS, vals[count]));
                                        }
                                }
                        } else if(str.equals("c")) {
                                float[][] vals = getPoints(6, st);
                                if(vals != null) {
                                        for(int count = 0; count < vals.length; count++) {
-                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.SVG_PATHSEG_CURVETO_CUBIC_REL, vals[count]));
+                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_CURVETO_CUBIC_REL, vals[count]));
                                        }
                                }
                        } else if(str.equals("S")) {
                                float[][] vals = getPoints(4, st);
                                if(vals != null) {
                                        for(int count = 0; count < vals.length; count++) {
-                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.SVG_PATHSEG_CURVETO_CUBIC_SMOOTH_ABS, vals[count]));
+                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_ABS, vals[count]));
                                        }
                                }
                        } else if(str.equals("s")) {
                                float[][] vals = getPoints(4, st);
                                if(vals != null) {
                                        for(int count = 0; count < vals.length; count++) {
-                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.SVG_PATHSEG_CURVETO_CUBIC_SMOOTH_REL, vals[count]));
+                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_CURVETO_CUBIC_SMOOTH_REL, vals[count]));
                                        }
                                }
                        } else if(str.equals("Q")) {
                                float[][] vals = getPoints(4, st);
                                if(vals != null) {
                                        for(int count = 0; count < vals.length; count++) {
-                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.SVG_PATHSEG_CURVETO_QUADRATIC_ABS, vals[count]));
+                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_ABS, vals[count]));
                                        }
                                }
                        } else if(str.equals("q")) {
                                float[][] vals = getPoints(4, st);
                                if(vals != null) {
                                        for(int count = 0; count < vals.length; count++) {
-                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.SVG_PATHSEG_CURVETO_QUADRATIC_REL, vals[count]));
+                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_REL, vals[count]));
                                        }
                                }
                        } else if(str.equals("T")) {
                                float[][] vals = getPoints(2, st);
                                if(vals != null) {
                                        for(int count = 0; count < vals.length; count++) {
-                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.SVG_PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS, vals[count]));
+                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS, vals[count]));
                                        }
                                }
                        } else if(str.equals("t")) {
                                float[][] vals = getPoints(2, st);
                                if(vals != null) {
                                        for(int count = 0; count < vals.length; count++) {
-                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.SVG_PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL, vals[count]));
+                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL, vals[count]));
                                        }
                                }
                        } else if(str.equals("A")) {
                                float[][] vals = getPoints(7, st);
                                if(vals != null) {
                                        for(int count = 0; count < vals.length; count++) {
-                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.SVG_PATHSEG_ARC_ABS, vals[count]));
+                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_ARC_ABS, vals[count]));
                                        }
                                }
                        } else if(str.equals("a")) {
                                float[][] vals = getPoints(7, st);
                                if(vals != null) {
                                        for(int count = 0; count < vals.length; count++) {
-                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.SVG_PATHSEG_ARC_REL, vals[count]));
+                                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_ARC_REL, vals[count]));
                                        }
                                }
                        } else if(str.equals("Z") || str.equals("z")) {
-                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.SVG_PATHSEG_CLOSEPATH, null));
+                               addSVGPathSeg(new SVGPathSegImpl(SVGPathSeg.PATHSEG_CLOSEPATH, null));
                        }
                }
        }
index f2147b73ab9d16cdf2b78e7e9f465d72df4aada7..8cbacce342df01b82fe18e9ca4cfc36ef412f01a 100644 (file)
@@ -82,48 +82,53 @@ public class TransformData {
                                value = st.nextToken().trim();
                                SVGTransformImpl transform = new SVGTransformImpl();
                                if(type.equals("translate")) {
-                                       SVGLengthImpl xlen;
-                                       SVGLengthImpl ylen;
+                                       float xlen = 0;
+                                       float ylen = 0;
                                        int pos = value.indexOf(",");
                                        if(pos != -1) {
-                                               xlen = new SVGLengthImpl(value.substring(0, pos).trim());
-                                               ylen = new SVGLengthImpl(value.substring(pos + 1, value.length()).trim());
-                                       } else {
-                                               xlen = new SVGLengthImpl("0");
-                                               ylen = new SVGLengthImpl("0");
+                                               SVGLengthImpl length;
+                                               length = new SVGLengthImpl();
+                                               length.setValueAsString(value.substring(0, pos).trim());
+                                               xlen = length.getValue();
+                                               length = new SVGLengthImpl();
+                                               length.setValueAsString(value.substring(pos + 1, value.length()).trim());
+                                               ylen = length.getValue();
                                        }
                                        transform.setTranslate(xlen, ylen);
                                        list.addElement(transform);
                                } else if(type.equals("skewX")) {
-                                       SVGAngleImpl angle = new SVGAngleImpl();
-                                       angle.setValueAsString(value);
+//                                     SVGAngleImpl angle = new SVGAngleImpl();
+//                                     angle.setValueAsString(value);
+                                       float angle = Float.valueOf(value).floatValue();
                                        transform.setSkewX(angle);
                                        list.addElement(transform);
                                } else if(type.equals("skewY")) {
-                                       SVGAngleImpl angle = new SVGAngleImpl();
-                                       angle.setValueAsString(value);
+       //                              SVGAngleImpl angle = new SVGAngleImpl();
+//                                     angle.setValueAsString(value);
+                                       float angle = Float.valueOf(value).floatValue();
                                        transform.setSkewY(angle);
                                        list.addElement(transform);
                                } else if(type.equals("scale")) {
-                                       SVGNumberImpl xlen = new SVGNumberImpl();
-                                       SVGNumberImpl ylen = new SVGNumberImpl();
+                                       float xlen = 0;
+                                       float ylen = 0;
                                        int pos = value.indexOf(",");
                                        if(pos != -1) {
-                                               try {
-                                                       xlen.setValue((new Float(value.substring(0, pos).trim())).floatValue());
-                                               } catch(Exception e) {
-                                               }
-                                               try {
-                                                       ylen.setValue((new Float(value.substring(pos + 1, value.length()).trim()).floatValue()));
-                                               } catch(Exception e) {
-                                               }
+//                                             try {
+                                                       xlen = Float.valueOf(value.substring(0, pos).trim()).floatValue();
+//                                             } catch(Exception e) {
+//                                             }
+//                                             try {
+                                                       ylen = Float.valueOf(value.substring(pos + 1, value.length()).trim()).floatValue();
+//                                             } catch(Exception e) {
+//                                             }
                                        }
                                        transform.setScale(xlen, ylen);
                                        list.addElement(transform);
                                } else if(type.equals("rotate")) {
-                                       SVGAngleImpl angle = new SVGAngleImpl();
-                                       angle.setValueAsString(value);
-                                       transform.setRotate(angle);
+       //                              SVGAngleImpl angle = new SVGAngleImpl();
+//                                     angle.setValueAsString(value);
+                                       float angle = Float.valueOf(value).floatValue();
+                                       transform.setRotate(angle, 0, 0);
                                        list.addElement(transform);
                                } else if(type.equals("matrix")) {
                                        SVGMatrixImpl matrix = new SVGMatrixImpl();
@@ -202,11 +207,14 @@ public class TransformData {
                                                                break;
                                                        tok = mt.nextToken();
                                                }
+                                               float floatVal = Float.valueOf(tok).floatValue();
                                                if(neg)
-                                                       tok = "-" + tok;
-                                               length = new SVGLengthImpl();
-                                               length.setValueAsString(tok);
-                                               matrix.setE(length);
+                                                       floatVal = -floatVal;
+//                                             if(neg)
+//                                                     tok = "-" + tok;
+//                                             length = new SVGLengthImpl();
+//                                             length.setValueAsString(tok);
+                                               matrix.setE(floatVal);
                                        }
                                        if(mt.hasMoreTokens()) {
                                                tok = mt.nextToken();
@@ -218,11 +226,14 @@ public class TransformData {
                                                                break;
                                                        tok = mt.nextToken();
                                                }
+                                               float floatVal = Float.valueOf(tok).floatValue();
                                                if(neg)
-                                                       tok = "-" + tok;
-                                               length = new SVGLengthImpl();
-                                               length.setValueAsString(tok);
-                                               matrix.setF(length);
+                                                       floatVal = -floatVal;
+//                                             if(neg)
+//                                                     tok = "-" + tok;
+//                                             length = new SVGLengthImpl();
+//                                             length.setValueAsString(tok);
+                                               matrix.setF(floatVal);
                                        }
                                        transform.setMatrix(matrix);
                                        list.addElement(transform);