/[fenfire]/fenfire/org/fenfire/modules/pp/UniquePaperVob.java
ViewVC logotype

Diff of /fenfire/org/fenfire/modules/pp/UniquePaperVob.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by mudyc, Mon Apr 14 12:18:55 2003 UTC revision 1.10 by mudyc, Tue Apr 22 12:14:32 2003 UTC
# Line 60  public static final String rcsid = "$Id$ Line 60  public static final String rcsid = "$Id$
60          Color c2 = getUniqColor();          Color c2 = getUniqColor();
61    
62          float a =(float) Math.PI * rand.nextFloat();          float a =(float) Math.PI * rand.nextFloat();
63          if (a > Math.PI/4 && a <= Math.PI *3f/4) {          if ( Math.abs(rand.nextInt())%4 != 0) {
             // verticals..  
64    
65              float linew = mw/((Math.abs(rand.nextInt())%5) + 3);              float linew = mw/((Math.abs(rand.nextInt())%5) + 3);
66              float begin_x;              float begin_x = -1;
67              float f = mx + mw/2 + panx*zoom;              float begin_y = -1;
68                            float f;
69              // >> if too far we have to be at least mw away from mx.  
70              while ( f < mx - 2*mw) {              if (a > Math.PI/4 && a <= Math.PI *3f/4) {
71                  try {                  // verticals..
72                  f += Math.abs( ((ratio * linew)/j)*zoom );                  f = mx + mw/2 - panx*zoom;
73                  f += Math.abs( (((1-ratio) * linew)/j)*zoom );  
74                  } catch (Exception e) { pa("e:"+e); }                  // >> if too far we have to be at least mw away from mx.
75              }                  while ( f < mx - 2*mw) {
76                        f += Math.abs( ((ratio * linew)/j)*zoom );
77                        f += Math.abs( (((1-ratio) * linew)/j)*zoom );
78                    }
79                    // add y component
80                    f += (pany*zoom)/(float)Math.tan(a);
81    
82              // << if too near                  if (a < Math.PI/2)
83              while( f > mx-2*mw ) {                      f += (mh/2)/(float)Math.tan(a);
84                  f -= Math.abs( ((ratio * linew)/j)*zoom );                  else
85                  f -= Math.abs( (((1-ratio) * linew)/j)*zoom );                      f -= (mh/2)/(float)Math.tan(a);
             }  
86    
87              // add y component                  // << if too near
88              begin_x = f + (pany*zoom)/(float)Math.tan(a);                  while( f > mx-2*mw ) {
89                        f -= Math.abs( ((ratio * linew)/j)*zoom );
90                        f -= Math.abs( (((1-ratio) * linew)/j)*zoom );
91                    }
92                    begin_x = f;
93                } else {
94                    j = (float)Math.sin(k - Math.PI/2);
95                    // horizontals..
96                    f = my + mh/2 - pany*zoom;
97    
98                    // >> if too far we have to be at least mw away from my.
99                    while ( f < my - 2*mh) {
100                        f += Math.abs( ((ratio * linew)/j)*zoom );
101                        f += Math.abs( (((1-ratio) * linew)/j)*zoom );
102                    }
103                    // add x component
104                    f += (panx*zoom)*(float)Math.tan(a);
105    
106                    if (a < Math.PI/4)
107                        f += (mw/2)*(float)Math.tan(a);
108                    else
109                        f -= (mw/2)*(float)Math.tan(a);
110                    
111    
112              boolean black = true;                  // << if too near
113                    while( f > my-2*mh ) {
114                        f -= Math.abs( ((ratio * linew)/j)*zoom );
115                        f -= Math.abs( (((1-ratio) * linew)/j)*zoom );
116                    }
117                    begin_y = f;
118                }
119    
120                boolean black = true;
121              float end_x = mx + mw + Math.abs(mh/(float)Math.tan(a));              float end_x = mx + mw + Math.abs(mh/(float)Math.tan(a));
122              while (begin_x < end_x) {              float end_y = my + mh + Math.abs(mw*(float)Math.tan(a));
123                  int[] x = new int[4];  
124                  int[] y = new int[4];              int[] x = new int[4];
125                int[] y = new int[4];
                 //pa("foo"+begin_x+"/"+end_x);  
   
                 x[0] = (int)(begin_x);  
                 y[0] = (my+mh);  
   
                 x[1] = (int)( begin_x + mh/Math.tan(a) );  
                 y[1] = my;  
                 if (black)  
                     begin_x += Math.abs(zoom* (ratio * linew)/j);  
                 else  
                     begin_x += Math.abs(zoom* ((1-ratio) * linew)/j);  
                 black = !black;  
                   
                 x[2] = (int)( begin_x + mh/Math.tan(a));  
                 y[2] = my;  
                 x[3] = (int)(begin_x);  
                 y[3] = my+mh;  
   
                 if (black) g.setColor(c1);  
                 else g.setColor(c2);  
126    
127                  g.fillPolygon(x,y,4);              if (a > Math.PI/4 && a <= Math.PI *3f/4) {
128                    if (begin_x > end_x) throw new Error("UniquePaperVob::begin_x > end_x!");
129                    while (begin_x < end_x) {
130                        x[0] = (int)begin_x;
131                        y[0] = (my+mh);
132    
133                        x[1] = (int)( begin_x + mh/Math.tan(a) );
134                        y[1] = my;
135                        if (black)
136                            begin_x += Math.abs(zoom* (ratio * linew)/j);
137                        else
138                            begin_x += Math.abs(zoom* ((1-ratio) * linew)/j);
139                        black = !black;
140                    
141                        x[2] = (int)( begin_x + mh/Math.tan(a));
142                        y[2] = my;
143                        x[3] = (int)(begin_x);
144                        y[3] = my+mh;
145                        
146                        if (black) g.setColor(c1);
147                        else g.setColor(c2);
148                        g.fillPolygon(x,y,4);
149                    }
150                } else {
151                    if (begin_y > end_y) throw new Error("UniquePaperVob::begin_y > end_y!");
152                    while (begin_y < end_y) {
153                        y[0] = (int)begin_y;
154                        x[0] = mx;
155    
156                        y[1] = (int)( begin_y + mw * Math.tan(a));
157                        x[1] = mx+mw;
158                        if (black)
159                            begin_y += Math.abs(zoom* (ratio * linew)/j);
160                        else
161                            begin_y += Math.abs(zoom* ((1-ratio) * linew)/j);
162                        black = !black;
163                    
164                        y[2] = (int)( begin_y + mw * Math.tan(a));
165                        x[2] = mx+mw;
166                        y[3] = (int)(begin_y);
167                        x[3] = mx;
168                        
169                        if (black) g.setColor(c1);
170                        else g.setColor(c2);
171                        g.fillPolygon(x,y,4);
172                    }
173              }              }
174          } else {          } else {
             // horizontals..  
175              g.setColor(c1);              g.setColor(c1);
176              g.fillRect(mx, my, mw, mh);              g.fillRect(mx, my, mw, mh);
177          }          }
178    
179                    
180            if (dbg) {
181          int x = mx + mw/2 - (int)((mw*zoom)/4) + (int)(panx * zoom),              int x = mx + mw/2 - (int)((mw*zoom)/4) + (int)(panx * zoom),
182              y = my + mh/2 - (int)((mh*zoom)/4) + (int)(pany * zoom),                  y = my + mh/2 - (int)((mh*zoom)/4) + (int)(pany * zoom),
183              w = (int) ((float)mw*zoom)/2,                  w = (int) ((float)mw*zoom)/2,
184              h = (int) ((float)mh*zoom)/2;                  h = (int) ((float)mh*zoom)/2;
185                g.setColor(Color.gray);
186          //pa("x"+x+"y"+y+"w"+w+"h"+h);              g.fillRect(x, y, w, h);
187                    }
         g.setColor(Color.gray);  
         g.fillRect(x, y, w, h);  
           
