Revision b5cc7760
Added by Leszek Koltunski almost 8 years ago
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 |
{ |
Also available in: Unified diff
New API fully ported; not tested yet but stuff compiles.