change to CVS wadalab font project
// // Skeletonデ・踉札燭鯏呂靴�, アウ瘢雹トラインを返す // public class Renderer { static final boolean debug=false; static Point[] indexToPoints(Point[] points,int[] indices){ int i,len=indices.length; Point[] ret=new Point[len]; for(i=0;i<len;i++) ret[i]=points[indices[i]]; return ret; } public Outline[] elementRenderer(Point[] points,Element element){ int type=element.type; Point[] elementPoints=indexToPoints(points,element.points); switch(type){ case Element.ten: return ten(elementPoints,element.annotations); case Element.tate: return tate(elementPoints,element.annotations); case Element.yoko: return yoko(elementPoints,element.annotations); case Element.migiue: return migiue(elementPoints,element.annotations); case Element.hidari: return hidari(elementPoints,element.annotations); case Element.tatehidari: return tatehidari(elementPoints,element.annotations); case Element.migi: return migi(elementPoints,element.annotations); case Element.kozato: return kozato(elementPoints,element.annotations); case Element.tatehane: return tatehane(elementPoints,element.annotations); case Element.tsukurihane: return tsukurihane(elementPoints,element.annotations); case Element.sanzui: return sanzui(elementPoints,element.annotations); case Element.kokoro: return kokoro(elementPoints,element.annotations); case Element.tasuki: return tasuki(elementPoints,element.annotations); case Element.magaritate: return magaritate(elementPoints,element.annotations); case Element.kagi: return kagi(elementPoints,element.annotations); case Element.shin_nyuu: return shin_nyuu(elementPoints,element.annotations); case Element.hira_long: return hira_long(elementPoints,element.annotations); case Element.hira_circle: return hira_circle(elementPoints,element.annotations); case Element.outline: return outline(elementPoints,element.annotations); } return null; } public Outline[] ten(Point[] points,ElementAnnotation[] annotations){ return null; } public Outline[] tate(Point[] points,ElementAnnotation[] annotations){ return null; } public Outline[] yoko(Point[] points,ElementAnnotation[] annotations){ return null; } public Outline[] migiue(Point[] points,ElementAnnotation[] annotations){ return null; } public Outline[] hidari(Point[] points,ElementAnnotation[] annotations){ return null; } public Outline[] tatehidari(Point[] points,ElementAnnotation[] annotations){ return null; } public Outline[] migi(Point[] points,ElementAnnotation[] annotations){ return null; } public Outline[] kozato(Point[] points,ElementAnnotation[] annotations){ return null; } public Outline[] tatehane(Point[] points,ElementAnnotation[] annotations){ return null; } public Outline[] tsukurihane(Point[] points,ElementAnnotation[] annotations){ return null; } public Outline[] sanzui(Point[] points,ElementAnnotation[] annotations){ return null; } public Outline[] kokoro(Point[] points,ElementAnnotation[] annotations){ return null; } public Outline[] tasuki(Point[] points,ElementAnnotation[] annotations){ return null; } public Outline[] magaritate(Point[] points,ElementAnnotation[] annotations){ return null; } public Outline[] kagi(Point[] points,ElementAnnotation[] annotations){ return null; } public Outline[] shin_nyuu(Point[] points,ElementAnnotation[] annotations){ return null; } public Outline[] hira_long(Point[] points,ElementAnnotation[] annotations){ return null; } public Outline[] hira_circle(Point[] points,ElementAnnotation[] annotations){ return null; } public Outline[] outline(Point[] points,ElementAnnotation[] annotations){ return null; } // p0 と p1 の間を幅 width で彫苳酸�劜佞� public Outline[] line2(Point p0,Point p1,double width){ Point v0=p1.minus(p0).rot270().normal(width); Outline[] ret=new Outline[2]; OutlineComponent[] right=new OutlineComponent[1]; right[0]=new Line(p0.plus(v0),p1.plus(v0)); OutlineComponent[] left=new OutlineComponent[1]; left[0]=new Line(p0.minus(v0),p1.minus(v0)); ret[0]=new Outline(right); ret[1]=new Outline(left); return ret; } // public Outline curveSub(Point p0, Point p1, Point p2, Point p3, double r0, double r1){ OutlineComponent[] ret=new OutlineComponent[1]; Point p12=Point.cross(p0,p1,p2,p3); if(debug) System.out.println("cross("+p0+","+p1+","+p2+","+p3+")="+p12); ret[0]=new Bezier(p0,p0.inter(p12,r0),p3.inter(p12,r1),p3); return new Outline(ret); } // p0, p1, p2の間を曲線で結ぶ // p0 では幅 w0, p2では幅w3 // p0から p1にr0(0から1)進んだところで幅 w1 // p2から r1(0から1)戻ったところで幅 w2となる // ただし, 外側瘢雹のカ・踉札屬汎眤�逅擦離���ブの Bezier制御点の比率が // 同じになるよう瘢雹に public Outline[] curve2(Point p0,Point p1,Point p2, double r0,double r1, double w0,double w1,double w2,double w3){ Point p01=p0.inter(p1,r0),p12=p2.inter(p1,r1); Outline[] ret=new Outline[2]; Point v0=p1.minus(p0).rot270(), v2=p2.minus(p0).rot270(); ret[0]=curveSub(p0.plus(v0.normal(w0)), p0.inter(p1,r0).plus(v0.normal(w1)), p2.inter(p1,r1).plus(v2.normal(w2)), p2.plus(v2.normal(w3)), r0,r1); ret[1]=curveSub(p0.minus(v0.normal(w0)), p0.inter(p1,r0).minus(v0.normal(w1)), p2.inter(p1,r1).minus(v2.normal(w2)), p2.minus(v2.normal(w3)), r0,r1); return ret; } }
ktanaka Powered by ViewCVS 1.0-dev |
ViewCVS and CVS Help |