Project

General

Profile

« Previous | Next » 

Revision edafb4a7

Added by Leszek Koltunski almost 8 years ago

Some progress with Fragment3D app - doesn't compile yet!

View differences:

src/main/java/org/distorted/examples/fragment3d/Fragment3DActivity.java
42 42
import org.distorted.library.DistortedObject;
43 43
import org.distorted.library.EffectNames;
44 44

  
45
import java.util.ArrayList;
46

  
45 47
///////////////////////////////////////////////////////////////////////////////////////////////////
46 48

  
47 49
public class Fragment3DActivity extends Activity
48
                                implements OnSeekBarChangeListener,
49
                                           View.OnClickListener,
50
                                implements View.OnClickListener,
50 51
                                           AdapterView.OnItemSelectedListener
51 52
  {
52 53
  private static final int COLOR_OFF = 0xffffe81f;
......
54 55

  
55 56
  private boolean firstScreen;
56 57

  
57
  // fields needed for the first 'pick-a-shape' screen
58
  //
59 58
  private int mNumCols = 3;
60 59
  private int mNumRows = 3;
61 60
  private NumberPicker mColsPicker, mRowsPicker;
......
65 64
  private int mObjectType;
66 65
  private int mBitmap;
67 66

  
68
  // fields needed for the second 'apply fragment effects' screen
69
  //
70
  private SeekBar bar;
71
  private TextView textChroma, textAlpha, textBrightness, textSaturation, textCenter;
72
  private int chromaL, chromaR, chromaG, chromaB;
73
  private int alphaL;
74
  private int brightnessL;
75
  private int saturationL;
76
  private int centerX, centerY;
77

  
78
  private float fchromaL, fchromaR, fchromaG, fchromaB;
79
  private float falphaL;
80
  private float fbrightnessL;
81
  private float fsaturationL;
82
  private float fcenterX, fcenterY;
83
  private EffectNames[] effects = new EffectNames[4];
67
  private ArrayList<Fragment3DEffect> mEffects = new ArrayList<>();
68
  private DistortedBitmap mCenter = null;
84 69

  
85 70
///////////////////////////////////////////////////////////////////////////////////////////////////
86 71
    
......
219 204
      firstScreen = false;
220 205
      mObject = new DistortedBitmap(100,100,mNumCols);
221 206
      setContentView(R.layout.fragment3dlayout);
222
      Default(null);
223 207
      }
224 208
    else
225 209
      {
......
248 232
      str += mShape[i] ? "1" : "0";
249 233

  
250 234
    mObject = new DistortedCubes(mNumCols, str, 10);
251

  
252 235
    setContentView(R.layout.fragment3dlayout);
253
    Default(null);
254 236
    }
255 237

  
256 238

  
......
281 263
///////////////////////////////////////////////////////////////////////////////////////////////////
282 264
// 'second screen' methods
283 265

  
284
  public void Default(View view)
285
    {
286
    effects[0] = EffectNames.CHROMA;
287
    effects[1] = EffectNames.ALPHA;
288
    effects[2] = EffectNames.BRIGHTNESS;
289
    effects[3] = EffectNames.SATURATION;
290
    
291
    chromaL = 0;
292
    chromaR = 0;
293
    chromaG = 0;
294
    chromaB = 0;
295

  
296
    alphaL     = 0;
297
    brightnessL= 0;
298
    saturationL= 0;
299

  
300
    centerX = 50;
301
    centerY = 50;
302

  
303
    textCenter = (TextView)findViewById(R.id.fragment3dcenterText);
304
    computeCenter();
305
    setCenterText();
306

  
307
    setBar(R.id.fragment3dcenterX, centerX);
308
    setBar(R.id.fragment3dcenterY, centerY);
309

  
310
    addViews();
311
    }
312
    
313
///////////////////////////////////////////////////////////////////////////////////////////////////
314
    
315
  private void addViews()
266
  private void removeAllViews()
