Back to index

wims  3.65+svn20090927
Clicktile.java
Go to the documentation of this file.
00001 /* J.M.Evers 17/2/2009 
00002  This is all amateur scriblings ... No Copyrights
00003  Example html page:
00004 <html>
00005     <body>
00006        <script language="javascript" type="text/javascript">
00007            function readthis(){
00008               var input=document.getElementById("Clicktile").ReadApplet(); 
00009               alert(input);
00010            }
00011        </script>
00012        
00013        <!-- INTERNAL COLOR NAMES FOR PARAMS -->
00014        <!-- "white","red","green","blue" -->
00015        <!-- "orange","yellow","purple","lightgreen" -->
00016        <!-- "lightblue","cyan","brown","salmon","pink,"black" -->
00017        <applet id="Clicktile" code="Clicktile.class" codebase="." archive="Clicktile.jar" width="500" height="500">
00018            
00019            <!-- status = done : display non-clickable image -->
00020            <param name="status" value="waiting">
00021            
00022            <!-- choose from the 13 colors -->
00023            <param name="point_color" value="white">
00024 
00025            <!-- use only one at a time : leave others blank -->
00026            <param name="point" value="1:1,2:2,3:3,4:4,5:5,6:6,7:7">
00027            <param name="segment" value="">
00028            <param name="polygon" value="">
00029            <param name="line" value="">
00030            <!-- segment and line are the same...for now -->
00031            <!-- but a line is a segment with 2 points outside xrange/yrange -->
00032     
00033            <!-- for now only usefull in point param: default 5 -->
00034            <param name="linewidth" value="20">
00035 
00036            <!-- if "1" or "yes" all objects including given drawing will be returned -->
00037            <param name="return_all_objects" value="0">
00038 
00039            <!-- en ,de , fr ,nl  default en -->
00040            <param name="language" value="fr">
00041            <param name="xrange" value="-11,11">
00042            <param name="yrange" value="-11,11">    
00043            <param name="background_color" value="black">
00044 
00045            <!-- GIVEN DRAWING  : not more than 13 colors allowed --> 
00046            <param name="square1" value="4:1,4:2,4:3,4:4,5:4,6:4,8:4,8:3,8:2,8:1,5:1,6:1,7:1">
00047            <!-- limited only by xrange/yrange : coordinates of rectangles e.g. predefined square [teacher] -->
00048            <param name="square1_color" value="blue">
00049            <param name="square2" value="-4:1,-4:2,-4:3,-4:4,-5:4,-6:4,-8:4,-8:3,-8:2,-8:1,-5:1,-6:1,-7:1">
00050            <!-- limited only by xrange/yrange : coordinates of rectangles e.g. predefined square [teacher] -->
00051            <param name="square2_color" value="yellow">
00052         can add some image (must be transparent)
00053         <param name="image" value="http://...">
00054         <param name="copy" value="0,0"> 
00055         <!-- coordinates in pixels of the left top corner-->
00056            NO JAVA INSTALLED ?
00057        </applet>
00058 
00059        <p>
00060        <input type="button" name=".....TEST......" value=".....TEST....." onclick="javascript:readthis();">
00061     </body>
00062 </html>
00063 */
00064 
00065 import java.applet.*;
00066 import java.awt.*;
00067 import java.awt.event.*;                                                                                                                        
00068 import java.util.*;
00069 import java.lang.Math;
00070 import java.net.*;
00071 
00072 public class Clicktile extends Applet implements Runnable{
00073     private static final int serialVersionUID = 1;
00074     int Clicktile[][];int MAX;
00075     int dx;int dy;Thread thread = null;
00076     Image canvas;Graphics drawing;
00077     int xmin=-10,xmax=10,ymin=-10,ymax=10;// xmin/xmax ymin/ymax is coordinate system... xrange/yrange
00078     int xsize,ysize;// xsize,ysize is canvas-size
00079     int x_rect,y_rect;// x_rect * y_rect is pixel x/y-size of an elementary rectangle
00080     int Rx,Ry;// Rx * Ry is amount of elementary rectangles on canvas
00081     int palette[][] = {{255,255,255},{255,0,0},{0,255,0},{0,0,255},{238,154,0},{255,255,0},{160,32,240},{144,238,144},{173,216,230},{0,255,255},{165,24,24},{250,128,114},{255,192,203},{0,0,0}};
00082     final int max=palette.length;// 14 different colors...arraylength=13
00083     int[] color = new int[max];// color[0] is background color
00084     int objects=0;int[][] xcoords;int[][] ycoords;int[] length;
00085     public String COLORS[] = new String[max];
00086     int linewidth=5;int TYPE=0;int[] xpoints;int[] ypoints;int point_color=0;
00087     String language="en";boolean status=true;
00088     int[] used_colors;int this_color=0;
00089     Image bg;URL url;int copy_x=0 ; int copy_y=0 ; 
00090     
00091     public void init(){
00092        String c;
00093        xsize = getSize().width;ysize = getSize().height;
00094        c=getParameter("status");
00095        if(c != null && c.length()>0){
00096            if(c.equalsIgnoreCase("waiting")) status = true;
00097            else
00098            if(c.equalsIgnoreCase("done")) status = false;
00099        }
00100        
00101        c=getParameter("language");
00102        if(c != null && c.length()>0){
00103            Determine_Color_Names(c); // en: COLOR[0]="white" fr: COLOR[0]="blanc"
00104        }
00105        
00106        c=getParameter("background_color");
00107        if(c != null && c.length()>0){
00108            color[0]=GetInternalColorCode( c , 0); // 0 is default white background 
00109        }
00110        
00111        int obj=1;
00112        c=getParameter("square"+obj+"_color");
00113        while(c!=null && c.length()>0){ // translate param colors into internal color_array
00114            c=getParameter("square"+obj+"_color");
00115            if(c != null && c.length()>0){ 
00116               objects++; color[obj] = GetInternalColorCode( c , 13); // 13 default black
00117            }
00118            obj++;
00119        }
00120        
00121        c=getParameter("xrange");
00122        if(c != null && c.length()>0){Determine_Range( c , "x");}// determine the Xrange of the square ... xmin xmax
00123        
00124        c=getParameter("yrange");
00125        if(c != null && c.length()>0){Determine_Range( c , "y");}// determine the Yrange of the square ... ymin ymax
00126        
00127        Rx=Math.abs(xmax-xmin);Ry=Math.abs(ymax-ymin);
00128        MAX=Rx*Ry;
00129        x_rect=(int)xsize/Rx;y_rect=(int)ysize/Ry; // there are Rx squares in our square : per square x_rect pixels
00130        Clicktile = new int[MAX][MAX]; // Clicktile[0] does not exist: it is the background of canvas !!
00131        canvas = createImage(xsize,ysize);drawing = canvas.getGraphics();
00132        xcoords=new int[MAX][MAX];ycoords=new int[MAX][MAX];
00133        length=new int[MAX]; // how many squares per color
00134        for(int i=0;i<MAX;i++){// fill array with zero's
00135            length[i]=0;
00136        }
00137        for(int i=0; i<MAX;i++){
00138            for(int ii=0;ii<MAX;ii++){
00139               xcoords[ii][i]=0;// fill array with zero's
00140               ycoords[ii][i]=0;// fill array with zero's
00141            }
00142        }
00143        
00144        for(int x=0;x<MAX;x++){
00145            for(int y=0;y<MAX;y++){
00146               Clicktile[y][x] = color[0];// coloring the background color[0]
00147            }
00148        }
00149 
00150        // get the supplementary colors
00151        c=getParameter("colors");
00152        int maxcolors = 0 ; 
00153        if(c != null && c.length()>0){
00154           StringTokenizer q = new StringTokenizer(c, ",");
00155           maxcolors=q.countTokens() ;
00156        }
00157        int[] tmpcolors=new int[objects + 1 + maxcolors];
00158        if(c != null && c.length()>0){
00159           StringTokenizer q = new StringTokenizer(c, ",");
00160           maxcolors=q.countTokens() ;
00161           for( int p = 0 ; p<maxcolors ; p++){
00162            String  k=q.nextToken();
00163            tmpcolors[p]=GetInternalColorCode( k, 0 ) ; 
00164          }
00165    }
00166        // get the square
00167        tmpcolors[maxcolors]=color[0];
00168        for(obj=1 ; obj<=objects ;obj++){
00169            c=getParameter("square"+obj);
00170            int L=0;int coords=0;
00171            if( c!=null && c.length()>0){
00172               // scheme 4:4,2:2,0:0  scheme 4;4,2;2,0;0  scheme 4@4,2@2,0@0 scheme 4 4,2 2,0 0
00173               c=c.replace(';',':');c=c.replace('@',':');c=c.replace(' ',':');
00174               StringTokenizer q1 = new StringTokenizer(c, ",");
00175               String k1;String k2;
00176               int array_x=0;int array_y=0;// array_x & array_y are array cell numbers
00177               coords=q1.countTokens();L=0;
00178               try {
00179                   for(int p=0;p<coords;p++){
00180                      k1=q1.nextToken();
00181                      //System.out.println("now "+k1);
00182                      StringTokenizer q2 = new StringTokenizer(k1, ":");
00183                      for(int s=0;s<2;s++){
00184                          k2=q2.nextToken();
00185                          if(s==0){
00186                             array_x=Integer.parseInt(k2,10);
00187                             array_x=(int)((array_x - xmin)*(xmax - xmin)/Rx);
00188                             xcoords[p][obj]=array_x;
00189                          }
00190                          if(s==1){
00191                             array_y=Integer.parseInt(k2,10);
00192                             // coordinates to square pixels
00193                             array_y=(int)(Ry + (array_y-ymin)*(ymax-ymin)/(-1*Ry));
00194                             ycoords[p][obj]=array_y;
00195                          }
00196                      }
00197                      tmpcolors[obj+maxcolors] = color[obj];
00198                      // give it the appropriate square_color
00199                      Clicktile[array_y][array_x]=color[obj];
00200                      L++;
00201                   }
00202                   length[obj]=L;
00203               } catch (Exception e){System.out.println("there is no square"+obj+"\n"+e);}
00204            }
00205        }
00206        used_colors = ListUniq(tmpcolors);//list uniq array of internal colors [int]
00207 
00208     c=getParameter("image");
00209        if (c!=null && c.length()>0) {
00210            try {url=new URL(c);}
00211            catch (MalformedURLException e) {url=null;}
00212            if(url!=null) bg=getImage(url);
00213            else bg=null;
00214        }
00215        else bg=null;
00216 
00217        c=getParameter("copy");
00218        if( c != null && c.length() > 0 ){ 
00219           StringTokenizer q = new StringTokenizer(c, ",");
00220           for( int p = 0 ; p<2 ; p++){
00221            String  k=q.nextToken();
00222            if(p==0){
00223                             copy_x=Integer.parseInt(k,10);
00224               }
00225               if(p==1){
00226                             copy_y=Integer.parseInt(k,10);
00227          }
00228    }
00229  }
00230        
00231        addMouseListener(
00232            new MouseAdapter(){
00233               public void mousePressed(MouseEvent e){
00234                   if(status){
00235                      dx = e.getX()/x_rect;
00236                   dy = e.getY()/y_rect;
00237                      int n = 0;boolean do_paint=true;
00238                      if(dx>=0 && dx<= Rx  && dy>=0 && dy<= Ry){
00239                          for(int obj=0;obj<=objects && do_paint ;obj++){
00240                             for(int p=0;p<length[obj] && do_paint ;p++){
00241                                 if(xcoords[p][obj]==dx && ycoords[p][obj]==dy){
00242                                    //System.out.println("CLICKED ON GIVEN DRAWING !!");
00243                                    do_paint=false;
00244                                 }  
00245                             }
00246                          }
00247                      }
00248                      if(do_paint){
00249                      // right mouse click changes color.
00250                        if( e.getButton() == MouseEvent.BUTTON3 ||  e.getButton() == MouseEvent.BUTTON2 ){
00251                             this_color++;
00252                             if(this_color > used_colors.length - 1){this_color=0;}
00253                          }
00254                         Clicktile[dy][dx] = used_colors[this_color];
00255                         repaint(); 
00256                      }
00257                  }
00258               }
00259            }
00260        );
00261        
00262        // get  point_color, point,line or polygon
00263        c=getParameter("point_color");
00264        if(c != null && c.length()>0){ point_color=GetInternalColorCode( c , 0);}
00265        c=getParameter("linewidth"); if( c != null && c.length() > 0 ){ linewidth = Integer.parseInt(c,10); }
00266        c=getParameter("point"); 
00267        if( c != null && c.length() > 0 ){ 
00268            Retreive_values_from_coordinates( c , 1 );
00269        }
00270        else
00271        {
00272            c=getParameter("segment"); 
00273            if( c != null && c.length() > 0 ){ 
00274               Retreive_values_from_coordinates( c , 2 ); 
00275            }
00276            else
00277            {
00278               c=getParameter("line"); 
00279               if( c != null && c.length() > 0 ){ 
00280                   Retreive_values_from_coordinates( c , 3 ); 
00281               }
00282               else
00283               {
00284                   c=getParameter("polygon"); 
00285                   if( c != null && c.length() > 0 ){ 
00286                      Retreive_values_from_coordinates( c , 4 ); 
00287                   }
00288                   else
00289                   {
00290                      System.out.println("NO SYMMETRY LINE,SEGMENT,POINT or POLY DEFINED");
00291                   }
00292               }
00293            }
00294        }
00295     }
00296 
00297     public void paint(Graphics g){
00298         if(bg!=null) g.drawImage(bg,copy_x,copy_y,this);
00299         drawing.setColor(Color.white);
00300         drawing.fillRect(0,0,xsize,ysize);
00301         int k;
00302        for(int xr = 0;xr < Rx;xr++){
00303            for(int yr = 0;yr < Ry;yr++){
00304               k=Clicktile[yr][xr];
00305               drawing.setColor(new Color(palette[k][0],palette[k][1],palette[k][2])); // this is the student "drawing"
00306               drawing.fill3DRect(x_rect*xr,y_rect*yr,x_rect,y_rect,true); // use "3D effect"
00307            }
00308        }
00309        if(TYPE != 0){drawing.setColor(new Color(palette[point_color][0],palette[point_color][1],palette[point_color][2]));}
00310        if(TYPE == 1){// several points
00311            for(int p = 0; p < xpoints.length ; p++){
00312               drawing.fillOval( (int)(xpoints[p] - 0.5*linewidth) , (int)(ypoints[p] -0.5*linewidth) , linewidth,linewidth );
00313               //System.out.println("points "+xpoints[p]+":"+ypoints[p]);
00314            }
00315        }
00316        else if(TYPE == 2){// several lines
00317            for( int p = 0 ; p< xpoints.length -1 ; p=p+2){
00318               drawing.drawLine( xpoints[p] , ypoints[p], xpoints[p+1], ypoints[p+1]);
00319               //System.out.println("segments "+xpoints[p]+":"+ypoints[p]+"-------"+xpoints[p+1]+":"+ypoints[p+1]);
00320            }
00321        }
00322        else if(TYPE == 3){//for now the same as TYPE = 2
00323            for( int p = 0 ; p< xpoints.length -1 ; p=p+2){
00324               drawing.drawLine( xpoints[p] , ypoints[p], xpoints[p+1], ypoints[p+1]);
00325            }
00326        }
00327        else if(TYPE ==  4){
00328            int lim=xpoints.length - 1; // improvised polygon...non-filled
00329               for(int p = 0 ;  p < lim  ; p++){
00330                   drawing.drawLine(xpoints[p], ypoints[p], xpoints[p+1],ypoints[p+1]);
00331               }
00332               drawing.drawLine(xpoints[lim], ypoints[lim], xpoints[0],ypoints[0]);
00333        }
00334        g.drawImage(canvas,0,0,this); // draw this square on canvas
00335 
00336      }
00337 
00338    public void start(){
00339       if(thread == null){
00340          thread = new Thread(this);
00341          thread.start();
00342       }
00343    }
00344 
00345    public void stop(){
00346       thread =  null;
00347    }
00348 
00349    public void run(){
00350       while(thread != null){
00351          try{
00352             Thread.sleep(100);
00353          }
00354          catch (InterruptedException e){
00355          }
00356       }
00357    }
00358 
00359    public void update( Graphics g ){
00360       paint( g ) ;
00361    }
00362    
00363     public String ReadApplet(){// public function to be issued by Javascript...and send to WIMS
00364        String c=getParameter("return_all_objects");
00365        boolean return_all=false;
00366        boolean do_print=true;
00367        if(c.equalsIgnoreCase("yes") || c.equals("1")){return_all=true;} 
00368        String reply="";boolean fnd=false;int repx=0;int repy=0;int k;String K="";
00369        for(int x=0; x<Rx; x++){
00370            for(int y=0;y<Ry;y++){
00371               k=Clicktile[y][x];
00372               // back to coordinates
00373               repx=(int)(xmin+x*Rx/(xmax - xmin));
00374               repy=(int)(Ry + (y - ymin)*(ymax-ymin)/(-1*Ry));
00375               if(return_all){ // <param name="return_all" value="0">
00376                   if( k != color[0] ){// no background
00377                      K=COLORS[k];
00378                      if(fnd){ reply=reply+","+K+"@"+repx+":"+repy; }
00379                      else { fnd=true; reply=K+"@"+repx+":"+repy; }
00380                   }
00381               }
00382               else
00383               {  // <param name="return_all" value="1">
00384                   do_print=true;
00385                   for(int obj=0;obj<=objects;obj++){
00386                      for(int p=0;p<length[obj];p++){
00387                          if(xcoords[p][obj]==x && ycoords[p][obj]==y){// exclude the square from params stored in xcoords[] ycoords[]
00388                             do_print=false;
00389                             //System.out.println("will not print ("+x+":"+y+") with color="+color[k]);
00390                          }
00391                      }
00392                   }
00393                   if(do_print){
00394                      if( k != color[0] ){// no background
00395                          K=COLORS[k];
00396                          if(fnd){ reply=reply+","+K+"@"+repx+":"+repy; }
00397                          else { fnd=true; reply=K+"@"+repx+":"+repy; }
00398                      }
00399                   }
00400               }
00401            }
00402        }
00403        if(reply.length() == 0){reply="ERROR: YOU DID NOT CLICK ANYTHING";}
00404        return reply;
00405     }
00406     
00407     public int GetInternalColorCode(String c , int defaultcode){
00408        int colorcode=defaultcode;
00409        if(c.equalsIgnoreCase("white")) colorcode=0;
00410        else 
00411        if(c.equalsIgnoreCase("red")) colorcode=1;
00412        else 
00413        if(c.equalsIgnoreCase("green")) colorcode=2;
00414        else 
00415        if(c.equalsIgnoreCase("blue")) colorcode=3;
00416        else 
00417        if(c.equalsIgnoreCase("orange")) colorcode=4;
00418        else
00419        if(c.equalsIgnoreCase("yellow")) colorcode=5;
00420        else
00421        if(c.equalsIgnoreCase("purple")) colorcode=6;
00422        else
00423        if(c.equalsIgnoreCase("lightgreen")) colorcode=7;
00424        else
00425        if(c.equalsIgnoreCase("lightblue")) colorcode=8;
00426        else
00427        if(c.equalsIgnoreCase("cyan")) colorcode=9;
00428        else
00429        if(c.equalsIgnoreCase("brown")) colorcode=10;
00430        else
00431        if(c.equalsIgnoreCase("salmon")) colorcode=11;
00432        else
00433        if(c.equalsIgnoreCase("pink")) colorcode=12;
00434        else
00435        if(c.equalsIgnoreCase("black")) colorcode=13;
00436        
00437        return colorcode;
00438     }
00439     
00440     public int X_ConvertToInternalCoordinates(int x){
00441        int X = (int)(x_rect*(x - xmin)*(xmax - xmin)/Rx);
00442        return X;
00443     }
00444     
00445     public int Y_ConvertToInternalCoordinates(int y){
00446        int Y = (int)(y_rect*(Ry + (y - ymin)*(ymax - ymin)/(-1*Ry)));
00447        return Y;
00448     }
00449     
00450     public void Retreive_values_from_coordinates( String c , int type){
00451        // typical value="-5:5,-4;4,-3:3"
00452        TYPE=type;
00453        c=c.replace(';',':');c=c.replace('@',':');c=c.replace(' ',':');
00454        StringTokenizer q1 = new StringTokenizer(c, ",");
00455        String k1;String k2;
00456        int m0=q1.countTokens();
00457        xpoints=new int[m0];
00458        ypoints=new int[m0];
00459        int tmp;int m1;boolean flipflop=true;
00460        for(int p=0;p<m0;p++){
00461            k1=q1.nextToken();
00462            StringTokenizer q2 = new StringTokenizer(k1, ":");
00463            m1 = q2.countTokens();
00464            for(int s=0; s<m1 ; s++){
00465               k2=q2.nextToken();
00466               if(flipflop){
00467                   try{ tmp = Integer.parseInt(k2,10); xpoints[p] = X_ConvertToInternalCoordinates(tmp); }
00468                   catch(Exception e){System.out.println("ERROR\n"+e);}
00469                   flipflop=false;
00470               }
00471               else
00472               {
00473                   try{ tmp = Integer.parseInt(k2,10); ypoints[p] = Y_ConvertToInternalCoordinates(tmp); }
00474                   catch(Exception e){System.out.println("ERROR\n"+e);}
00475                   flipflop=true;
00476               }
00477            }
00478        }
00479 
00480 
00481     }
00482     
00483     public void Determine_Range(String c , String type){
00484        c=c.replace(':',',');c=c.replace(';',',');
00485        StringTokenizer q = new StringTokenizer(c, ",");
00486        String k;
00487        for(int p=0;p<2;p++){
00488            k=q.nextToken();
00489            if(p==0){
00490               if(type.equals("x")){ xmin = Integer.parseInt(k,10);}
00491               else { ymin = Integer.parseInt(k,10);}
00492            }
00493            else
00494            {
00495               if(type.equals("x")){ xmax = Integer.parseInt(k,10);}
00496               else { ymax = Integer.parseInt(k,10);}
00497            }
00498         }
00499     }
00500     
00501     public void Determine_Color_Names(String lang){
00502        if(lang.equalsIgnoreCase("nl")){ 
00503            COLORS[0]="wit";COLORS[1]="rood";COLORS[2]="groen";COLORS[3]="blauw";
00504            COLORS[4]="oranje";COLORS[5]="geel";COLORS[6]="paars";COLORS[7]="licht groen";
00505            COLORS[8]="licht blauw";COLORS[9]="cyaan";COLORS[10]="bruiwn";COLORS[11]="zalmroze";
00506            COLORS[12]="roze";COLORS[13]="zwart";// max = 13 
00507        }
00508        else
00509        { // TO DO : TRANSLATION ?
00510        
00511            if(lang.equalsIgnoreCase("fr")){
00512               COLORS[0]="blanc";COLORS[1]="rouge";COLORS[2]="vert";COLORS[3]="bleu";
00513               COLORS[4]="orange";COLORS[5]="jaune";COLORS[6]="violet";COLORS[7]="vert pâle";
00514               COLORS[8]="bleu clair";COLORS[9]="cyan";COLORS[10]="marron";COLORS[11]="saumon";
00515               COLORS[12]="rose";COLORS[13]="noir";
00516            }
00517            else
00518            {
00519               if(lang.equalsIgnoreCase("de")){
00520                   COLORS[0]="weiß";COLORS[1]="rot";COLORS[2]="grun";COLORS[3]="blau";
00521                   COLORS[4]="orange";COLORS[5]="gelb";COLORS[6]="violett";COLORS[7]="hellgrün";
00522                   COLORS[8]="hellblau";COLORS[9]="cyan";COLORS[10]="braun";COLORS[11]="Lachsfarbig";
00523                   COLORS[12]="rosa";COLORS[13]="schwartz";
00524               }
00525               else
00526               {
00527                   COLORS[0]="white";COLORS[1]="red";COLORS[2]="green";COLORS[3]="blue";
00528                   COLORS[4]="orange";COLORS[5]="yellow";COLORS[6]="purple";COLORS[7]="lightgreen";
00529                   COLORS[8]="lightblue";COLORS[9]="cyan";COLORS[10]="brown";COLORS[11]="salmon";
00530                   COLORS[12]="pink";COLORS[13]="black";
00531               }
00532            }  
00533        }
00534     }
00535     // a listuniq on colors used in several square1...square_n    
00536     public int[] ListUniq(int[] array){
00537        Arrays.sort(array);
00538        int k = 0;
00539         for (int i = 0; i < array.length; i++){
00540            if (i > 0 && array[i] == array[i -1] )
00541            continue;
00542            array[k++] = array[i];
00543        }
00544        int [] unique = new int[k];
00545         System.arraycopy(array, 0, unique, 0, k);
00546        return unique;
00547     }
00548 }
00549 
00550 
00551 /*
00552 0 "white" {255,255,255}
00553 1 "red" {255,0,0}
00554 2 "green" {0,255,0}
00555 3 "blue" {0,0,255}
00556 4 "orange" {238,154,0}
00557 5 "yellow" {255,255,0}
00558 6 "purple" {160,32,240}
00559 7 "lightgreen" {144,238,144}
00560 8 "lightblue" {173,216,230}
00561 9 "cyan" {0,255,255}
00562 10 "brown" {165,24,24}
00563 11 "salmon" {250,128,114}
00564 12 "pink" {255,192,203}
00565 */
00566 
00567 //{255,255,255},{255,0,0},{0,255,0},{0,0,255},{238,154,0},{255,255,0},{160,32,240},{144,238,144},{173,216,230},{0,255,255},{165,24,24},{250,128,114},{255,192,203}