commit e54245235bcc71dd9a789e15141ea91f04307114
Author: Leszek Koltunski <leszek@distoretedandroid.org>
Date:   Mon Jun 20 13:09:25 2016 +0100

    Upgrade what used to be the 'Scratchpad' app; step 1: rename.

diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml
index ad63d79..d9218d1 100644
--- a/src/main/AndroidManifest.xml
+++ b/src/main/AndroidManifest.xml
@@ -27,7 +27,7 @@
         <activity android:name=".movingeffects.MovingEffectsActivity" />    
         <activity android:name=".differenteffects.DifferentEffectsActivity" />    
         <activity android:name=".differentbitmaps.DifferentBitmapsActivity" />    
-        <activity android:name=".scratchpad.ScratchpadActivity" />    
+        <activity android:name=".effects2d.Effects2DActivity" />
         <activity android:name=".check.CheckActivity" />    
         <activity android:name=".fbo.FBOActivity" />    
         <activity android:name=".starwars.StarWarsActivity" />      
diff --git a/src/main/java/org/distorted/examples/TableOfContents.java b/src/main/java/org/distorted/examples/TableOfContents.java
index 5ef20e3..1b0209c 100644
--- a/src/main/java/org/distorted/examples/TableOfContents.java
+++ b/src/main/java/org/distorted/examples/TableOfContents.java
@@ -46,7 +46,7 @@ import org.distorted.examples.movingeffects.MovingEffectsActivity;
 import org.distorted.examples.olimpic.OlimpicActivity;
 import org.distorted.examples.differenteffects.DifferentEffectsActivity;
 import org.distorted.examples.differentbitmaps.DifferentBitmapsActivity;
-import org.distorted.examples.scratchpad.ScratchpadActivity;
+import org.distorted.examples.effects2d.Effects2DActivity;
 import org.distorted.examples.check.CheckActivity;
 import org.distorted.examples.bean.BeanActivity;
 import org.distorted.examples.fbo.FBOActivity;
