home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / rt.jar / sun / font / LayoutPathImpl$SegmentPath$Mapper.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  2.5 KB  |  115 lines

  1. package sun.font;
  2.  
  3. import java.awt.Shape;
  4. import java.awt.geom.AffineTransform;
  5. import java.awt.geom.GeneralPath;
  6. import java.awt.geom.PathIterator;
  7. import java.awt.geom.Point2D;
  8. import java.util.ArrayList;
  9. import sun.font.LayoutPathImpl.SegmentPath;
  10.  
  11. class LayoutPathImpl$SegmentPath$Mapper {
  12.    // $FF: renamed from: li sun.font.LayoutPathImpl.SegmentPath.LineInfo
  13.    final LayoutPathImpl.SegmentPath.LineInfo field_0;
  14.    final ArrayList<LayoutPathImpl.SegmentPath.Segment> segments;
  15.    final Point2D.Double mpt;
  16.    final Point2D.Double cpt;
  17.    boolean haveMT;
  18.    // $FF: synthetic field
  19.    final LayoutPathImpl.SegmentPath this$0;
  20.  
  21.    LayoutPathImpl$SegmentPath$Mapper(LayoutPathImpl.SegmentPath var1) {
  22.       this.this$0 = var1;
  23.       this.field_0 = new LayoutPathImpl.SegmentPath.LineInfo(var1);
  24.       this.segments = new ArrayList();
  25.  
  26.       for(int var2 = 3; var2 < SegmentPath.access$000(var1).length; var2 += 3) {
  27.          if (SegmentPath.access$000(var1)[var2 + 2] != SegmentPath.access$000(var1)[var2 - 1]) {
  28.             this.segments.add(new LayoutPathImpl.SegmentPath.Segment(var1, var2));
  29.          }
  30.       }
  31.  
  32.       this.mpt = new Point2D.Double();
  33.       this.cpt = new Point2D.Double();
  34.    }
  35.  
  36.    void init() {
  37.       this.haveMT = false;
  38.  
  39.       for(LayoutPathImpl.SegmentPath.Segment var2 : this.segments) {
  40.          var2.init();
  41.       }
  42.  
  43.    }
  44.  
  45.    void moveTo(double var1, double var3) {
  46.       this.mpt.x = var1;
  47.       this.mpt.y = var3;
  48.       this.haveMT = true;
  49.    }
  50.  
  51.    void lineTo(double var1, double var3) {
  52.       if (this.haveMT) {
  53.          this.cpt.x = this.mpt.x;
  54.          this.cpt.y = this.mpt.y;
  55.       }
  56.  
  57.       if (var1 != this.cpt.x || var3 != this.cpt.y) {
  58.          if (this.haveMT) {
  59.             this.haveMT = false;
  60.  
  61.             for(LayoutPathImpl.SegmentPath.Segment var6 : this.segments) {
  62.                var6.move();
  63.             }
  64.          }
  65.  
  66.          this.field_0.set(this.cpt.x, this.cpt.y, var1, var3);
  67.  
  68.          for(LayoutPathImpl.SegmentPath.Segment var8 : this.segments) {
  69.             var8.line(this.field_0);
  70.          }
  71.  
  72.          this.cpt.x = var1;
  73.          this.cpt.y = var3;
  74.       }
  75.    }
  76.  
  77.    void close() {
  78.       this.lineTo(this.mpt.x, this.mpt.y);
  79.  
  80.       for(LayoutPathImpl.SegmentPath.Segment var2 : this.segments) {
  81.          var2.close();
  82.       }
  83.  
  84.    }
  85.  
  86.    public Shape mapShape(Shape var1) {
  87.       PathIterator var2 = var1.getPathIterator((AffineTransform)null, (double)1.0F);
  88.       this.init();
  89.  
  90.       for(double[] var3 = new double[2]; !var2.isDone(); var2.next()) {
  91.          switch (var2.currentSegment(var3)) {
  92.             case 0:
  93.                this.moveTo(var3[0], var3[1]);
  94.                break;
  95.             case 1:
  96.                this.lineTo(var3[0], var3[1]);
  97.             case 2:
  98.             case 3:
  99.             default:
  100.                break;
  101.             case 4:
  102.                this.close();
  103.          }
  104.       }
  105.  
  106.       GeneralPath var4 = new GeneralPath();
  107.  
  108.       for(LayoutPathImpl.SegmentPath.Segment var6 : this.segments) {
  109.          var4.append(var6.gp, false);
  110.       }
  111.  
  112.       return var4;
  113.    }
  114. }
  115.