[wadalabfont-kit] / java / Outline.java  

Annotation of /java/Outline.java

Parent Directory | Revision Log

Revision: 1.2 - (view) (download) (as text)

1 : ktanaka 1.1 public class Outline {
2 :     OutlineComponent[] components;
3 :     Outline(OutlineComponent[] components){
4 :     this.components=components;
5 :     }
6 : ktanaka 1.2 Outline(OutlineComponent component){
7 :     this.components=new OutlineComponent[1];
8 :     this.components[0]=component;
9 :     }
10 :     Outline append(Outline outline){
11 :     OutlineComponent[] newComponents=new OutlineComponent[components.length+outline.components.length];
12 :     System.arraycopy(components,0,newComponents,0,components.length);
13 :     System.arraycopy(outline.components,0,newComponents,components.length,outline.components.length);
14 :     return new Outline(newComponents);
15 :     }
16 :     Outline plus(Point p0){
17 :     OutlineComponent[] newComponents=new OutlineComponent[components.length];
18 :     for(int i=0;i<components.length;i++){
19 :     newComponents[i]=components[i].plus(p0);
20 :     }
21 :     return new Outline(newComponents);
22 :     }
23 :     Outline rot(double theta){
24 :     OutlineComponent[] newComponents=new OutlineComponent[components.length];
25 :     for(int i=0;i<components.length;i++){
26 :     newComponents[i]=components[i].rot(theta);
27 :     }
28 :     return new Outline(newComponents);
29 :     }
30 :     Outline times(double ratio){
31 :     OutlineComponent[] newComponents=new OutlineComponent[components.length];
32 :     for(int i=0;i<components.length;i++){
33 :     newComponents[i]=components[i].times(ratio);
34 :     }
35 :     return new Outline(newComponents);
36 :     }
37 :     Outline timesY(double ratio){
38 :     OutlineComponent[] newComponents=new OutlineComponent[components.length];
39 :     for(int i=0;i<components.length;i++){
40 :     newComponents[i]=components[i].timesY(ratio);
41 :     }
42 :     return new Outline(newComponents);
43 :     }
44 :     Point firstPoint(){
45 :     return components[0].firstPoint();
46 :     }
47 :     Point lastPoint(){
48 :     return components[components.length-1].lastPoint();
49 :     }
50 : ktanaka 1.1 OutlineComponent[] getComponents(){ return components; }
51 : ktanaka 1.2 public String toString(){
52 :     String str="Outline(";
53 :     for(int i=0;i<components.length;i++)
54 :     str+=components[i].toString();
55 :     return str+")";
56 :     }
57 : ktanaka 1.1 }

ktanaka

Powered by ViewCVS 1.0-dev

ViewCVS and CVS Help