316 267
    {
317 268
    LinearLayout layout = (LinearLayout)findViewById(R.id.fragment3dlayout);
318
    
319
    layout.removeAllViews();
320
      
321
    View chroma    = getLayoutInflater().inflate(R.layout.fragment3dchroma    , null);
322
    View alpha     = getLayoutInflater().inflate(R.layout.fragment3dalpha     , null);
323
    View brightness= getLayoutInflater().inflate(R.layout.fragment3dbrightness, null);
324
    View saturation= getLayoutInflater().inflate(R.layout.fragment3dsaturation, null);
325
     
326
    for( int i=effects.length-1 ; i>=0 ; i-- )
327
      {
328
      switch(effects[i])
329
        {
330
        case CHROMA     : layout.addView(chroma    , 0); break;
331
        case ALPHA      : layout.addView(alpha     , 0); break;
332
        case BRIGHTNESS : layout.addView(brightness, 0); break;
333
        case SATURATION : layout.addView(saturation, 0); break;
334
        }
335
      }
336
      
337
    textChroma    = (TextView)findViewById(R.id.fragment3dchromaText);
338
    textAlpha     = (TextView)findViewById(R.id.fragment3dalphaText);
339
    textBrightness= (TextView)findViewById(R.id.fragment3dbrightnessText);
340
    textSaturation= (TextView)findViewById(R.id.fragment3dsaturationText);
341
     
342
    setChromaText();
343
    setAlphaText();
344
    setBrightnessText();
345
    setSaturationText();
346
      
347
    setBar(R.id.fragment3dchromaBar1, chromaL);
348
    setBar(R.id.fragment3dchromaBar2, chromaR);
349
    setBar(R.id.fragment3dchromaBar3, chromaG);
350
    setBar(R.id.fragment3dchromaBar4, chromaB);
351

  
352
    setBar(R.id.fragment3dalphaBar1     , alphaL);
353
    setBar(R.id.fragment3dbrightnessBar1, brightnessL);
354
    setBar(R.id.fragment3dsaturationBar1, saturationL);
355

  
356
    Fragment3DSurfaceView view = (Fragment3DSurfaceView)findViewById(R.id.fragment3dSurfaceView);
357
    view.getRenderer().setOrder(effects);
358
    }
359

  
360
///////////////////////////////////////////////////////////////////////////////////////////////////
361

  
362
  private void moveUp(EffectNames name)
363
    {
364
    int len = effects.length-1;
365
    int index = -1;
366

  
367
    for(int i=0; i<=len; i++)
368
      {
369
      if( effects[i]==name )
370
        {
371
        index=i;
372
        break;
373
        }
374
      }
375

  
376
    if( index==0 )
377
      {
378
      for(int i=0; i<len; i++)
379
        effects[i] = effects[i+1];
380

  
381
      effects[len] = name;
382
      }
383
    else if( index>0 )
384
      {
385
      effects[index]   = effects[index-1];
386
      effects[index-1] = name;
387
      }
388

  
389
    addViews();
390
    }
391

  
392
///////////////////////////////////////////////////////////////////////////////////////////////////
393

  
394
  public void ButtonChroma(View v)
395
    {
396
    moveUp(EffectNames.CHROMA);
397
    }
398

  
399
///////////////////////////////////////////////////////////////////////////////////////////////////
400

  
401
  public void ButtonAlpha(View v)
402
    {
403
    moveUp(EffectNames.ALPHA);
404
    }
405

  
406
///////////////////////////////////////////////////////////////////////////////////////////////////
407

  
408
  public void ButtonBrightness(View v)
409
    {
410
    moveUp(EffectNames.BRIGHTNESS);
411
    }
412

  
413
///////////////////////////////////////////////////////////////////////////////////////////////////
414

  
415
  public void ButtonSaturation(View v)
416
    {
417
    moveUp(EffectNames.SATURATION);
418
    }
419

  
420
///////////////////////////////////////////////////////////////////////////////////////////////////
421 269

  
422
  private void setBar(int id, int value)
423
    {
424
    bar = (SeekBar)findViewById(id);
425
    bar.setOnSeekBarChangeListener(this);
426
    bar.setProgress(value);
270
    layout.removeAllViews();
271
    mEffects.clear();
272
    mCenter = null;
427 273
    }
428 274

  
429 275
///////////////////////////////////////////////////////////////////////////////////////////////////
430 276

  
431
  private void computeChroma()
277
  private void addView(EffectNames name)
