Project

General

Profile

« Previous | Next » 

Revision b5cc7760

Added by Leszek Koltunski over 8 years ago

New API fully ported; not tested yet but stuff compiles.

View differences:

src/main/java/org/distorted/examples/bean/BeanRenderer.java
31 31
import org.distorted.library.type.Dynamic2D;
32 32
import org.distorted.library.Distorted;
33 33
import org.distorted.library.DistortedBitmap;
34
import org.distorted.library.type.Dynamic3D;
34 35
import org.distorted.library.type.Static2D;
35 36
import org.distorted.library.type.Static3D;
36 37
import org.distorted.library.type.Static4D;
......
47 48
   private GLSurfaceView mView;
48 49
   private DistortedBitmap mBean;
49 50
   private Static2D pLeft, pRight;
50
   private Dynamic2D iLeft, iRight;
51
   private Dynamic3D dLeft, dRight;
51 52
   private Static4D rLeft, rRight;
52 53
   private int bmpHeight, bmpWidth;
53 54
    
......
63 64
      rLeft = new Static4D(-9,-31,35,35);
64 65
      rRight= new Static4D(-9,-31,35,35);
65 66
     
66
      iLeft = new Dynamic2D();
67
      iRight= new Dynamic2D();
67
      dLeft = new Dynamic3D();
68
      dRight= new Dynamic3D();
68 69
     
69
      iLeft.setCount(0.0f);
70
      iRight.setCount(0.0f);
71
      iLeft.setDuration(1500);
72
      iRight.setDuration(1500);
70
      dLeft.setCount(0.0f);
71
      dRight.setCount(0.0f);
72
      dLeft.setDuration(1500);
73
      dRight.setDuration(1500);
73 74
      
74
      Static2D p1 = new Static2D(0,0);
75
      Static2D p2 = new Static2D(-10,-34);
75
      Static3D p1 = new Static3D(  0,  0, 0);
76
      Static3D p2 = new Static3D(-10,-34, 0);
76 77
      
77
      iLeft.add(p1);
78
      iLeft.add(p1);
79
      iLeft.add(p1);
80
      iLeft.add(p1);
81
      iLeft.add(p2);
82
      iLeft.add(p2);
78
      dLeft.add(p1);
79
      dLeft.add(p1);
80
      dLeft.add(p1);
81
      dLeft.add(p1);
82
      dLeft.add(p2);
83
      dLeft.add(p2);
83 84
      
84
      iRight.add(p1);
85
      iRight.add(p2);
86
      iRight.add(p2);
87
      iRight.add(p1);
88
      iRight.add(p1);
89
      iRight.add(p1);
85
      dRight.add(p1);
86
      dRight.add(p2);
87
      dRight.add(p2);
88
      dRight.add(p1);
89
      dRight.add(p1);
90
      dRight.add(p1);
90 91
      }
91 92

  
92 93
///////////////////////////////////////////////////////////////////////////////////////////////////
......
149 150
      bmpWidth  = bitmap.getWidth();
150 151
      
151 152
      mBean = new DistortedBitmap(bitmap, 10);     
152
      mBean.distort(iLeft , rLeft , pLeft );
153
      mBean.distort(iRight, rRight, pRight);
153
      mBean.distort(dLeft , pLeft , rLeft );
154
      mBean.distort(dRight, pRight, rRight);
154 155
      
155 156
      try
156 157
        {
src/main/java/org/distorted/examples/differentbitmaps/DifferentBitmapsRenderer.java
31 31
import org.distorted.library.DistortedBitmap;
32 32
import org.distorted.library.EffectTypes;
33 33
import org.distorted.library.type.Dynamic2D;
34
import org.distorted.library.type.Dynamic3D;
35
import org.distorted.library.type.Static1D;
34 36
import org.distorted.library.type.Static2D;
35 37
import org.distorted.library.type.Static3D;
36 38
import org.distorted.library.type.Static4D;
......
49 51
   private GLSurfaceView mView;
50 52
   private DistortedBitmap[] bmp;
51 53
   private Static2D point;
52
   private Dynamic2D di;
53
   private Static2D[] vec;
54
   private Dynamic3D dDistort;
55
   private Static3D[] vec;
54 56
   private int bmpHeight, bmpWidth;
55 57
    
56 58
///////////////////////////////////////////////////////////////////////////////////////////////////
......
60 62
      mView = v;
61 63
     
62 64
      // create shared effects - enlarge the nose and keep moving the whole bitmap left and right.
63
      di = new Dynamic2D();
64
      di.setCount(0.0f);
65
      di.setDuration(3000);
66
      vec = new Static2D[2];
67
      vec[0] = new Static2D( 25,0);
68
      vec[1] = new Static2D(-25,0);
69
      di.add(vec[0]);
70
      di.add(vec[1]);
65
      dDistort = new Dynamic3D();
66
      dDistort.setCount(0.0f);
67
      dDistort.setDuration(3000);
68
      vec = new Static3D[2];
69
      vec[0] = new Static3D( 25,0,0);
70
      vec[1] = new Static3D(-25,0,0);
71
      dDistort.add(vec[0]);
72
      dDistort.add(vec[1]);
71 73
      point = new Static2D(305, 380);
72 74
      }
