package Current.basic; import Current.*; import java.applet.Applet; import java.awt.event.*; import java.awt.*; import java.awt.geom.*; public class WordIcon { public int x,y,w,h,mode,on; public String W; public VertexPair VP; public WordIcon(int x,int y,int w,int h,String W,int mode) { this.x=x; this.y=y; this.h=h; this.w=w; this.W=W; this.mode=mode; this.on=0; VP=new VertexPair(); } /**This option draws things so that the midpoints of the edges lie in the integer lattice*/ public static Complex[] rawPath(String W) { Complex[] v=new Complex[4]; v[1]=new Complex(1,-2); v[3]=new Complex(1,1); v[2]=new Complex(-2,1); return(rawPath(W,v)); } public static Complex[] rawPathRegular(String W) { double pi=Math.PI; double arg1=pi/6+pi/2; double arg2=arg1+2*pi/3; double arg3=arg2+2*pi/3; Complex[] v=new Complex[4]; v[1]=new Complex(Math.cos(arg1),Math.sin(arg1)); v[2]=new Complex(Math.cos(arg2),Math.sin(arg2)); v[3]=new Complex(Math.cos(arg3),Math.sin(arg3)); return(rawPath(W,v)); } public static Complex[] rawPath(String W,Complex[] v) { int n=W.length(); Complex[] V=new Complex[n+2]; String S=new String(); Complex w1=new Complex(0,0); Complex direction=new Complex(0,0); for(int i=0;iV[i].x) mx=V[i].x; if(MxV[i].y) my=V[i].y; if(My0) { g.translate(x,y); int palindrome=palindromeTest(); int oddsquare=oddSquareTest(); if(oddsquare+palindrome==0) { if(on==0) g.setColor(C[1]); if(on==1) g.setColor(C[2]); g.fillRect(0,0,w,h); if(on==0) g.setColor(C[2]); if(on==1) g.setColor(C[3]); g.drawRect(0,0,w,h); } if(palindrome==1) { if(on==0) g.setColor(C[6]); if(on==1) g.setColor(C[7]); g.fillRect(0,0,w,h); if(on==0) g.setColor(C[7]); if(on==1) g.setColor(C[8]); g.drawRect(0,0,w,h); } if(oddsquare==1) { if(on==0) g.setColor(C[9]); if(on==1) g.setColor(C[10]); g.fillRect(0,0,w,h); if(on==0) g.setColor(C[10]); if(on==1) g.setColor(C[11]); g.drawRect(0,0,w,h); } Complex[] V=rawPath(W); Complex[] Z=getLocation(V,n); double size=Z[0].x; if(sizeh) bb=h; size=bb/size; size=size*.95; double xx=Z[1].x; double yy=Z[1].y; float x1,y1,x2,y2; GeneralPath path=new GeneralPath(); x1=(float)((V[0].x-xx)*size+w/2); y1=(float)((V[0].y-yy)*size+h/2); path.moveTo(x1,y1); for(int i=0;ix)&&(p.xy)&&(p.y0) { g.translate(x,y); int palindrome=palindromeTest(); int oddsquare=oddSquareTest(); if(oddsquare+palindrome==0) { if(on==0) g.setColor(C[1]); if(on==1) g.setColor(C[2]); g.fillRect(0,0,w,h); if(on==0) g.setColor(C[2]); if(on==1) g.setColor(C[3]); g.drawRect(0,0,w,h); } if(palindrome==1) { if(on==0) g.setColor(C[6]); if(on==1) g.setColor(C[7]); g.fillRect(0,0,w,h); if(on==0) g.setColor(C[7]); if(on==1) g.setColor(C[8]); g.drawRect(0,0,w,h); } if(oddsquare==1) { if(on==0) g.setColor(C[9]); if(on==1) g.setColor(C[10]); g.fillRect(0,0,w,h); if(on==0) g.setColor(C[10]); if(on==1) g.setColor(C[11]); g.drawRect(0,0,w,h); } Complex[] V=rawPathRegular(W); Complex[] Z=getLocation(V,n); double size=Z[0].x; if(sizeh) bb=h; size=bb/size; size=size*.95; double xx=Z[1].x; double yy=Z[1].y; float x1,y1,x2,y2; GeneralPath path=new GeneralPath(); x1=(float)((V[0].x-xx)*size+w/2); y1=(float)((V[0].y-yy)*size+h/2); path.moveTo(x1,y1); for(int i=0;i