432 278
    {
433
    Fragment3DSurfaceView view = (Fragment3DSurfaceView)findViewById(R.id.fragment3dSurfaceView);
434
    Fragment3DRenderer renderer = view.getRenderer();
435

  
436
    fchromaL = chromaL/100.0f;
437
    fchromaR = chromaR*255/100.0f;
438
    fchromaG = chromaG*255/100.0f;
439
    fchromaB = chromaB*255/100.0f;
440

  
441
    renderer.setChroma( fchromaL, fchromaR, fchromaG, fchromaB );
279
    Fragment3DEffect newInfo = new Fragment3DEffect(name);
280
    LinearLayout layout = (LinearLayout)findViewById(R.id.fragment3dlayout);
281
    newInfo.addView(layout);
282
    mEffects.add(newInfo);
442 283
    }
443 284

  
444 285
///////////////////////////////////////////////////////////////////////////////////////////////////
445 286

  
446
  private void setChromaText()
287
  public void Remove(View v)
447 288
    {
448
    fchromaL = ((int)(100*fchromaL))/100.0f;
449
    fchromaR = (float)((int)fchromaR);
450
    fchromaG = (float)((int)fchromaG);
451
    fchromaB = (float)((int)fchromaB);
452

  
453
    textChroma.setText("chroma("+fchromaL+"( "+fchromaR+" , "+fchromaG+" , "+fchromaB+" )");
289
    removeAllViews();
454 290
    }
455 291

  
456 292
///////////////////////////////////////////////////////////////////////////////////////////////////
457 293

  
458
  private void computeAlpha()
294
  public void newChroma(View v)
459 295
    {
460
    Fragment3DSurfaceView view = (Fragment3DSurfaceView)findViewById(R.id.fragment3dSurfaceView);
461

  
462
    falphaL = alphaL/100.0f;
463

  
464
    view.getRenderer().setAlpha(falphaL);
296
    addView(EffectNames.CHROMA);
465 297
    }
466 298

  
467 299
///////////////////////////////////////////////////////////////////////////////////////////////////
468 300

  
469
  private void setAlphaText()
301
  public void newAlpha(View v)
470 302
    {
471
    falphaL = ((int)(100*falphaL))/100.0f;
472

  
473
    textAlpha.setText("alpha("+falphaL+")");
303
    addView(EffectNames.ALPHA);
474 304
    }
475 305

  
476 306
///////////////////////////////////////////////////////////////////////////////////////////////////
477 307

  
478
  private void computeBrightness()
308
  public void newBrightness(View v)
479 309
    {
480
    Fragment3DSurfaceView view = (Fragment3DSurfaceView)findViewById(R.id.fragment3dSurfaceView);
481

  
482
    fbrightnessL = brightnessL/100.0f;
483

  
484
    view.getRenderer().setBrightness( fbrightnessL );
310
    addView(EffectNames.BRIGHTNESS);
485 311
    }
486 312

  
487 313
///////////////////////////////////////////////////////////////////////////////////////////////////
488 314

  
489
  private void setBrightnessText()
315
  public void newSaturation(View v)
490 316
    {
491
    fbrightnessL = ((int)(100*fbrightnessL))/100.0f;
492

  
493
    textBrightness.setText("brightness("+fbrightnessL+")");
317
    addView(EffectNames.SATURATION);
494 318
    }
495 319

  
496 320
///////////////////////////////////////////////////////////////////////////////////////////////////
497 321

  
498
  private void computeSaturation()
499
    {
500
    Fragment3DSurfaceView view = (Fragment3DSurfaceView)findViewById(R.id.fragment3dSurfaceView);
501

  
502
    fsaturationL = saturationL/100.0f;
503

  
504
    view.getRenderer().setSaturation( fsaturationL );
505
    }
506
    
507
///////////////////////////////////////////////////////////////////////////////////////////////////
508

  
509
  private void setSaturationText()
322
  public DistortedBitmap getCenter()
510 323
    {
511
    fsaturationL = ((int)(100*fsaturationL))/100.0f;
512

  
513
    textSaturation.setText("saturation("+fsaturationL+")");
324
    return mCenter;
514 325
    }
515 326

  
516 327
///////////////////////////////////////////////////////////////////////////////////////////////////
517 328

  
518
  private void computeCenter()
329
  public void setCenter(DistortedBitmap center  )
519 330
    {
520
    Fragment3DSurfaceView view = (Fragment3DSurfaceView)findViewById(R.id.fragment3dSurfaceView);
521

  
522
    fcenterX = centerX;
523
    fcenterY = centerY;
524

  
525
    view.getRenderer().setCenter( fcenterX, fcenterY );
526
    }
