Project

General

Profile

« Previous | Next » 

Revision fa9053f5

Added by Leszek Koltunski about 8 years ago

Progress with Effects3D

View differences:

src/main/java/org/distorted/examples/effects3d/Effects3DActivity.java
540 540

  
541 541
  public void remove(View v)
542 542
    {
543
    android.util.Log.e("effects3D", "removing!");
543
    //android.util.Log.e("effects3D", "removing!");
544

  
545
    int numEffects = mEffects.size();
546
    Effects3DEffect effect;
547

  
548
    for(int i=0; i<numEffects; i++)
549
      {
550
      effect = mEffects.get(i);
551

  
552
      if( effect.thisView(v) )
553
        {
554
        android.util.Log.e("effects3D", "effect: "+i);
555
        }
556
      }
544 557
    }
545 558

  
546 559
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/effects3d/Effects3DEffect.java
67 67
  private Dynamic2D mCenterDyn;
68 68
  private Static2D  mCenterSta;
69 69

  
70
  private View mButton;
71
  private long mId;
72

  
70 73
///////////////////////////////////////////////////////////////////////////////////////////////////
71 74
// requires knowledge about effect nature
72 75

  
......
93 96
    {
94 97
    switch(mName)
95 98
      {
96
      case DISTORT: object.distort(mDyn3, mCenterDyn, mRegionDyn); break;
97
      case DEFORM : object.deform (mDyn3, mCenterDyn            ); break;
98
      case SINK   : object.sink   (mDyn1, mCenterDyn, mRegionDyn); break;
99
      case SWIRL  : object.swirl  (mDyn1, mCenterDyn, mRegionDyn); break;
100
      case WAVE   : object.wave   (mDyn5, mCenterDyn, mRegionDyn); break;
101

  
102
      case ALPHA            : object.alpha     (mDyn1,        mRegionDyn, false); break;
103
      case SMOOTH_ALPHA     : object.alpha     (mDyn1,        mRegionDyn, true ); break;
104
      case CHROMA           : object.chroma    (mDyn1, mDyn3, mRegionDyn, false); break;
105
      case SMOOTH_CHROMA    : object.chroma    (mDyn1, mDyn3, mRegionDyn, true ); break;
106
      case BRIGHTNESS       : object.brightness(mDyn1,        mRegionDyn, false); break;
107
      case SMOOTH_BRIGHTNESS: object.brightness(mDyn1,        mRegionDyn, true ); break;
108
      case SATURATION       : object.saturation(mDyn1,        mRegionDyn, false); break;
109
      case SMOOTH_SATURATION: object.saturation(mDyn1,        mRegionDyn, true ); break;
110
      case CONTRAST         : object.contrast  (mDyn1,        mRegionDyn, false); break;
111
      case SMOOTH_CONTRAST  : object.contrast  (mDyn1,        mRegionDyn, true ); break;
99
      case DISTORT: mId = object.distort(mDyn3, mCenterDyn, mRegionDyn); break;
100
      case DEFORM : mId = object.deform (mDyn3, mCenterDyn            ); break;
101
      case SINK   : mId = object.sink   (mDyn1, mCenterDyn, mRegionDyn); break;
102
      case SWIRL  : mId = object.swirl  (mDyn1, mCenterDyn, mRegionDyn); break;
103
      case WAVE   : mId = object.wave   (mDyn5, mCenterDyn, mRegionDyn); break;
104

  
105
      case ALPHA            : mId = object.alpha     (mDyn1,        mRegionDyn, false); break;
106
      case SMOOTH_ALPHA     : mId = object.alpha     (mDyn1,        mRegionDyn, true ); break;
107
      case CHROMA           : mId = object.chroma    (mDyn1, mDyn3, mRegionDyn, false); break;
108
      case SMOOTH_CHROMA    : mId = object.chroma    (mDyn1, mDyn3, mRegionDyn, true ); break;
109
      case BRIGHTNESS       : mId = object.brightness(mDyn1,        mRegionDyn, false); break;
110
      case SMOOTH_BRIGHTNESS: mId = object.brightness(mDyn1,        mRegionDyn, true ); break;
111
      case SATURATION       : mId = object.saturation(mDyn1,        mRegionDyn, false); break;
112
      case SMOOTH_SATURATION: mId = object.saturation(mDyn1,        mRegionDyn, true ); break;
113
      case CONTRAST         : mId = object.contrast  (mDyn1,        mRegionDyn, false); break;
114
      case SMOOTH_CONTRAST  : mId = object.contrast  (mDyn1,        mRegionDyn, true ); break;
115

  
116
      default: mId = -1;
112 117
      }
113 118
    }
114 119

  
......
381 386
               mText      = (TextView)effect.findViewById(R.id.effect1dText);
