/[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.4 by mudyc, Tue Apr 8 21:13:01 2003 UTC revision 1.5 by mudyc, Wed Apr 9 00:56:51 2003 UTC
# Line 7  import org.nongnu.libvob.gl.*; Line 7  import org.nongnu.libvob.gl.*;
7    
8  import org.nongnu.libvob.util.ColorUtil;  import org.nongnu.libvob.util.ColorUtil;
9  import java.awt.*;  import java.awt.*;
10    import java.util.Random;
11    
12  /** A vob which is a rectangular background and frame.  /** A vob which is a rectangular background and frame.
13   * Draws a filled (possibly with several colors) background rectangle,   * Draws a filled (possibly with several colors) background rectangle,
# Line 18  public static final String rcsid = "$Id$ Line 19  public static final String rcsid = "$Id$
19      private static void pa(String s) { System.out.println("UniquePaperVob::"+s); }      private static void pa(String s) { System.out.println("UniquePaperVob::"+s); }
20    
21    
22      private final Object uniqId;      private Random rand;
23        private final long seed;
24      public UniquePaperVob(Object uniqId) {      public UniquePaperVob(Object uniqId) {
25          this.uniqId = uniqId;          this.seed = uniqId.hashCode();
26      }      }
27    
28    
# Line 28  public static final String rcsid = "$Id$ Line 30  public static final String rcsid = "$Id$
30                         boolean fast,                         boolean fast,
31                         Vob.RenderInfo info1,                         Vob.RenderInfo info1,
32                         Vob.RenderInfo info2) {                         Vob.RenderInfo info2) {
33                    rand = new Random(seed);
34          Shape oldClip = g.getClip();          Shape oldClip = g.getClip();
35          Color oldfg = g.getColor();          Color oldfg = g.getColor();
36                    
# Line 47  public static final String rcsid = "$Id$ Line 49  public static final String rcsid = "$Id$
49          float zoom = ((float)(geom.x))/100000;          float zoom = ((float)(geom.x))/100000;
50          int gx = geom.x;          int gx = geom.x;
51    
         //pa("Zoom: "+zoom);  
52    
53          g.setColor(Color.orange);          // Make SEEPRA! ;)
54          g.fillRect(mx, my, mw, mh);          float k = rand.nextFloat() * 2 -1;
55            float ratio = rand.nextFloat();
56            Color c1 = getUniqColor();
57            Color c2 = getUniqColor();
58    
59            float a =(float) Math.PI * rand.nextFloat();
60            if (a > Math.PI/4 && a <= Math.PI *3f/4) {
61                // verticals..
62                
63                float begin_x = mx - mw * 2 + (panx%mw)/zoom;
64                if (panx < 0) begin_x = mx - mw * 2  - (-panx%mw)/zoom;
65                begin_x += (pany/zoom)/Math.tan(a);
66    
67                boolean black = true;
68    
69                float end_x = mx+mw + Math.abs(mh/(float)Math.tan(a));
70                float linew = mw/(rand.nextInt()%5 + 3);
71                while (begin_x < end_x) {
72                    int[] x = new int[4];
73                    int[] y = new int[4];
74    
75                    //pa("foo"+begin_x+"/"+end_x);
76    
77                    x[0] = (int)(begin_x);
78                    y[0] = (my+mh);
79    
80                    x[1] = (int)( begin_x + mh/Math.tan(a) );
81                    y[1] = my;
82                    if (black)
83                        begin_x += Math.abs(zoom* ratio * linew);
84                    else
85                        begin_x += Math.abs(zoom* (1-ratio) * linew);
86                    black = !black;
87                    
88                    x[2] = (int)( begin_x + mh/Math.tan(a));
89                    y[2] = my;
90                    x[3] = (int)(begin_x);
91                    y[3] = my+mh;
92    
93                    if (black) g.setColor(c1);
94                    else g.setColor(c2);
95    
96                    g.fillPolygon(x,y,4);
97                }
98            } else {
99                // horizontals..
100                g.setColor(c1);
101                g.fillRect(mx, my, mw, mh);
102            }
103    
104            
105    
106          int x = mx + mw/2 - (int)((mw*zoom)/4) + (int)(panx * zoom),          int x = mx + mw/2 - (int)((mw*zoom)/4) + (int)(panx * zoom),
107              y = my + mh/2 - (int)((mh*zoom)/4) + (int)(pany * zoom),              y = my + mh/2 - (int)((mh*zoom)/4) + (int)(pany * zoom),
# Line 68  public static final String rcsid = "$Id$ Line 119  public static final String rcsid = "$Id$
119          g.setClip(oldClip);          g.setClip(oldClip);
120      }      }
121    
122        private Color getUniqColor() {
123            float brigh = .8f;
124            return Color.getHSBColor(rand.nextFloat(), .4f + (rand.nextFloat()*2-1)/8, brigh);
125        }
126    
127    
128    
129      Vob glList;      Vob glList;
130    
131      public int putGL(VobScene vs, int coordsys1) {      public int putGL(VobScene vs, int coordsys1) {

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

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