527

  
528
///////////////////////////////////////////////////////////////////////////////////////////////////
529

  
530
  private void setCenterText()
531
    {
532
    fcenterX = ((int)(100*fcenterX))/100.0f;
533
    fcenterY = ((int)(100*fcenterY))/100.0f;
534

  
535
    textCenter.setText("center("+fcenterX+","+fcenterY+")");
536
    }
537

  
538
///////////////////////////////////////////////////////////////////////////////////////////////////
539

  
540
  public float getCenterX()
541
    {
542
    return fcenterX;
543
    }
544

  
545
///////////////////////////////////////////////////////////////////////////////////////////////////
546

  
547
  public float getCenterY()
548
    {
549
    return fcenterY;
331
    mCenter = center;
550 332
    }
551 333

  
552 334
///////////////////////////////////////////////////////////////////////////////////////////////////
......
592 374
    Distorted.onDestroy();
593 375
    super.onDestroy();
594 376
    }
595
    
596
///////////////////////////////////////////////////////////////////////////////////////////////////
597
    
598
  public void onProgressChanged(SeekBar bar, int progress, boolean fromUser)
599
    {
600
    switch (bar.getId())
601
      {
602
      case R.id.fragment3dcenterX       : centerX    = progress; computeCenter()    ; setCenterText()    ; break;
603
      case R.id.fragment3dcenterY       : centerY    = progress; computeCenter()    ; setCenterText()    ; break;
604
      case R.id.fragment3dchromaBar1    : chromaL    = progress; computeChroma()    ; setChromaText()    ; break;
605
      case R.id.fragment3dchromaBar2    : chromaR    = progress; computeChroma()    ; setChromaText()    ; break;
606
      case R.id.fragment3dchromaBar3    : chromaG    = progress; computeChroma()    ; setChromaText()    ; break;
607
      case R.id.fragment3dchromaBar4    : chromaB    = progress; computeChroma()    ; setChromaText()    ; break;
608
      case R.id.fragment3dalphaBar1     : alphaL     = progress; computeAlpha()     ; setAlphaText()     ; break;
609
      case R.id.fragment3dbrightnessBar1: brightnessL= progress; computeBrightness(); setBrightnessText(); break;
610
      case R.id.fragment3dsaturationBar1: saturationL= progress; computeSaturation(); setSaturationText(); break;
611
      }
612
    }
613

  
614
///////////////////////////////////////////////////////////////////////////////////////////////////
615

  
616
  public void onStartTrackingTouch(SeekBar bar) { }
617
    
618
///////////////////////////////////////////////////////////////////////////////////////////////////
619

  
620
  public void onStopTrackingTouch(SeekBar bar)  { }
621 377
  }
src/main/java/org/distorted/examples/fragment3d/Fragment3DEffect.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2016 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Distorted.                                                               //
5
//                                                                                               //
6
// Distorted is free software: you can redistribute it and/or modify                             //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Distorted is distributed in the hope that it will be useful,                                  //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

  
20
package org.distorted.examples.fragment3d;
21

  
22
import android.widget.LinearLayout;
23
import android.widget.SeekBar;
24
import android.widget.TextView;
25

  
26
import org.distorted.library.DistortedBitmap;
27
import org.distorted.library.EffectNames;
28

  
29
///////////////////////////////////////////////////////////////////////////////////////////////////
30

  
31
public class Fragment3DEffect implements SeekBar.OnSeekBarChangeListener
32

  
33
  {
34
  private static Fragment3DActivity activity;
35

  
36
  private EffectNames name;
37
  private float inter1, inter2, inter3, inter4;
38
  private float regX, regY, regRX, regRY;
39

  
40
  private TextView textEffect, textCenter;
41
  private SeekBar[] mSpinRegion;
42
  private SeekBar[] mSpinInter;
43

  
44
  private DistortedBitmap mRegion;
45

  
46
///////////////////////////////////////////////////////////////////////////////////////////////////
47

  
48
  public static void setActivity(Fragment3DActivity act)
49
    {
50
    activity = act;
51
    }
52

  
53
///////////////////////////////////////////////////////////////////////////////////////////////////
54

  
55
  public Fragment3DEffect(EffectNames name)
56
    {
57
    this.name = name;
58
    mSpinInter = new SeekBar[name.getDimension()];
59
    mSpinRegion= new SeekBar[4];
60
    }
61

  
62
///////////////////////////////////////////////////////////////////////////////////////////////////
63

  
64
  public void addView(LinearLayout layout)
65
    {
66

  
67
    }
68

  
69
///////////////////////////////////////////////////////////////////////////////////////////////////
70

  
71
  private void setBar(int id, int value)
72
    {
73
    SeekBar bar = (SeekBar)activity.findViewById(id);
74
    bar.setOnSeekBarChangeListener(this);
75
    bar.setProgress(value);
76
    }
77

  
78
///////////////////////////////////////////////////////////////////////////////////////////////////
79

  
80
  public void onProgressChanged(SeekBar bar, int progress, boolean fromUser)
81
    {
82
    switch (bar.getId())
83
      {
84
      // TODO
85
      }
86
    }
87

  
88
///////////////////////////////////////////////////////////////////////////////////////////////////
89

  
90
  public void onStartTrackingTouch(SeekBar bar) { }
91

  
92
///////////////////////////////////////////////////////////////////////////////////////////////////
93

  
94
  public void onStopTrackingTouch(SeekBar bar)  { }
95
  }
