Project

General

Profile

« Previous | Next » 

Revision f9afbbf3

Added by Leszek Koltunski almost 8 years ago

Upgrade what used to be the 'Scratchpad' app; step 2: reorganize layout

View differences:

src/main/java/org/distorted/examples/effects2d/Effects2DSurfaceView.java
46 46
  private static Static2D point;
47 47

  
48 48
  private static Static4D mRegion;
49
  private static Dynamic1D mInterA, mInterM, mInterB, mInterS;
49
  private static Dynamic1D mInterA, mInterM, mInterC, mInterS;
50 50

  
51 51
  private static Dynamic3D mInterD;
52 52
  private static Static3D v0, v1, v2, v3;
53
     
53

  
54
  private final static Static3D mRED = new Static3D(1,0,0);
55

  
54 56
///////////////////////////////////////////////////////////////////////////////////////////////////
55 57
    
56 58
  public Effects2DSurfaceView(Context c, AttributeSet attrs)
......
83 85
    mInterS.add(new Static1D(1.0f));
84 86
    mInterS.add(new Static1D(0.3f));
85 87

  
86
    mInterB = new Dynamic1D(mDuration,mCount);
87
    mInterB.add(new Static1D(1));
88
    mInterB.add(new Static1D(0));
88
    mInterC = new Dynamic1D(mDuration,mCount);
89
    mInterC.add(new Static1D(1));
90
    mInterC.add(new Static1D(0));
89 91

  
90 92
    mInterM = new Dynamic1D(mDuration,mCount);
91 93
    mInterM.add(new Static1D(1));
......
122 124
    mScrH = height;
123 125
    }
124 126

  
125
///////////////////////////////////////////////////////////////////////////////////////////////////
126

  
127
  public static int getEffect()
128
    {
129
    return mCurrentEffect;
130
    }
131
   
132 127
///////////////////////////////////////////////////////////////////////////////////////////////////
133 128

  
134 129
  public static void setEffect(int effect)
......
136 131
    mCurrentEffect = effect;
137 132
    }
138 133

  
139
///////////////////////////////////////////////////////////////////////////////////////////////////
140

  
141
  public static void setDuration(int duration)
142
    {
143
    mDuration = duration;
144
    mInterD.setDuration(duration);
145
    mInterA.setDuration(duration);
146
    mInterB.setDuration(duration);
147
    mInterM.setDuration(duration);
148
    mInterS.setDuration(duration);
149
    }
150

  
151
///////////////////////////////////////////////////////////////////////////////////////////////////
152

  
153
  public static void setCount(float count)
154
    {
155
    mCount = count;
156
    mInterD.setCount(count);
157
    mInterA.setCount(count);
158
    mInterB.setCount(count);
159
    mInterM.setCount(count);
160
    mInterS.setCount(count);
161
    }
162
  
163 134
///////////////////////////////////////////////////////////////////////////////////////////////////
164 135
    
165 136
  @Override public boolean onTouchEvent(MotionEvent event) 
......
184 155
                                           break;  
185 156
                                      case 3: Effects2DRenderer.mBackground.macroblock(mInterM, mRegion);
186 157
                                           break;
187
                                      case 4: Effects2DRenderer.mBackground.brightness(mInterB, mRegion, false);
158
                                      case 4: Effects2DRenderer.mBackground.chroma(mInterC, mRED, mRegion, false);
188 159
                                           break;      
189 160
                                      }
190 161
                                    break;

Also available in: Unified diff