73 75

  
......
165 167
      bmp[1].setBitmap(bitmap1);
166 168
      bmp[2].setBitmap(bitmap2);
167 169
         
168
      bmp[0].sink(8.0f, new Static4D(0,0,80,80), point, 0, 0.5f);
169
      bmp[0].distort(di,point); 
170
      bmp[0].sink( new Static1D(8), point, new Static4D(0,0,80,80));
171
      bmp[0].distort(dDistort,point);
170 172
      
171 173
      try
172 174
        {
src/main/java/org/distorted/examples/girl/GirlRenderer.java
214 214
      
215 215
      mGirl = new DistortedBitmap(bitmap, 30);
216 216

  
217
      mGirl.sink( diSink, sinkRegion, pLeft );
218
      mGirl.sink( diSink, sinkRegion, pRight);
217
      mGirl.sink( diSink, pLeft, sinkRegion );
218
      mGirl.sink( diSink, pRight,sinkRegion );
219 219

  
220
      mGirl.distort(diL, Region, pLeft );
221
      mGirl.distort(diR, Region, pRight);
220
      mGirl.distort(diL, pLeft , Region);
221
      mGirl.distort(diR, pRight, Region);
222 222
         
223
      mGirl.swirl(diHips, HipsRegion, pHips);
223
      mGirl.swirl(diHips, pHips, HipsRegion );
224 224
      
225 225
      try
226 226
        {
src/main/java/org/distorted/examples/scratchpad/ScratchpadSurfaceView.java
46 46
  private static Static2D point;
47 47

  
48 48
  private static Static4D mRegion;
49
  private static Dynamic1D mInterA, mInterM, mInterB;
49
  private static Dynamic1D mInterA, mInterM, mInterB, mInterS;
50 50

  
51 51
  private static Dynamic3D mInterD;
52 52
  private static Static3D v0, v1, v2, v3;
......
83 83
    mInterA.add(new Static1D(1));
84 84
    mInterA.add(new Static1D(0));
85 85

  
86
    mInterS = new Dynamic1D();
87
    mInterS.setDuration(mDuration);
88
    mInterS.setCount(mCount);
89
    mInterS.add(new Static1D(1.0f));
90
    mInterS.add(new Static1D(0.3f));
91

  
86 92
    mInterB = new Dynamic1D();
87 93
    mInterB.setDuration(mDuration);
88 94
    mInterB.setCount(mCount);
......
149 155
    mInterA.setDuration(duration);
150 156
    mInterB.setDuration(duration);
151 157
    mInterM.setDuration(duration);
158
    mInterS.setDuration(duration);
152 159
    }
153 160

  
154 161
///////////////////////////////////////////////////////////////////////////////////////////////////
......
160 167
    mInterA.setCount(count);
161 168
    mInterB.setCount(count);
162 169
    mInterM.setCount(count);
170
    mInterS.setCount(count);
163 171
    }
164 172
  
165 173
///////////////////////////////////////////////////////////////////////////////////////////////////
......
178 186

  
179 187
                                    switch(mCurrentEffect)
180 188
                                      {
181
                                      case 0: ScratchpadRenderer.mBackground.distort(mInterD, region, point);
189
                                      case 0: ScratchpadRenderer.mBackground.distort(mInterD, point, region);
182 190
                                           break;
183
                                      case 1: ScratchpadRenderer.mBackground.sink(0.3f, region, point, mDuration, mCount); 
191
                                      case 1: ScratchpadRenderer.mBackground.sink(mInterS, point, region);
184 192
                                           break;
185 193
                                      case 2: ScratchpadRenderer.mBackground.alpha(mInterA, mRegion, false);
186 194
                                           break;  
src/main/java/org/distorted/examples/sink/SinkRenderer.java
30 30
import org.distorted.library.Distorted;
31 31
import org.distorted.library.DistortedBitmap;
32 32
import org.distorted.library.EffectTypes;
33
import org.distorted.library.type.Dynamic1D;
34
import org.distorted.library.type.Static1D;
33 35
import org.distorted.library.type.Static2D;
34 36
import org.distorted.library.type.Static3D;
35 37
import org.distorted.library.type.Static4D;
......
118 120
      
119 121
    bmpHeight = bitmap.getHeight();
120 122
    bmpWidth  = bitmap.getWidth();
121
      
123

  
124
    Dynamic1D dSink = new Dynamic1D();
125
    dSink.setDuration(2000);
126
    dSink.setCount(0);
127
    dSink.add(new Static1D( 1));
128
    dSink.add(new Static1D(10));
129

  
122 130
    sinkBmp = new DistortedBitmap(bitmap, 30);
123
    sinkBmp.sink( 10.0f, Region, pLeft, 2000, 0.0f);
124
    sinkBmp.sink(10.0f, Region, pRight,2000, 0.0f);
131
    sinkBmp.sink( dSink, pLeft, Region);
132
    sinkBmp.sink( dSink, pRight,Region);
125 133
      
126 134
    try
127 135
      {

Also available in: Unified diff