src/main/java/org/distorted/examples/fragment3d/Fragment3DRenderer.java
61 61

  
62 62
    private DynamicQuat mQuatInt1, mQuatInt2;
63 63

  
64
    private EffectNames[] order;
65

  
66
    private Dynamic2D mCenterInter;
67
    private Dynamic3D mChromaInter, mMoveInter;
68
    private Dynamic1D mChromaLevelInter, mAlphaInter, mBrightnessInter, mSaturationInter;
69

  
70
    private Static2D mCenterPoint;
71
    private Static3D mChromaPoint, mMovePoint;
72
    private Static1D mChromaLevel, mAlphaPoint, mBrightnessPoint, mSaturationPoint;
73

  
74 64
    Static4D mQuat1, mQuat2;
75 65
    int mScreenMin;
76 66

  
77
///////////////////////////////////////////////////////////////////////////////////////////////////
78

  
79
    public void setChroma(float level, float r, float g, float b)
80
      {
81
      mChromaLevel.set(level);
82
      mChromaPoint.set(r, g, b);
83
      }
84
    
85
///////////////////////////////////////////////////////////////////////////////////////////////////
86

  
87
    public void setAlpha(float level)
88
      {
89
      mAlphaPoint.set(level);
90
      }
91
     
92
///////////////////////////////////////////////////////////////////////////////////////////////////
93

  
94
    public void setBrightness(float level)
95
      {
96
      mBrightnessPoint.set(level);
97
      }
98
    
99
///////////////////////////////////////////////////////////////////////////////////////////////////
100

  
101
    public void setSaturation(float level)
102
      {
103
      mSaturationPoint.set(level);
104
      }
105

  
106
///////////////////////////////////////////////////////////////////////////////////////////////////
107

  
108
    public void setCenter(float x, float y)
109
      {
110
      x = (0.012f*x-0.1f)*mObjWidth;
111
      y = (0.012f*y-0.1f)*mObjHeight;
112

  
113
      mCenterPoint.set(x,y);
114
      mMovePoint.set(mFactorObj*x,mFactorObj*y,0);
115
      }
116

  
117
///////////////////////////////////////////////////////////////////////////////////////////////////
118

  
119
    public void setOrder(EffectNames[] effects)
120
      {
121
      order = effects;
122
      setFragmentEffects();
123
      }
124
      
125
///////////////////////////////////////////////////////////////////////////////////////////////////
126

  
127
    private void setFragmentEffects()
128
      {
129
      mObject.abortEffects(EffectTypes.FRAGMENT);
130

  
131
      for( int i=0; i<=order.length-1 ; i++ )
132
        {
133
        switch(order[i])
134
          {
135
          case CHROMA    : mObject.chroma    ( mChromaLevelInter , mChromaInter) ; break;
136
          case ALPHA     : mObject.alpha     ( mAlphaInter                     ) ; break;
137
          case BRIGHTNESS: mObject.brightness( mBrightnessInter                ) ; break;
138
          case SATURATION: mObject.saturation( mSaturationInter                ) ; break;
139
          }
140
        }
141
      }
