src/java.desktop/share/classes/java/awt/geom/Path2D.java

Print this page




2658             default:
2659                 throw new StreamCorruptedException("unrecognized path type");
2660             }
2661             needRoom(segtype != SEG_MOVETO, npoints * 2);
2662             if (isdbl) {
2663                 while (--npoints >= 0) {
2664                     append(s.readDouble(), s.readDouble());
2665                 }
2666             } else {
2667                 while (--npoints >= 0) {
2668                     append(s.readFloat(), s.readFloat());
2669                 }
2670             }
2671             pointTypes[numTypes++] = segtype;
2672         }
2673         if (nT >= 0 && s.readByte() != SERIAL_PATH_END) {
2674             throw new StreamCorruptedException("missing PATH_END");
2675         }
2676     }
2677 
2678     static abstract class Iterator implements PathIterator {
2679         int typeIdx;
2680         int pointIdx;
2681         Path2D path;
2682 
2683         static final int curvecoords[] = {2, 2, 4, 6, 0};
2684 
2685         Iterator(Path2D path) {
2686             this.path = path;
2687         }
2688 
2689         public int getWindingRule() {
2690             return path.getWindingRule();
2691         }
2692 
2693         public boolean isDone() {
2694             return (typeIdx >= path.numTypes);
2695         }
2696 
2697         public void next() {
2698             int type = path.pointTypes[typeIdx++];


2658             default:
2659                 throw new StreamCorruptedException("unrecognized path type");
2660             }
2661             needRoom(segtype != SEG_MOVETO, npoints * 2);
2662             if (isdbl) {
2663                 while (--npoints >= 0) {
2664                     append(s.readDouble(), s.readDouble());
2665                 }
2666             } else {
2667                 while (--npoints >= 0) {
2668                     append(s.readFloat(), s.readFloat());
2669                 }
2670             }
2671             pointTypes[numTypes++] = segtype;
2672         }
2673         if (nT >= 0 && s.readByte() != SERIAL_PATH_END) {
2674             throw new StreamCorruptedException("missing PATH_END");
2675         }
2676     }
2677 
2678     abstract static class Iterator implements PathIterator {
2679         int typeIdx;
2680         int pointIdx;
2681         Path2D path;
2682 
2683         static final int curvecoords[] = {2, 2, 4, 6, 0};
2684 
2685         Iterator(Path2D path) {
2686             this.path = path;
2687         }
2688 
2689         public int getWindingRule() {
2690             return path.getWindingRule();
2691         }
2692 
2693         public boolean isDone() {
2694             return (typeIdx >= path.numTypes);
2695         }
2696 
2697         public void next() {
2698             int type = path.pointTypes[typeIdx++];