Revision: 1.4 - (view) (download) (as text)
1 : | ktanaka | 1.1 | public class MinchoRenderer extends Renderer{ |
2 : | // $B=DK@$NI}(B | ||
3 : | double width; | ||
4 : | // $B=DK@$KBP$9$k2#K@$NHfN((B | ||
5 : | double ratio; | ||
6 : | // $B$R$i$,$J$NI}(B | ||
7 : | double hiraWidth; | ||
8 : | // $B=DK@$N;OE@$N>~$j(B | ||
9 : | double tateSerif; | ||
10 : | // $B=DK@$H2#K@$N8rE@$N>~$j(B | ||
11 : | double tateYokoSerif; | ||
12 : | // $B2#@~$N;_$a$N=D@~$KBP$9$kHf(B | ||
13 : | double yokoSerif; | ||
14 : | public static MinchoRenderer hosoMincho= | ||
15 : | new MinchoRenderer(8.0,0.2,0.35,1.8,1.8,2.4); | ||
16 : | public static MinchoRenderer chuuMincho= | ||
17 : | new MinchoRenderer(12.0,0.4,0.6,1.5,1.4,1.8); | ||
18 : | public MinchoRenderer(double w,double r,double hw, | ||
19 : | double ts,double tys, double ys){ | ||
20 : | width=w; ratio=r; hiraWidth=hw; | ||
21 : | tateSerif=ts; tateYokoSerif=tys; yokoSerif=ys; | ||
22 : | } | ||
23 : | ktanaka | 1.3 | static Outline[] tenSample={ |
24 : | new Outline(new Bezier(new Point(80,171),new Point(119,214), | ||
25 : | new Point(104,256),new Point(136,255))), | ||
26 : | new Outline(new Bezier(new Point(80,171),new Point(155,204), | ||
27 : | new Point(173,251),new Point(136,255))) | ||
28 : | }; | ||
29 : | ktanaka | 1.1 | // $BE@$NIA2h(B |
30 : | public Outline[] ten(Point[] points,ElementAnnotation[] annotations){ | ||
31 : | ktanaka | 1.3 | // temSample$B$r(B p0,p1$B$K(Bfit$B$9$k(B |
32 : | double len=points[0].distance(points[1]); | ||
33 : | double w=width; | ||
34 : | if(3*w<len) w=w/20.0; | ||
35 : | else w=len/60.0; | ||
36 : | return fitSample(tenSample,points[0],points[1],w); | ||
37 : | ktanaka | 1.1 | } |
38 : | // $B=DK@$NIA2h(B | ||
39 : | public Outline[] tate(Point[] points,ElementAnnotation[] annotations){ | ||
40 : | return line2(points[0],points[1],width); | ||
41 : | } | ||
42 : | // $B2#K@$NIA2h(B | ||
43 : | public Outline[] yoko(Point[] points,ElementAnnotation[] annotations){ | ||
44 : | return line2(points[0],points[1],width*ratio); | ||
45 : | } | ||
46 : | // $B1&>e(B | ||
47 : | public Outline[] migiue(Point[] points,ElementAnnotation[] annotations){ | ||
48 : | return curve2(points[0],points[1],points[2], | ||
49 : | 0.6,0.6, | ||
50 : | width,0.7*width,0.3*width,0.0); | ||
51 : | } | ||
52 : | // $B:8J'$$(B | ||
53 : | public Outline[] hidari(Point[] points,ElementAnnotation[] annotations){ | ||
54 : | Point p0=points[0],p1=points[1],p2=points[2]; | ||
55 : | double w=Math.min(width,0.35*p0.distance(p2)); | ||
56 : | double len01=p0.distance(p1),len12=p1.distance(p2); | ||
57 : | double ratio=len01/(len01+len12); | ||
58 : | double theta=p1.minus(p0).theta(p2.minus(p1)); | ||
59 : | double s=Math.min(1.0,theta*0.7); | ||
60 : | double w1=(1-s)*ratio*w+s*w; | ||
61 : | double r0=Math.max(0.66666,1.0+0.5*(1.0-1.0/ratio)); | ||
62 : | |||
63 : | return curve2(points[0],points[1],points[2], | ||
64 : | 0.6,0.6, | ||
65 : | width,0.7*width,0.3*width,0.0); | ||
66 : | } | ||
67 : | ktanaka | 1.3 | // $B=DK@:8J'$$(B |
68 : | // $BK\J*$O0c$&(B | ||
69 : | public Outline[] tatehidari(Point[] points,ElementAnnotation[] annotations){ | ||
70 : | Point p0=points[0],p1=points[1],p2=points[2],p3=points[3]; | ||
71 : | double w=Math.min(width,0.35*p0.distance(p3)); | ||
72 : | double len12=p1.distance(p2),len23=p2.distance(p3); | ||
73 : | double ratio=len12/(len12+len23); | ||
74 : | double theta=p2.minus(p1).theta(p3.minus(p2)); | ||
75 : | double s=Math.min(1.0,theta*0.7); | ||
76 : | double w1=(1-s)*ratio*w+s*w; | ||
77 : | double r0=Math.max(0.66666,1.0+0.5*(1.0-1.0/ratio)); | ||
78 : | Outline[] o0=line2(points[0],points[1],width); | ||
79 : | Outline[] o1=curve2(points[1],points[2],points[3], | ||
80 : | 0.6,0.6, | ||
81 : | width,width,0.3*width,0.0); | ||
82 : | o0[0]=o0[0].append(o1[0]); | ||
83 : | o0[1]=o0[1].append(o1[1]); | ||
84 : | return o0; | ||
85 : | } | ||
86 : | ktanaka | 1.1 | // $B1&J'$$(B |
87 : | public Outline[] migi(Point[] points,ElementAnnotation[] annotations){ | ||
88 : | return curve2(points[0],points[1],points[2], | ||
89 : | 0.6,0.6, | ||
90 : | 0.5*width,0.68*width,1.03*width,1.2*width); | ||
91 : | } | ||
92 : | ktanaka | 1.4 | // $B$3$6$H(B |
93 : | public Outline[] kozato(Point[] points, ElementAnnotation[] annotations){ | ||
94 : | |||
95 : | } | ||
96 : | ktanaka | 1.3 | // |
97 : | ktanaka | 1.4 | public Outline[] tatehane(Point[] points, ElementAnnotation[] annotations){ |
98 : | |||
99 : | } | ||
100 : | // | ||
101 : | public Outline[] tsukurihane(Point[] points, ElementAnnotation[] annotations){ | ||
102 : | |||
103 : | } | ||
104 : | // | ||
105 : | public Outline[] sanzui(Point[] points, ElementAnnotation[] annotations){ | ||
106 : | |||
107 : | } | ||
108 : | // | ||
109 : | public Outline[] kokoro(Point[] points, ElementAnnotation[] annotations){ | ||
110 : | |||
111 : | } | ||
112 : | public Outline[] tasuki(Point[] points, ElementAnnotation[] annotations){ | ||
113 : | |||
114 : | } | ||
115 : | public Outline[] magaritate(Point[] points, ElementAnnotation[] annotations){ | ||
116 : | |||
117 : | } | ||
118 : | public Outline[] kagi(Point[] points, ElementAnnotation[] annotations){ | ||
119 : | |||
120 : | } | ||
121 : | public Outline[] shin_nyuu(Point[] points, ElementAnnotation[] annotations){ | ||
122 : | |||
123 : | } | ||
124 : | public Outline[] hira_long(Point[] points, ElementAnnotation[] annotations){ | ||
125 : | |||
126 : | } | ||
127 : | public Outline[] hira_circle(Point[] points, ElementAnnotation[] annotations){ | ||
128 : | |||
129 : | } | ||
130 : | ktanaka | 1.1 | } |
ktanaka Powered by ViewCVS 1.0-dev |
ViewCVS and CVS Help |