Revision 7589635e
Added by Leszek Koltunski almost 8 years ago
src/main/java/org/distorted/examples/save/SaveRenderer.java | ||
---|---|---|
33 | 33 |
import org.distorted.library.Distorted; |
34 | 34 |
import org.distorted.library.DistortedBitmap; |
35 | 35 |
import org.distorted.library.EffectTypes; |
36 |
import org.distorted.library.type.Float1D; |
|
37 |
import org.distorted.library.type.Float2D; |
|
38 |
import org.distorted.library.type.Float4D; |
|
39 |
import org.distorted.library.type.Interpolator1D; |
|
36 |
import org.distorted.library.type.Dynamic1D; |
|
37 |
import org.distorted.library.type.Static1D; |
|
38 |
import org.distorted.library.type.Static2D; |
|
39 |
import org.distorted.library.type.Static3D; |
|
40 |
import org.distorted.library.type.Static4D; |
|
40 | 41 |
|
41 | 42 |
import android.app.Activity; |
42 | 43 |
import android.graphics.Bitmap; |
... | ... | |
51 | 52 |
{ |
52 | 53 |
private GLSurfaceView mView; |
53 | 54 |
private static DistortedBitmap mGirl; |
54 |
private Float2D pLeft, pRight;
|
|
55 |
private Float4D sinkRegion;
|
|
56 |
private static Interpolator1D diSink;
|
|
57 |
private static Float1D s0;
|
|
55 |
private Static2D pLeft, pRight;
|
|
56 |
private Static4D sinkRegion;
|
|
57 |
private static Dynamic1D diSink;
|
|
58 |
private static Static1D s0;
|
|
58 | 59 |
|
59 | 60 |
private int bmpHeight, bmpWidth; |
60 | 61 |
private static int scrHeight, scrWidth; |
... | ... | |
72 | 73 |
|
73 | 74 |
boobsSink = 1.0f; |
74 | 75 |
|
75 |
pLeft = new Float2D(132, 264);
|
|
76 |
pRight= new Float2D(247, 264);
|
|
76 |
pLeft = new Static2D(132, 264);
|
|
77 |
pRight= new Static2D(247, 264);
|
|
77 | 78 |
|
78 |
sinkRegion = new Float4D(0,0,60,60);
|
|
79 |
sinkRegion = new Static4D(0,0,60,60);
|
|
79 | 80 |
|
80 |
s0 = new Float1D(boobsSink);
|
|
81 |
s0 = new Static1D(boobsSink);
|
|
81 | 82 |
|
82 |
diSink = new Interpolator1D();
|
|
83 |
diSink = new Dynamic1D();
|
|
83 | 84 |
diSink.setCount(0.5f); |
84 | 85 |
diSink.setDuration(0); |
85 | 86 |
diSink.add(s0); |
... | ... | |
166 | 167 |
if( bmpHeight/bmpWidth > height/width ) |
167 | 168 |
{ |
168 | 169 |
int w = (height*bmpWidth)/bmpHeight; |
169 |
mGirl.move((width-w)/2 ,0, 0); |
|
170 |
mGirl.scale((float)height/bmpHeight); |
|
170 |
float factor = (float)height/bmpHeight; |
|
171 |
|
|
172 |
mGirl.move( new Static3D((width-w)/2,0,0) ); |
|
173 |
mGirl.scale( new Static3D(factor,factor,factor) ); |
|
171 | 174 |
} |
172 | 175 |
else |
173 | 176 |
{ |
174 | 177 |
int h = (width*bmpHeight)/bmpWidth; |
175 |
mGirl.move(0 ,(height-h)/2, 0); |
|
176 |
mGirl.scale((float)width/bmpWidth); |
|
178 |
float factor = (float)width/bmpWidth; |
|
179 |
|
|
180 |
mGirl.move( new Static3D(0,(height-h)/2,0) ); |
|
181 |
mGirl.scale(new Static3D(factor,factor,factor)); |
|
177 | 182 |
} |
178 | 183 |
|
179 | 184 |
Distorted.onSurfaceChanged(width, height); |
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.