Revision 7589635e
Added by Leszek Koltunski almost 8 years ago
src/main/java/org/distorted/examples/macroblock/MacroblockRenderer.java | ||
---|---|---|
29 | 29 |
import org.distorted.library.Distorted; |
30 | 30 |
import org.distorted.library.DistortedBitmap; |
31 | 31 |
import org.distorted.library.EffectTypes; |
32 |
import org.distorted.library.type.Interpolator1D;
|
|
33 |
import org.distorted.library.type.Interpolator3D;
|
|
34 |
import org.distorted.library.type.Float1D;
|
|
35 |
import org.distorted.library.type.Float2D;
|
|
36 |
import org.distorted.library.type.Float3D;
|
|
37 |
import org.distorted.library.type.Float4D;
|
|
32 |
import org.distorted.library.type.Dynamic1D;
|
|
33 |
import org.distorted.library.type.Dynamic3D;
|
|
34 |
import org.distorted.library.type.Static1D;
|
|
35 |
import org.distorted.library.type.Static2D;
|
|
36 |
import org.distorted.library.type.Static3D;
|
|
37 |
import org.distorted.library.type.Static4D;
|
|
38 | 38 |
|
39 | 39 |
import android.graphics.Bitmap; |
40 | 40 |
import android.graphics.BitmapFactory; |
... | ... | |
47 | 47 |
{ |
48 | 48 |
private GLSurfaceView mView; |
49 | 49 |
private DistortedBitmap macroblock; |
50 |
private Float4D Region;
|
|
50 |
private Static4D Region;
|
|
51 | 51 |
private int bmpHeight, bmpWidth; |
52 |
private Float2D traP, macP;
|
|
52 |
private Static2D traP, macP;
|
|
53 | 53 |
|
54 | 54 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
55 | 55 |
|
... | ... | |
57 | 57 |
{ |
58 | 58 |
mView = v; |
59 | 59 |
|
60 |
Region = new Float4D(0,0,100,100);
|
|
61 |
macP = new Float2D(530,200);
|
|
62 |
traP = new Float2D(230,200);
|
|
60 |
Region = new Static4D(0,0,100,100);
|
|
61 |
macP = new Static2D(530,200);
|
|
62 |
traP = new Static2D(230,200);
|
|
63 | 63 |
} |
64 | 64 |
|
65 | 65 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
115 | 115 |
{ |
116 | 116 |
int duration = 10000; |
117 | 117 |
|
118 |
Interpolator3D diMove = new Interpolator3D();
|
|
118 |
Dynamic3D diMove = new Dynamic3D();
|
|
119 | 119 |
diMove.setCount(0.0f); |
120 | 120 |
diMove.setDuration(duration); |
121 |
diMove.add(new Float3D(width-bmpWidth,height-bmpHeight,0));
|
|
122 |
diMove.add(new Float3D(0,0,0));
|
|
121 |
diMove.add(new Static3D(width-bmpWidth,height-bmpHeight,0));
|
|
122 |
diMove.add(new Static3D(0,0,0));
|
|
123 | 123 |
|
124 |
Interpolator3D diScale = new Interpolator3D();
|
|
124 |
Dynamic3D diScale = new Dynamic3D();
|
|
125 | 125 |
diScale.setCount(0.0f); |
126 | 126 |
diScale.setDuration(duration); |
127 |
diScale.add(new Float3D(1,1,1));
|
|
128 |
diScale.add(new Float3D(0.33f,0.33f,1));
|
|
127 |
diScale.add(new Static3D(1,1,1));
|
|
128 |
diScale.add(new Static3D(0.33f,0.33f,1));
|
|
129 | 129 |
|
130 |
Interpolator1D diRotate = new Interpolator1D();
|
|
130 |
Dynamic1D diRotate = new Dynamic1D();
|
|
131 | 131 |
diRotate.setCount(0.0f); |
132 | 132 |
diRotate.setDuration(duration); |
133 |
diRotate.add(new Float1D( 0));
|
|
134 |
diRotate.add(new Float1D(360));
|
|
133 |
diRotate.add(new Static1D( 0));
|
|
134 |
diRotate.add(new Static1D(360));
|
|
135 | 135 |
|
136 | 136 |
macroblock.abortEffects(EffectTypes.MATRIX); |
137 | 137 |
|
138 | 138 |
macroblock.move(diMove); |
139 | 139 |
macroblock.scale(diScale); |
140 |
macroblock.rotate( new Float3D(bmpWidth/2,bmpHeight/2,0), diRotate, 0.0f, 0.0f, 1.0f);
|
|
141 |
|
|
140 |
macroblock.rotate( new Static3D(bmpWidth/2,bmpHeight/2,0), diRotate, new Static3D(0,0,1) );
|
|
141 |
|
|
142 | 142 |
Distorted.onSurfaceChanged(width, height); |
143 | 143 |
} |
144 | 144 |
} |
Also available in: Unified diff
Major push towards simplifying DistortedObject's public API.
All MATRIX effects are using the new API - the 'DataND' marker interfaces.