142
    
143 67
///////////////////////////////////////////////////////////////////////////////////////////////////
144 68

  
145 69
    public Fragment3DRenderer(GLSurfaceView v)
......
147 71
      mView = v;
148 72

  
149 73
      mObject = ((Fragment3DActivity)v.getContext()).getObject();
150
      mCenter = new DistortedBitmap(SIZE, SIZE, 1);
151 74

  
152 75
      mObjWidth = mObject.getWidth();
153 76
      mObjHeight= mObject.getHeight();
154 77

  
155
      mCenterPoint    = new Static2D(0,0);
156
      mMovePoint      = new Static3D(0,0,0);
157
      mChromaPoint    = new Static3D(0,0,0);
158
      mChromaLevel    = new Static1D(0);
159
      mAlphaPoint     = new Static1D(1);
160
      mBrightnessPoint= new Static1D(1);
161
      mSaturationPoint= new Static1D(0.5f);
162

  
163
      mCenterInter     = new Dynamic2D();
164
      mMoveInter       = new Dynamic3D();
165
      mChromaInter     = new Dynamic3D();
166
      mChromaLevelInter= new Dynamic1D();
167
      mAlphaInter      = new Dynamic1D();
168
      mBrightnessInter = new Dynamic1D();
169
      mSaturationInter = new Dynamic1D();
170

  
171
      mCenterInter.add(mCenterPoint);
172
      mMoveInter.add(mMovePoint);
173
      mChromaInter.add(mChromaPoint);
174
      mChromaLevelInter.add(mChromaLevel);
175
      mAlphaInter.add(mAlphaPoint);
176
      mBrightnessInter.add(mBrightnessPoint);
177
      mSaturationInter.add(mSaturationPoint);
178

  
179 78
      mQuat1 = new Static4D(0,0,0,1);  // unity
180 79
      mQuat2 = new Static4D(0,0,0,1);  // quaternions
181 80

  
......
196 95
      long time = System.currentTimeMillis();
197 96

  
198 97
      mObject.draw(time);
98

  
99
      mCenter = mView.
100

  
199 101
      mCenter.draw(time);
200 102
      }
201 103

  
......
221 123
        mFactorCen = (0.15f*width)/centerSize;
222 124
        }
223 125

  
126

  
127
      Static3D rotateObj = new Static3D(mObjWidth/2,mObjHeight/2, 0);
128

  
129
      mObject.move( new Static3D( (width-mFactorObj*mObjWidth)/2 , (height-mFactorObj*mObjHeight)/2 , 0) );
130
      mObject.scale(mFactorObj);
131
      mObject.quaternion(mQuatInt1, rotateObj);
132
      mObject.quaternion(mQuatInt2, rotateObj);
133

  
224 134
      Fragment3DActivity act = (Fragment3DActivity)mView.getContext();
225 135
      float cX = act.getCenterX();
226 136
      float cY = act.getCenterY();
......
230 140

  
231 141
      mMovePoint.set(cX*mFactorObj,cY*mFactorObj,0);
232 142

  
233
      Static3D rotateObj = new Static3D(mObjWidth/2,mObjHeight/2, 0);
234

  
235
      mObject.move( new Static3D( (width-mFactorObj*mObjWidth)/2 , (height-mFactorObj*mObjHeight)/2 , 0) );
236
      mObject.scale(mFactorObj);
237
      mObject.quaternion(mQuatInt1, rotateObj);
238
      mObject.quaternion(mQuatInt2, rotateObj);
239

  
240 143
      Static3D rotateCen = new Static3D(width/2,height/2, 0);
241 144

  
242 145
      mCenter.quaternion(mQuatInt1, rotateCen);
src/main/res/layout/fragment3dlayout.xml
13 13
    <LinearLayout
14 14
        android:orientation="horizontal"
15 15
        android:layout_width="match_parent"
16
        android:layout_height="wrap_content"
17
        android:layout_marginBottom="5dp"
18
        android:background="@android:color/holo_green_dark">
16
        android:layout_height="50dp">
19 17

  
20
        <LinearLayout
21
            android:orientation="vertical"
22
            android:layout_width="0dp"
23
            android:layout_height="match_parent"
24
            android:layout_weight="0.8">
