Revision 7589635e
Added by Leszek Koltunski almost 8 years ago
src/main/java/org/distorted/examples/monalisa/MonaLisaRenderer.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.Float2D;
|
|
33 |
import org.distorted.library.type.Float3D;
|
|
34 |
import org.distorted.library.type.Float4D;
|
|
32 |
import org.distorted.library.type.Static2D;
|
|
33 |
import org.distorted.library.type.Static3D;
|
|
34 |
import org.distorted.library.type.Static4D;
|
|
35 | 35 |
|
36 | 36 |
import android.graphics.Bitmap; |
37 | 37 |
import android.graphics.BitmapFactory; |
... | ... | |
44 | 44 |
{ |
45 | 45 |
private GLSurfaceView mView; |
46 | 46 |
private DistortedBitmap monaLisa; |
47 |
private Float2D pLeft, pRight;
|
|
48 |
private Float4D rLeft, rRight;
|
|
49 |
private Float3D vLeft, vRight;
|
|
47 |
private Static2D pLeft, pRight;
|
|
48 |
private Static4D rLeft, rRight;
|
|
49 |
private Static3D vLeft, vRight;
|
|
50 | 50 |
private int bmpHeight, bmpWidth; |
51 | 51 |
|
52 | 52 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
55 | 55 |
{ |
56 | 56 |
mView = v; |
57 | 57 |
|
58 |
pLeft = new Float2D( 90, 258);
|
|
59 |
pRight= new Float2D(176, 255);
|
|
58 |
pLeft = new Static2D( 90, 258);
|
|
59 |
pRight= new Static2D(176, 255);
|
|
60 | 60 |
|
61 |
rLeft = new Float4D(-10,-10,25,25);
|
|
62 |
rRight= new Float4D( 10, -5,25,25);
|
|
61 |
rLeft = new Static4D(-10,-10,25,25);
|
|
62 |
rRight= new Static4D( 10, -5,25,25);
|
|
63 | 63 |
|
64 |
vLeft = new Float3D(-20,-20,0);
|
|
65 |
vRight= new Float3D( 20,-10,0);
|
|
64 |
vLeft = new Static3D(-20,-20,0);
|
|
65 |
vRight= new Static3D( 20,-10,0);
|
|
66 | 66 |
} |
67 | 67 |
|
68 | 68 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
84 | 84 |
if( bmpHeight/bmpWidth > height/width ) |
85 | 85 |
{ |
86 | 86 |
int w = (height*bmpWidth)/bmpHeight; |
87 |
monaLisa.move((width-w)/2 ,0, 0); |
|
88 |
monaLisa.scale((float)height/bmpHeight); |
|
87 |
float factor = (float)height/bmpHeight; |
|
88 |
|
|
89 |
monaLisa.move( new Static3D((width-w)/2,0,0) ); |
|
90 |
monaLisa.scale( new Static3D(factor,factor,factor) ); |
|
89 | 91 |
} |
90 | 92 |
else |
91 | 93 |
{ |
92 | 94 |
int h = (width*bmpHeight)/bmpWidth; |
93 |
monaLisa.move(0 ,(height-h)/2, 0); |
|
94 |
monaLisa.scale((float)width/bmpWidth); |
|
95 |
float factor = (float)width/bmpWidth; |
|
96 |
|
|
97 |
monaLisa.move( new Static3D(0,(height-h)/2,0) ); |
|
98 |
monaLisa.scale( new Static3D(factor,factor,factor) ); |
|
95 | 99 |
} |
96 | 100 |
|
97 | 101 |
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.