1    /*
2    Copyright 2000 by Ralph Hartley
3    This software is licenced under the terms of the
4    Gnu Public Licence
5    */
6    import java.awt.*;
7    import java.awt.geom.*;
8    import java.util.*;
9    
10   public class SavableStroke implements Stroke,java.io.Serializable {
11   
12     private static final long serialVersionUID = Version.getSUID();
13   
14     transient BasicStroke linestroke;
15   
16     public SavableStroke() {
17       linestroke = new BasicStroke();
18     }
19   
20     public SavableStroke(double thickness) {
21       linestroke = new BasicStroke((float)thickness);
22     }
23   
24     public SavableStroke(float thickness,int cap,int join,float miter,float[] dash,float phase) {
25       linestroke = new BasicStroke(thickness,cap,join,miter,dash,phase);
26     }
27   
28     public void setFlip(boolean val) {}
29   
30     public String toString() {
31       return(super.toString()+"(t="+linestroke.getLineWidth()+")");
32     }
33   
34     private void readObject(java.io.ObjectInputStream stream)
35         throws java.io.IOException,java.lang.ClassNotFoundException {
36         //System.out.println("reading stroke");
37       linestroke = new BasicStroke(stream.readFloat(),stream.readInt(),
38           			 stream.readInt(),stream.readFloat(),
39           			 (float[])stream.readObject(),
40           			 stream.readFloat());
41       //System.out.println("done reading stroke");
42     }
43   
44     private void writeObject(java.io.ObjectOutputStream stream)
45         throws java.io.IOException {
46       stream.writeFloat(linestroke.getLineWidth());
47       stream.writeInt(linestroke.getEndCap());
48       stream.writeInt(linestroke.getLineJoin());
49       stream.writeFloat(linestroke.getMiterLimit());
50       stream.writeObject(linestroke.getDashArray());
51       stream.writeFloat(linestroke.getDashPhase());
52     }
53   
54     public Shape createStrokedShape(Shape p) {
55       return(linestroke.createStrokedShape(p));
56     }
57   }
58