25

  
26
            <TextView
27
                android:id="@+id/fragment3dcenterText"
28
                android:layout_width="wrap_content"
29
                android:layout_height="wrap_content"
30
                android:layout_marginEnd="5dp"
31
                android:layout_marginStart="5dp"
32
                android:layout_marginTop="3dp"
33
                />
34

  
35
            <LinearLayout
36
                android:orientation="horizontal"
37
                android:layout_width="match_parent"
38
                android:layout_height="match_parent"
39
                >
18
        <Button
19
            android:layout_width="wrap_content"
20
            android:layout_height="wrap_content"
21
            android:text="@string/chroma"
22
            android:id="@+id/newChroma"
23
            android:onClick="newChroma"/>
40 24

  
41
                <SeekBar
42
                    android:layout_width="fill_parent"
43
                    android:layout_height="wrap_content"
44
                    android:id="@+id/fragment3dcenterX"
45
                    android:layout_weight="0.5"
46
                    android:paddingLeft="5dp"
47
                    android:paddingRight="3dp"/>
25
        <Button
26
            android:layout_width="wrap_content"
27
            android:layout_height="wrap_content"
28
            android:text="@string/alpha"
29
            android:id="@+id/newAlpha"
30
            android:onClick="newAlpha"/>
48 31

  
49
                <SeekBar
50
                    android:layout_width="fill_parent"
51
                    android:layout_height="wrap_content"
52
                    android:id="@+id/fragment3dcenterY"
53
                    android:layout_weight="0.5"
54
                    android:paddingLeft="3dp"
55
                    android:paddingRight="5dp"/>
56
            </LinearLayout>
32
        <Button
33
            android:layout_width="wrap_content"
34
            android:layout_height="wrap_content"
35
            android:text="@string/brightness"
36
            android:id="@+id/newBrigthness"
37
            android:onClick="newBrightness"/>
57 38

  
58
        </LinearLayout>
39
        <Button
40
            android:layout_width="wrap_content"
41
            android:layout_height="wrap_content"
42
            android:text="@string/saturation"
43
            android:id="@+id/newSaturation"
44
            android:onClick="newSaturation"/>
59 45

  
60 46
        <Button
61 47
            android:id="@+id/buttonDefault"
62
            android:layout_width="60dp"
48
            android:layout_width="fill_parent"
63 49
            android:layout_height="wrap_content"
64
            android:onClick="Default"
65
            android:text="@string/reset"
50
            android:onClick="Remove"
51
            android:text="@string/removebut"
66 52
            android:layout_gravity="right"
67 53
            android:layout_marginTop="3dp"/>
68 54
    </LinearLayout>
src/main/res/values/strings.xml
3 3
    <string name="app_name">Distorted Examples</string>
4 4
    <string name="tocHeader">Welcome to the Distorted Examples!\nCode, Tutorials, Wiki: http://distorted.org/</string>
5 5
    
6
    <string name="continu">Continue</string>
7
    <string name="rows">Rows</string>
8
    <string name="cols">Cols</string>
9 6
    <string name="distort">Distort</string>
10 7
    <string name="deform">Deform</string>
11 8
    <string name="shear">Shear</string>
9
    <string name="sink">Sink</string>
10
    <string name="alpha">Alpha</string>
11
    <string name="macroblock">Macro</string>
12
    <string name="chroma">Chroma</string>
13
    <string name="brightness">Brightness</string>
14
    <string name="saturation">Saturation</string>
15
    <string name="contrast">Contrast</string>
16

  
17
    <string name="continu">Continue</string>
18
    <string name="rows">Rows</string>
19
    <string name="cols">Cols</string>
12 20
    <string name="path">Path</string>
13 21
    <string name="loop">Loop</string>
14 22
    <string name="jump">Jump</string>
15 23
    <string name="duration">Duration</string>
16 24
    <string name="reset">Reset</string>
17 25
    <string name="bubble">Bubble</string>
18
    <string name="sink">Sink</string>
19
    <string name="transparency">Trans</string>
20
    <string name="macroblock">Macro</string>
21
    <string name="chroma">Chroma</string>
22 26
    <string name="add">Touch screen to add new</string>
23 27
    <string name="remove">Remove existing effect(s) by</string>
24 28
    <string name="removebut">Remove</string>

Also available in: Unified diff