188          g.setColor(oldfg);          g.setColor(oldfg);
189          g.setClip(oldClip);          g.setClip(oldClip);
190      }      }
# Line 142  public static final String rcsid = "$Id$ Line 194  public static final String rcsid = "$Id$
194          return Color.getHSBColor(rand.nextFloat(), .7f + (rand.nextFloat()*2-1)/8, brigh);          return Color.getHSBColor(rand.nextFloat(), .7f + (rand.nextFloat()*2-1)/8, brigh);
195      }      }
196    
   
   
     Vob glList;  
   
197      public int putGL(VobScene vs, int coordsys1) {      public int putGL(VobScene vs, int coordsys1) {
198            throw new Error("Use libpaper with OpenGL instead of UniquePaperVob");
         /*  
         if(dbg) pa("Addtolistgl rectbg "+coordsys1);  
         if(glList == null) {  
             String bgcall = "";  
             if(colors != null && NColors > 0) {  
                 double w = 1.0 / NColors;  
   
                 for(int i=0; i<NColors; i++) {  
                     double x1 = i*w;  
                     double x2 = x1 + w;  
                     bgcall += (  
                         "Color "+ColorUtil.colorGLString(colors[i])+" 1\n"+  
                         "Begin QUAD_STRIP\n"+  
                         "Vertex "+x1+" 1\n" +  
                         "Vertex "+x1+" 0\n"+  
                         "Vertex "+x2+" 1\n"+  
                         "Vertex "+x2+" 0\n"+  
                         "End\n");  
                 }  
             } else {  
                 bgcall = (  
                           "Color "+ColorUtil.colorGLString(bgColor)+" 1\n" +  
                           "Begin QUAD_STRIP\n"+  
                           "Vertex 1 1\nVertex 1 0\n"+  
                           "Vertex 0 1\nVertex 0 0\n"+  
                           "End\n");  
             }  
       
             if (drawBorder) bgcall += glBorderString();  
   
             glList = GLRen.createCallListBoxCoorded(  
                 "PushAttrib CURRENT_BIT ENABLE_BIT\n"+  
                 "Disable TEXTURE_2D\n"+  
   
                 bgcall +  
   
                 "PopAttrib\n"  
                     );  
         }  
         vs.map.put(glList, coordsys1);  
   
         */  
         return 0;  
199      }      }
   
200  }  }
201    

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26