382 387
               seek[0]    = (SeekBar)effect.findViewById(R.id.effect1dbar1);
383 388
               mSeekID[0] = seek[0].getId();
389
               mButton    = effect.findViewById(R.id.button1dRemove);
384 390
               break;
385 391
      case 2 : effect     = act.getLayoutInflater().inflate(R.layout.effect2d, null);
386 392
               mText      = (TextView)effect.findViewById(R.id.effect2dText);
......
388 394
               seek[1]    = (SeekBar)effect.findViewById(R.id.effect2dbar2);
389 395
               mSeekID[0] = seek[0].getId();
390 396
               mSeekID[1] = seek[1].getId();
397
               mButton    = effect.findViewById(R.id.button2dRemove);
391 398
               break;
392 399
      case 3 : effect     = act.getLayoutInflater().inflate(R.layout.effect3d, null);
393 400
               mText      = (TextView)effect.findViewById(R.id.effect3dText);
......
397 404
               mSeekID[0] = seek[0].getId();
398 405
               mSeekID[1] = seek[1].getId();
399 406
               mSeekID[2] = seek[2].getId();
407
               mButton    = effect.findViewById(R.id.button3dRemove);
400 408
               break;
401 409
      case 4 : effect     = act.getLayoutInflater().inflate(R.layout.effect4d, null);
402 410
               mText      = (TextView)effect.findViewById(R.id.effect4dText);
......
408 416
               mSeekID[1] = seek[1].getId();
409 417
               mSeekID[2] = seek[2].getId();
410 418
               mSeekID[3] = seek[3].getId();
419
               mButton    = effect.findViewById(R.id.button4dRemove);
411 420
               break;
412 421
      case 5 : effect     = act.getLayoutInflater().inflate(R.layout.effect5d, null);
413 422
               mText      = (TextView)effect.findViewById(R.id.effect5dText);
......
421 430
               mSeekID[2] = seek[2].getId();
422 431
               mSeekID[3] = seek[3].getId();
423 432
               mSeekID[4] = seek[4].getId();
433
               mButton    = effect.findViewById(R.id.button5dRemove);
424 434
               break;
425 435
      default: android.util.Log.e("Effects3DEffect", "dimension "+mDimension+" not supported!");
426 436
               return null;
......
591 601
      }
592 602
    }
593 603

  
604
///////////////////////////////////////////////////////////////////////////////////////////////////
605

  
606
  public boolean thisView(View v)
607
    {
608
    return v==mButton;
609
    }
610

  
594 611
///////////////////////////////////////////////////////////////////////////////////////////////////
595 612

  
596 613
  public void onStartTrackingTouch(SeekBar bar) { }
src/main/res/layout/effect1d.xml
24 24
                    android:text="@string/removebut"
25 25
                    android:layout_width="wrap_content"
26 26
                    android:layout_height="wrap_content"
27
                    android:id="@+id/button"
27
                    android:id="@+id/button1dRemove"
28 28
                    android:layout_weight="0.2"
29 29
                    android:layout_marginTop="3dp"
30 30
                    android:onClick="remove"/>
src/main/res/layout/effect2d.xml
24 24
                    android:text="@string/removebut"
25 25
                    android:layout_width="wrap_content"
26 26
                    android:layout_height="wrap_content"
27
                    android:id="@+id/button"
27
                    android:id="@+id/button2dRemove"
28 28
                    android:layout_weight="0.2"
29 29
                    android:layout_marginTop="3dp"
30 30
                    android:onClick="remove"/>
src/main/res/layout/effect3d.xml
24 24
                    android:text="@string/removebut"
25 25
                    android:layout_width="wrap_content"
26 26
                    android:layout_height="wrap_content"
27
                    android:id="@+id/button"
27
                    android:id="@+id/button3dRemove"
28 28
                    android:layout_weight="0.2"
29 29
                    android:layout_marginTop="3dp"
30 30
                    android:onClick="remove"/>
src/main/res/layout/effect4d.xml
24 24
                    android:text="@string/removebut"
25 25
                    android:layout_width="wrap_content"
26 26
                    android:layout_height="wrap_content"
27
                    android:id="@+id/button"
27
                    android:id="@+id/button4dRemove"
28 28
                    android:layout_weight="0.2"
29 29
                    android:layout_marginTop="3dp"
30 30
                    android:onClick="remove"/>
src/main/res/layout/effect5d.xml
24 24
                    android:text="@string/removebut"
25 25
                    android:layout_width="wrap_content"
26 26
                    android:layout_height="wrap_content"
27
                    android:id="@+id/button"
27
                    android:id="@+id/button5dRemove"
28 28
                    android:layout_weight="0.2"
29 29
                    android:layout_marginTop="3dp"
30 30
                    android:onClick="remove"/>

Also available in: Unified diff