@@ -189,11 +189,11 @@ public class TableOfContents extends ListActivity
    
    {
       final Map<String, Object> item = new HashMap<>();
-      item.put(ITEM_IMAGE, R.drawable.icon_example_scratchpad);
-      item.put(ITEM_TITLE, (i+1)+". "+getText(R.string.example_scratchpad));
-      item.put(ITEM_SUBTITLE, getText(R.string.example_scratchpad_subtitle));
+      item.put(ITEM_IMAGE, R.drawable.icon_example_effects2d);
+      item.put(ITEM_TITLE, (i+1)+". "+getText(R.string.example_effects2d));
+      item.put(ITEM_SUBTITLE, getText(R.string.example_effects2d_subtitle));
       data.add(item);
-      activityMapping.put(i++, ScratchpadActivity.class);
+      activityMapping.put(i++, Effects2DActivity.class);
    }
    
    {
diff --git a/src/main/java/org/distorted/examples/effects2d/Effects2DActivity.java b/src/main/java/org/distorted/examples/effects2d/Effects2DActivity.java
new file mode 100644
index 0000000..43972e5
--- /dev/null
+++ b/src/main/java/org/distorted/examples/effects2d/Effects2DActivity.java
@@ -0,0 +1,196 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Copyright 2016 Leszek Koltunski                                                               //
+//                                                                                               //
+// This file is part of Distorted.                                                               //
+//                                                                                               //
+// Distorted is free software: you can redistribute it and/or modify                             //
+// it under the terms of the GNU General Public License as published by                          //
+// the Free Software Foundation, either version 2 of the License, or                             //
+// (at your option) any later version.                                                           //
+//                                                                                               //
+// Distorted is distributed in the hope that it will be useful,                                  //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
+// GNU General Public License for more details.                                                  //
+//                                                                                               //
+// You should have received a copy of the GNU General Public License                             //
+// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+package org.distorted.examples.effects2d;
+
+import org.distorted.library.Distorted;
+import org.distorted.examples.R;
+
+import android.app.Activity;
+import android.opengl.GLSurfaceView;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.SeekBar.OnSeekBarChangeListener;
+import android.widget.SeekBar;
+import android.widget.TextView;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+public class Effects2DActivity extends Activity implements OnSeekBarChangeListener
+  {
+  private static final float D_MULT=200.0f;
+  private static final float C_MULT=  0.1f;
+   
+  private long effectID;
+   
+  private SeekBar barD, barC, barI;
+  private TextView textD, textC, textI;
+   
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  @Override
+  protected void onCreate(Bundle savedInstanceState) 
+    {
+    super.onCreate(savedInstanceState);
+ 
+    setContentView(R.layout.scratchpadlayout);
+      
+    barD = (SeekBar)findViewById(R.id.scratchpadSeekDuration);
+    barD.setOnSeekBarChangeListener(this); 
+    barC = (SeekBar)findViewById(R.id.scratchpadSeekCount);
+    barC.setOnSeekBarChangeListener(this); 
+    barI = (SeekBar)findViewById(R.id.scratchpadSeekID);
+    barI.setOnSeekBarChangeListener(this); 
+        
+    textD = (TextView)findViewById(R.id.scratchpadTextDuration);
+    textC = (TextView)findViewById(R.id.scratchpadTextCount);
+    textI = (TextView)findViewById(R.id.scratchpadTextID);
+      
+    barD.setProgress(100);
+    barC.setProgress(10);
+    barI.setProgress(0);
+      
+    textD.setText("Dur: 20 s");
+    textC.setText("Cou: 1.0");
+    textI.setText("ID: 0");
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  @Override
+  protected void onResume() 
+    {
+    super.onResume();
+      
+    GLSurfaceView mView = (GLSurfaceView) this.findViewById(R.id.scratchpadSurfaceView);
+    mView.onResume();
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  @Override
+  protected void onPause() 
+    {
+    GLSurfaceView mView = (GLSurfaceView) this.findViewById(R.id.scratchpadSurfaceView);
+    mView.onPause();
+      
+    super.onPause();
+    }
+    
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  @Override
+  public void onStop()
+    {
+    super.onStop();
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  @Override
+  public void onDestroy()
+    {
+    Distorted.onDestroy();
+    super.onDestroy();
+    }     
+ 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+    
+  public void Distort(View v)
+    {
+    Effects2DSurfaceView.setEffect(0);
+    }     
+    
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public void Sink(View v)
+    {
+    Effects2DSurfaceView.setEffect(1);
+    }       
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+    
+  public void Transparency(View v)
+    {
+    Effects2DSurfaceView.setEffect(2);
+    }     
+    
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public void Macroblock(View v)
+    {
+    Effects2DSurfaceView.setEffect(3);
+    }       
+ 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public void Brightness(View v)
+    {
+    Effects2DSurfaceView.setEffect(4);
+    }       
+     
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public void Print(View v)
+    {
+    Effects2DRenderer.mBackground.printEffect(effectID);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public void Abort(View v)
+    {
+    Effects2DRenderer.mBackground.abortEffect(effectID);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+    
+  public void onProgressChanged(SeekBar bar, int progress, boolean fromUser) 
+    {
+    float v, t; 
+    int i;
+      
+    switch (bar.getId()) 
+      {
+      case R.id.scratchpadSeekDuration: v = progress*D_MULT;
+                                        i = (int)(v/100);
+                                        t = i/10.0f;
+                                        Effects2DSurfaceView.setDuration((int)v);
+                                        textD.setText("Dur: "+(int)t+" s");
+                                        break;
+      case R.id.scratchpadSeekCount   : v = progress*C_MULT;
+                                        i = (int)(v*10);
+                                        t = i/10.0f;
+                                        Effects2DSurfaceView.setCount(v);
+                                        textC.setText("Cou: "+t);
+                                        break;
+      case R.id.scratchpadSeekID      : effectID = progress;
+                                        textI.setText("ID: "+progress);
+                                        break;                        
+      }
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public void onStartTrackingTouch(SeekBar bar) { }
+    
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public void onStopTrackingTouch(SeekBar bar)  { }
+  }
diff --git a/src/main/java/org/distorted/examples/effects2d/Effects2DRenderer.java b/src/main/java/org/distorted/examples/effects2d/Effects2DRenderer.java
new file mode 100644
index 0000000..9cbfc53
--- /dev/null
+++ b/src/main/java/org/distorted/examples/effects2d/Effects2DRenderer.java
@@ -0,0 +1,112 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Copyright 2016 Leszek Koltunski                                                               //
+//                                                                                               //
+// This file is part of Distorted.                                                               //
+//                                                                                               //
+// Distorted is free software: you can redistribute it and/or modify                             //
+// it under the terms of the GNU General Public License as published by                          //
+// the Free Software Foundation, either version 2 of the License, or                             //
+// (at your option) any later version.                                                           //
+//                                                                                               //
+// Distorted is distributed in the hope that it will be useful,                                  //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
+// GNU General Public License for more details.                                                  //
+//                                                                                               //
+// You should have received a copy of the GNU General Public License                             //
+// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+package org.distorted.examples.effects2d;
+
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.opengles.GL10;
+
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.Paint.Style;
+import android.opengl.GLES20;
+import android.opengl.GLSurfaceView;
+
+import org.distorted.library.DistortedBitmap;
+import org.distorted.library.Distorted;
+import org.distorted.library.EffectTypes;
+import org.distorted.library.type.Static3D;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+public class Effects2DRenderer implements GLSurfaceView.Renderer
+  {  
+  public static final int NUMLINES = 10;
+  public static final int BWID = 300;
+  public static final int BHEI = 400;
+   
+  private GLSurfaceView mView;
+  public static DistortedBitmap mBackground;
+  private Paint mPaint;
+  private int texWidth, texHeight;
+    
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public Effects2DRenderer(GLSurfaceView v)
+    {    
+    mPaint = new Paint();
+    mPaint.setAntiAlias(true);
+    mPaint.setFakeBoldText(true);
+    mPaint.setStyle(Style.FILL);
+      
+    mView = v;
+      
+    texWidth = BWID;
+    texHeight= BHEI;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+   
+  public void onSurfaceCreated(GL10 glUnused, EGLConfig config) 
+    {      
+    mBackground = new DistortedBitmap(texWidth,texHeight, 80);
+    Bitmap bitmap = Bitmap.createBitmap(texWidth,texHeight, Bitmap.Config.ARGB_8888);
+    Canvas canvas = new Canvas(bitmap);  
+      
+    mPaint.setColor(0xff008800);
+    canvas.drawRect(0, 0, texWidth, texHeight, mPaint);
+    mPaint.setColor(0xffffffff);
+         
+    for(int i=0; i<=NUMLINES ; i++ )
+      {
+      canvas.drawRect(texWidth*i/NUMLINES - 1,                       0,  texWidth*i/NUMLINES + 1,  texHeight               , mPaint);
+      canvas.drawRect(                      0, texHeight*i/NUMLINES -1,  texWidth               ,  texHeight*i/NUMLINES + 1, mPaint);  
+      }
+          
+    mBackground.setBitmap(bitmap);
+          
+    try
+      {
+      Distorted.onSurfaceCreated(mView.getContext());
+      }
+    catch(Exception ex)
+      {
+      android.util.Log.e("Scratchpad", ex.getMessage() );
+      }
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public void onSurfaceChanged(GL10 glUnused, int width, int height)
+    {
+    mBackground.abortEffects(EffectTypes.MATRIX);
+    mBackground.scale( new Static3D((float)width/texWidth,(float)height/texHeight,1) );
+    Distorted.onSurfaceChanged(width,height);
+    Effects2DSurfaceView.setScreenSize(width,height);
+    }
+   
+///////////////////////////////////////////////////////////////////////////////////////////////////
+   
+  public void onDrawFrame(GL10 glUnused)
+    {   
+    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
+    mBackground.draw(System.currentTimeMillis());
+    }
+  }
diff --git a/src/main/java/org/distorted/examples/effects2d/Effects2DSurfaceView.java b/src/main/java/org/distorted/examples/effects2d/Effects2DSurfaceView.java
new file mode 100644
index 0000000..77f7932
--- /dev/null
+++ b/src/main/java/org/distorted/examples/effects2d/Effects2DSurfaceView.java
@@ -0,0 +1,195 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// Copyright 2016 Leszek Koltunski                                                               //
+//                                                                                               //
+// This file is part of Distorted.                                                               //
+//                                                                                               //
+// Distorted is free software: you can redistribute it and/or modify                             //
+// it under the terms of the GNU General Public License as published by                          //
+// the Free Software Foundation, either version 2 of the License, or                             //
+// (at your option) any later version.                                                           //
+//                                                                                               //
+// Distorted is distributed in the hope that it will be useful,                                  //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
+// GNU General Public License for more details.                                                  //
+//                                                                                               //
+// You should have received a copy of the GNU General Public License                             //
+// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+package org.distorted.examples.effects2d;
+
+import android.content.Context;
+import android.opengl.GLSurfaceView;
+import android.os.Build;
+import android.view.MotionEvent;
+import android.util.AttributeSet;
+
+import org.distorted.library.type.Dynamic1D;
+import org.distorted.library.type.Static1D;
+import org.distorted.library.type.Static2D;
+import org.distorted.library.type.Static3D;
+import org.distorted.library.type.Static4D;
+import org.distorted.library.type.Dynamic3D;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+public class Effects2DSurfaceView extends GLSurfaceView
+  {
+  private Effects2DRenderer mRenderer;
+  private static int mCurrentEffect;
+  private static int mDuration;
+  private static float mCount;
+  private static int mScrW, mScrH;
+    
+  private static Static4D region;
+  private static Static2D point;
+
+  private static Static4D mRegion;
+  private static Dynamic1D mInterA, mInterM, mInterB, mInterS;
+
+  private static Dynamic3D mInterD;
+  private static Static3D v0, v1, v2, v3;
+     
+///////////////////////////////////////////////////////////////////////////////////////////////////
+    
+  public Effects2DSurfaceView(Context c, AttributeSet attrs)
+    {
+    super(c, attrs);
+      
+    mDuration = 10000;
+    mCount    = 1.0f;
+      
+    mInterD = new Dynamic3D(mDuration,mCount);
+
+    int h = 30;
+    int r = 20;
+
+    v0 = new Static3D( 0, r, h );
+    v1 = new Static3D(-r, 0, h );
+    v2 = new Static3D( 0,-r, h );
+    v3 = new Static3D( r, 0, h );
+
+    mInterD.add(v0);
+    mInterD.add(v1);
+    mInterD.add(v2);
+    mInterD.add(v3);
+
+    mInterA = new Dynamic1D(mDuration,mCount);
+    mInterA.add(new Static1D(1));
+    mInterA.add(new Static1D(0));
+
+    mInterS = new Dynamic1D(mDuration,mCount);
+    mInterS.add(new Static1D(1.0f));
+    mInterS.add(new Static1D(0.3f));
+
+    mInterB = new Dynamic1D(mDuration,mCount);
+    mInterB.add(new Static1D(1));
+    mInterB.add(new Static1D(0));
+
+    mInterM = new Dynamic1D(mDuration,mCount);
+    mInterM.add(new Static1D(1));
+    mInterM.add(new Static1D(10));
+
+    if(!isInEditMode())
+      {
+      setFocusable(true);
+      setFocusableInTouchMode(true);
+       
+      setEGLContextClientVersion(2);
+        
+      if( Build.FINGERPRINT.startsWith("generic") ) // when running on the emulator, insert a magic line that is
+        {                                           // supposed to cure the 'no config chosen' crash on emulator startup
+        setEGLConfigChooser(8, 8, 8, 8, 16, 0);   
+        }
+        
+      mRenderer = new Effects2DRenderer(this);
+      setRenderer(mRenderer);
+        
+      point = new Static2D(0,0);
+      region= new Static4D(0,0,60,60);
+      mRegion = new Static4D(0,0,60,60);
+        
+      setEffect(0);  
+      }
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public static void setScreenSize(int width, int height)
+    {
+    mScrW = width;
+    mScrH = height;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public static int getEffect()
+    {
+    return mCurrentEffect;
+    }
+   
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public static void setEffect(int effect)
+    {
+    mCurrentEffect = effect;
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public static void setDuration(int duration)
+    {
+    mDuration = duration;
+    mInterD.setDuration(duration);
+    mInterA.setDuration(duration);
+    mInterB.setDuration(duration);
+    mInterM.setDuration(duration);
+    mInterS.setDuration(duration);
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public static void setCount(float count)
+    {
+    mCount = count;
+    mInterD.setCount(count);
+    mInterA.setCount(count);
+    mInterB.setCount(count);
+    mInterM.setCount(count);
+    mInterS.setCount(count);
+    }
+  
+///////////////////////////////////////////////////////////////////////////////////////////////////
+    
+  @Override public boolean onTouchEvent(MotionEvent event) 
+    {
+    int action = event.getAction();
+    int x, y;
+      
+    switch(action)
+      {
+      case MotionEvent.ACTION_DOWN: x = (int)event.getX()* Effects2DRenderer.BWID/mScrW;
+                                    y = (int)event.getY()* Effects2DRenderer.BHEI/mScrH;
+                                    point.set(x,y);
+                                    mRegion.set(x,y,60,60);
+
+                                    switch(mCurrentEffect)
+                                      {
+                                      case 0: Effects2DRenderer.mBackground.distort(mInterD, point, region);
+                                           break;
+                                      case 1: Effects2DRenderer.mBackground.sink(mInterS, point, region);
+                                           break;
+                                      case 2: Effects2DRenderer.mBackground.alpha(mInterA, mRegion, false);
+                                           break;  
+                                      case 3: Effects2DRenderer.mBackground.macroblock(mInterM, mRegion);
+                                           break;
+                                      case 4: Effects2DRenderer.mBackground.brightness(mInterB, mRegion, false);
+                                           break;      
+                                      }
+                                    break;
+      }
+            
+    return true;
+    }
+  }
diff --git a/src/main/java/org/distorted/examples/scratchpad/ScratchpadActivity.java b/src/main/java/org/distorted/examples/scratchpad/ScratchpadActivity.java
deleted file mode 100644
index 7e318de..0000000
--- a/src/main/java/org/distorted/examples/scratchpad/ScratchpadActivity.java
+++ /dev/null
@@ -1,196 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// Copyright 2016 Leszek Koltunski                                                               //
-//                                                                                               //
-// This file is part of Distorted.                                                               //
-//                                                                                               //
-// Distorted is free software: you can redistribute it and/or modify                             //
-// it under the terms of the GNU General Public License as published by                          //
-// the Free Software Foundation, either version 2 of the License, or                             //
-// (at your option) any later version.                                                           //
-//                                                                                               //
-// Distorted is distributed in the hope that it will be useful,                                  //
-// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
-// GNU General Public License for more details.                                                  //
-//                                                                                               //
-// You should have received a copy of the GNU General Public License                             //
-// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.distorted.examples.scratchpad;
-
-import org.distorted.library.Distorted;
-import org.distorted.examples.R;
-
-import android.app.Activity;
-import android.opengl.GLSurfaceView;
-import android.os.Bundle;
-import android.view.View;
-import android.widget.SeekBar.OnSeekBarChangeListener;
-import android.widget.SeekBar;
-import android.widget.TextView;
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-public class ScratchpadActivity extends Activity implements OnSeekBarChangeListener
-  {
-  private static final float D_MULT=200.0f;
-  private static final float C_MULT=  0.1f;
-   
-  private long effectID;
-   
-  private SeekBar barD, barC, barI;
-  private TextView textD, textC, textI;
-   
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  @Override
-  protected void onCreate(Bundle savedInstanceState) 
-    {
-    super.onCreate(savedInstanceState);
- 
-    setContentView(R.layout.scratchpadlayout);
-      
-    barD = (SeekBar)findViewById(R.id.scratchpadSeekDuration);
-    barD.setOnSeekBarChangeListener(this); 
-    barC = (SeekBar)findViewById(R.id.scratchpadSeekCount);
-    barC.setOnSeekBarChangeListener(this); 
-    barI = (SeekBar)findViewById(R.id.scratchpadSeekID);
-    barI.setOnSeekBarChangeListener(this); 
-        
-    textD = (TextView)findViewById(R.id.scratchpadTextDuration);
-    textC = (TextView)findViewById(R.id.scratchpadTextCount);
-    textI = (TextView)findViewById(R.id.scratchpadTextID);
-      
-    barD.setProgress(100);
-    barC.setProgress(10);
-    barI.setProgress(0);
-      
-    textD.setText("Dur: 20 s");
-    textC.setText("Cou: 1.0");
-    textI.setText("ID: 0");
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  @Override
-  protected void onResume() 
-    {
-    super.onResume();
-      
-    GLSurfaceView mView = (GLSurfaceView) this.findViewById(R.id.scratchpadSurfaceView);
-    mView.onResume();
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  @Override
-  protected void onPause() 
-    {
-    GLSurfaceView mView = (GLSurfaceView) this.findViewById(R.id.scratchpadSurfaceView);
-    mView.onPause();
-      
-    super.onPause();
-    }
-    
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  @Override
-  public void onStop()
-    {
-    super.onStop();
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  @Override
-  public void onDestroy()
-    {
-    Distorted.onDestroy();
-    super.onDestroy();
-    }     
- 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-    
-  public void Distort(View v)
-    {
-    ScratchpadSurfaceView.setEffect(0);
-    }     
-    
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public void Sink(View v)
-    {
-    ScratchpadSurfaceView.setEffect(1);
-    }       
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-    
-  public void Transparency(View v)
-    {
-    ScratchpadSurfaceView.setEffect(2);
-    }     
-    
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public void Macroblock(View v)
-    {
-    ScratchpadSurfaceView.setEffect(3);
-    }       
- 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public void Brightness(View v)
-    {
-    ScratchpadSurfaceView.setEffect(4);
-    }       
-     
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public void Print(View v)
-    {
-    ScratchpadRenderer.mBackground.printEffect(effectID);
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public void Abort(View v)
-    {
-    ScratchpadRenderer.mBackground.abortEffect(effectID);
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-    
-  public void onProgressChanged(SeekBar bar, int progress, boolean fromUser) 
-    {
-    float v, t; 
-    int i;
-      
-    switch (bar.getId()) 
-      {
-      case R.id.scratchpadSeekDuration: v = progress*D_MULT;
-                                        i = (int)(v/100);
-                                        t = i/10.0f;
-                                        ScratchpadSurfaceView.setDuration((int)v);
-                                        textD.setText("Dur: "+(int)t+" s");
-                                        break;
-      case R.id.scratchpadSeekCount   : v = progress*C_MULT;
-                                        i = (int)(v*10);
-                                        t = i/10.0f;
-                                        ScratchpadSurfaceView.setCount(v);
-                                        textC.setText("Cou: "+t);
-                                        break;
-      case R.id.scratchpadSeekID      : effectID = progress;
-                                        textI.setText("ID: "+progress);
-                                        break;                        
-      }
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public void onStartTrackingTouch(SeekBar bar) { }
-    
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public void onStopTrackingTouch(SeekBar bar)  { }
-  }
diff --git a/src/main/java/org/distorted/examples/scratchpad/ScratchpadRenderer.java b/src/main/java/org/distorted/examples/scratchpad/ScratchpadRenderer.java
deleted file mode 100644
index 3027832..0000000
--- a/src/main/java/org/distorted/examples/scratchpad/ScratchpadRenderer.java
+++ /dev/null
@@ -1,112 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// Copyright 2016 Leszek Koltunski                                                               //
-//                                                                                               //
-// This file is part of Distorted.                                                               //
-//                                                                                               //
-// Distorted is free software: you can redistribute it and/or modify                             //
-// it under the terms of the GNU General Public License as published by                          //
-// the Free Software Foundation, either version 2 of the License, or                             //
-// (at your option) any later version.                                                           //
-//                                                                                               //
-// Distorted is distributed in the hope that it will be useful,                                  //
-// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
-// GNU General Public License for more details.                                                  //
-//                                                                                               //
-// You should have received a copy of the GNU General Public License                             //
-// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.distorted.examples.scratchpad;
-
-import javax.microedition.khronos.egl.EGLConfig;
-import javax.microedition.khronos.opengles.GL10;
-
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.Paint;
-import android.graphics.Paint.Style;
-import android.opengl.GLES20;
-import android.opengl.GLSurfaceView;
-
-import org.distorted.library.DistortedBitmap;
-import org.distorted.library.Distorted;
-import org.distorted.library.EffectTypes;
-import org.distorted.library.type.Static3D;
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-public class ScratchpadRenderer implements GLSurfaceView.Renderer 
-  {  
-  public static final int NUMLINES = 10;
-  public static final int BWID = 300;
-  public static final int BHEI = 400;
-   
-  private GLSurfaceView mView;
-  public static DistortedBitmap mBackground;
-  private Paint mPaint;
-  private int texWidth, texHeight;
-    
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public ScratchpadRenderer(GLSurfaceView v)
-    {    
-    mPaint = new Paint();
-    mPaint.setAntiAlias(true);
-    mPaint.setFakeBoldText(true);
-    mPaint.setStyle(Style.FILL);
-      
-    mView = v;
-      
-    texWidth = BWID;
-    texHeight= BHEI;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-   
-  public void onSurfaceCreated(GL10 glUnused, EGLConfig config) 
-    {      
-    mBackground = new DistortedBitmap(texWidth,texHeight, 80);
-    Bitmap bitmap = Bitmap.createBitmap(texWidth,texHeight, Bitmap.Config.ARGB_8888);
-    Canvas canvas = new Canvas(bitmap);  
-      
-    mPaint.setColor(0xff008800);
-    canvas.drawRect(0, 0, texWidth, texHeight, mPaint);
-    mPaint.setColor(0xffffffff);
-         
-    for(int i=0; i<=NUMLINES ; i++ )
-      {
-      canvas.drawRect(texWidth*i/NUMLINES - 1,                       0,  texWidth*i/NUMLINES + 1,  texHeight               , mPaint);
-      canvas.drawRect(                      0, texHeight*i/NUMLINES -1,  texWidth               ,  texHeight*i/NUMLINES + 1, mPaint);  
-      }
-          
-    mBackground.setBitmap(bitmap);
-          
-    try
-      {
-      Distorted.onSurfaceCreated(mView.getContext());
-      }
-    catch(Exception ex)
-      {
-      android.util.Log.e("Scratchpad", ex.getMessage() );
-      }
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public void onSurfaceChanged(GL10 glUnused, int width, int height)
-    {
-    mBackground.abortEffects(EffectTypes.MATRIX);
-    mBackground.scale( new Static3D((float)width/texWidth,(float)height/texHeight,1) );
-    Distorted.onSurfaceChanged(width,height);
-    ScratchpadSurfaceView.setScreenSize(width,height);     
-    }
-   
-///////////////////////////////////////////////////////////////////////////////////////////////////
-   
-  public void onDrawFrame(GL10 glUnused)
-    {   
-    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
-    mBackground.draw(System.currentTimeMillis());
-    }
-  }
diff --git a/src/main/java/org/distorted/examples/scratchpad/ScratchpadSurfaceView.java b/src/main/java/org/distorted/examples/scratchpad/ScratchpadSurfaceView.java
deleted file mode 100644
index da72cd6..0000000
--- a/src/main/java/org/distorted/examples/scratchpad/ScratchpadSurfaceView.java
+++ /dev/null
@@ -1,195 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// Copyright 2016 Leszek Koltunski                                                               //
-//                                                                                               //
-// This file is part of Distorted.                                                               //
-//                                                                                               //
-// Distorted is free software: you can redistribute it and/or modify                             //
-// it under the terms of the GNU General Public License as published by                          //
-// the Free Software Foundation, either version 2 of the License, or                             //
-// (at your option) any later version.                                                           //
-//                                                                                               //
-// Distorted is distributed in the hope that it will be useful,                                  //
-// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
-// GNU General Public License for more details.                                                  //
-//                                                                                               //
-// You should have received a copy of the GNU General Public License                             //
-// along with Distorted.  If not, see <http://www.gnu.org/licenses/>.                            //
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-package org.distorted.examples.scratchpad;
-
-import android.content.Context;
-import android.opengl.GLSurfaceView;
-import android.os.Build;
-import android.view.MotionEvent;
-import android.util.AttributeSet;
-
-import org.distorted.library.type.Dynamic1D;
-import org.distorted.library.type.Static1D;
-import org.distorted.library.type.Static2D;
-import org.distorted.library.type.Static3D;
-import org.distorted.library.type.Static4D;
-import org.distorted.library.type.Dynamic3D;
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-public class ScratchpadSurfaceView extends GLSurfaceView
-  {
-  private ScratchpadRenderer mRenderer;
-  private static int mCurrentEffect;
-  private static int mDuration;
-  private static float mCount;
-  private static int mScrW, mScrH;
-    
-  private static Static4D region;
-  private static Static2D point;
-
-  private static Static4D mRegion;
-  private static Dynamic1D mInterA, mInterM, mInterB, mInterS;
-
-  private static Dynamic3D mInterD;
-  private static Static3D v0, v1, v2, v3;
-     
-///////////////////////////////////////////////////////////////////////////////////////////////////
-    
-  public ScratchpadSurfaceView(Context c, AttributeSet attrs) 
-    {
-    super(c, attrs);
-      
-    mDuration = 10000;
-    mCount    = 1.0f;
-      
-    mInterD = new Dynamic3D(mDuration,mCount);
-
-    int h = 30;
-    int r = 20;
-
-    v0 = new Static3D( 0, r, h );
-    v1 = new Static3D(-r, 0, h );
-    v2 = new Static3D( 0,-r, h );
-    v3 = new Static3D( r, 0, h );
-
-    mInterD.add(v0);
-    mInterD.add(v1);
-    mInterD.add(v2);
-    mInterD.add(v3);
-
-    mInterA = new Dynamic1D(mDuration,mCount);
-    mInterA.add(new Static1D(1));
-    mInterA.add(new Static1D(0));
-
-    mInterS = new Dynamic1D(mDuration,mCount);
-    mInterS.add(new Static1D(1.0f));
-    mInterS.add(new Static1D(0.3f));
-
-    mInterB = new Dynamic1D(mDuration,mCount);
-    mInterB.add(new Static1D(1));
-    mInterB.add(new Static1D(0));
-
-    mInterM = new Dynamic1D(mDuration,mCount);
-    mInterM.add(new Static1D(1));
-    mInterM.add(new Static1D(10));
-
-    if(!isInEditMode())
-      {
-      setFocusable(true);
-      setFocusableInTouchMode(true);
-       
-      setEGLContextClientVersion(2);
-        
-      if( Build.FINGERPRINT.startsWith("generic") ) // when running on the emulator, insert a magic line that is
-        {                                           // supposed to cure the 'no config chosen' crash on emulator startup
-        setEGLConfigChooser(8, 8, 8, 8, 16, 0);   
-        }
-        
-      mRenderer = new ScratchpadRenderer(this);
-      setRenderer(mRenderer);
-        
-      point = new Static2D(0,0);
-      region= new Static4D(0,0,60,60);
-      mRegion = new Static4D(0,0,60,60);
-        
-      setEffect(0);  
-      }
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public static void setScreenSize(int width, int height)
-    {
-    mScrW = width;
-    mScrH = height;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public static int getEffect()
-    {
-    return mCurrentEffect;
-    }
-   
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public static void setEffect(int effect)
-    {
-    mCurrentEffect = effect;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public static void setDuration(int duration)
-    {
-    mDuration = duration;
-    mInterD.setDuration(duration);
-    mInterA.setDuration(duration);
-    mInterB.setDuration(duration);
-    mInterM.setDuration(duration);
-    mInterS.setDuration(duration);
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-  public static void setCount(float count)
-    {
-    mCount = count;
-    mInterD.setCount(count);
-    mInterA.setCount(count);
-    mInterB.setCount(count);
-    mInterM.setCount(count);
-    mInterS.setCount(count);
-    }
-  
-///////////////////////////////////////////////////////////////////////////////////////////////////
-    
-  @Override public boolean onTouchEvent(MotionEvent event) 
-    {
-    int action = event.getAction();
-    int x, y;
-      
-    switch(action)
-      {
-      case MotionEvent.ACTION_DOWN: x = (int)event.getX()*ScratchpadRenderer.BWID/mScrW;
-                                    y = (int)event.getY()*ScratchpadRenderer.BHEI/mScrH;
-                                    point.set(x,y);
-                                    mRegion.set(x,y,60,60);
-
-                                    switch(mCurrentEffect)
-                                      {
-                                      case 0: ScratchpadRenderer.mBackground.distort(mInterD, point, region);
-                                           break;
-                                      case 1: ScratchpadRenderer.mBackground.sink(mInterS, point, region);
-                                           break;
-                                      case 2: ScratchpadRenderer.mBackground.alpha(mInterA, mRegion, false);
-                                           break;  
-                                      case 3: ScratchpadRenderer.mBackground.macroblock(mInterM, mRegion);
-                                           break;
-                                      case 4: ScratchpadRenderer.mBackground.brightness(mInterB, mRegion, false);
-                                           break;      
-                                      }
-                                    break;
-      }
-            
-    return true;
-    }
-  }
diff --git a/src/main/res/drawable-hdpi/icon_example_effects2d.png b/src/main/res/drawable-hdpi/icon_example_effects2d.png
new file mode 100644
index 0000000..c3edd62
Binary files /dev/null and b/src/main/res/drawable-hdpi/icon_example_effects2d.png differ
diff --git a/src/main/res/drawable-hdpi/icon_example_scratchpad.png b/src/main/res/drawable-hdpi/icon_example_scratchpad.png
deleted file mode 100644
index c3edd62..0000000
Binary files a/src/main/res/drawable-hdpi/icon_example_scratchpad.png and /dev/null differ
diff --git a/src/main/res/layout/scratchpadlayout.xml b/src/main/res/layout/scratchpadlayout.xml
index 8d41dbb..c6343c3 100644
--- a/src/main/res/layout/scratchpadlayout.xml
+++ b/src/main/res/layout/scratchpadlayout.xml
@@ -5,7 +5,7 @@
     android:onClick="Brightness"
     android:orientation="vertical" >
 
-    <org.distorted.examples.scratchpad.ScratchpadSurfaceView
+    <org.distorted.examples.effects2d.Effects2DSurfaceView
         android:id="@+id/scratchpadSurfaceView"
         android:layout_width="fill_parent"
         android:layout_height="0dp"
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index 5728a6e..ca9d0c5 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -65,8 +65,8 @@
     <string name="example_differenteffects_subtitle">See how to draw the same bitmap multiple times, each time with different set of effects applied.</string>
     <string name="example_differentbitmaps">Different Bitmaps</string>  
     <string name="example_differentbitmaps_subtitle">Draw 3 different bitmaps, apply the same set of effects to each one in one go.</string>
-    <string name="example_scratchpad">Scratchpad</string>  
-    <string name="example_scratchpad_subtitle">Application used as a scratchpad during development of the library. </string>
+    <string name="example_effects2d">Effects 2D</string>
+    <string name="example_effects2d_subtitle">Add, remove and list all effects currently acting on a Bitmap.</string>
     <string name="example_check">Check</string>  
     <string name="example_check_subtitle">Check the maximum number of effects (separately for vertex and fragment shaders) we can apply to a single bitmap.</string>
     <string name="example_fbo">Bitmap Tree</string>  
