commit f26ab2fda230fadbb8b807a691135e492d7b35b5
Author: Leszek Koltunski <leszek@distorted.org>
Date:   Tue Aug 9 14:44:07 2016 +0100

    Fix the 'Macroblock' app.

diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml
index 094b05d..e781ec3 100644
--- a/src/main/AndroidManifest.xml
+++ b/src/main/AndroidManifest.xml
@@ -23,7 +23,7 @@
         <activity android:name=".listener.ListenerActivity" />    
         <activity android:name=".dynamic.DynamicActivity" />
         <activity android:name=".girl.GirlActivity" />   
-        <activity android:name=".macroblock.MacroblockActivity" /> 
+        <activity android:name=".catanddog.CatAndDogActivity" />
         <activity android:name=".movingeffects.MovingEffectsActivity" />    
         <activity android:name=".differenteffects.DifferentEffectsActivity" />    
         <activity android:name=".differentbitmaps.DifferentBitmapsActivity" />    
diff --git a/src/main/java/org/distorted/examples/TableOfContents.java b/src/main/java/org/distorted/examples/TableOfContents.java
index 61a8283..36313aa 100644
--- a/src/main/java/org/distorted/examples/TableOfContents.java
+++ b/src/main/java/org/distorted/examples/TableOfContents.java
@@ -41,7 +41,7 @@ import org.distorted.examples.deform.DeformActivity;
 import org.distorted.examples.listener.ListenerActivity;
 import org.distorted.examples.dynamic.DynamicActivity;
 import org.distorted.examples.girl.GirlActivity;
-import org.distorted.examples.macroblock.MacroblockActivity;
+import org.distorted.examples.catanddog.CatAndDogActivity;
 import org.distorted.examples.movingeffects.MovingEffectsActivity;
 import org.distorted.examples.olimpic.OlimpicActivity;
 import org.distorted.examples.differenteffects.DifferentEffectsActivity;
@@ -158,7 +158,7 @@ public class TableOfContents extends ListActivity
       item.put(ITEM_TITLE, (i+1)+". "+getText(R.string.example_macroblock));
       item.put(ITEM_SUBTITLE, getText(R.string.example_macroblock_subtitle));
       data.add(item);
-      activityMapping.put(i++, MacroblockActivity.class);
+      activityMapping.put(i++, CatAndDogActivity.class);
    }
    
    {
diff --git a/src/main/java/org/distorted/examples/catanddog/CatAndDogActivity.java b/src/main/java/org/distorted/examples/catanddog/CatAndDogActivity.java
new file mode 100644
index 0000000..83fb4bd
--- /dev/null
+++ b/src/main/java/org/distorted/examples/catanddog/CatAndDogActivity.java
@@ -0,0 +1,69 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// 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.catanddog;
+
+import org.distorted.library.Distorted;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+public class CatAndDogActivity extends Activity
+{
+    private CatAndDogSurfaceView mView;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+    
+    @Override
+    protected void onCreate(Bundle icicle) 
+      {
+      super.onCreate(icicle);
+      mView = new CatAndDogSurfaceView(this);
+      setContentView(mView);
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+    
+    @Override
+    protected void onPause() 
+      {
+      mView.onPause();
+      super.onPause();
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+    
+    @Override
+    protected void onResume() 
+      {
+      super.onResume();
+      mView.onResume();
+      }
+
+///////////////////////////////////////////////////////////////////
+    @Override
+    public void onDestroy()
+      {
+      Distorted.onDestroy();
+      super.onDestroy();
+      }     
+     
+}
diff --git a/src/main/java/org/distorted/examples/catanddog/CatAndDogRenderer.java b/src/main/java/org/distorted/examples/catanddog/CatAndDogRenderer.java
new file mode 100644
index 0000000..bbe8d67
--- /dev/null
+++ b/src/main/java/org/distorted/examples/catanddog/CatAndDogRenderer.java
@@ -0,0 +1,145 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// 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.catanddog;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.opengles.GL10;
+
+import org.distorted.examples.R;
+import org.distorted.library.Distorted;
+import org.distorted.library.DistortedBitmap;
+import org.distorted.library.EffectTypes;
+import org.distorted.library.type.Dynamic1D;
+import org.distorted.library.type.Dynamic3D;
+import org.distorted.library.type.Static1D;
+import org.distorted.library.type.Static3D;
+import org.distorted.library.type.Static4D;
+
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.opengl.GLES20;
+import android.opengl.GLSurfaceView;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+class CatAndDogRenderer implements GLSurfaceView.Renderer
+{
+    private GLSurfaceView mView;
+    private DistortedBitmap catanddog;
+    private Static4D chromaRegion, alphaRegion;
+    private int bmpHeight, bmpWidth;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+    public CatAndDogRenderer(GLSurfaceView v)
+      {   
+      mView = v;
+      
+      chromaRegion= new Static4D( 530, 200,100,100);
+      alphaRegion = new Static4D( 230, 200,100,100);
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+   
+    public void onDrawFrame(GL10 glUnused) 
+      {
+      GLES20.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
+      GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
+   
+      catanddog.draw(System.currentTimeMillis());
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+    
+    public void onSurfaceCreated(GL10 glUnused, EGLConfig config) 
+      {  
+      InputStream is = mView.getContext().getResources().openRawResource(R.raw.cat_and_dog);
+      Bitmap bitmap;
+        
+      try 
+        {
+        bitmap = BitmapFactory.decodeStream(is);
+        } 
+      finally 
+        {
+        try 
+          {
+          is.close();
+          } 
+        catch(IOException e) { }
+        }  
+      
+      bmpHeight = bitmap.getHeight();
+      bmpWidth  = bitmap.getWidth();
+      
+      catanddog = new DistortedBitmap(bitmap, 30);
+
+      Dynamic1D chromaDyn = new Dynamic1D(3000,0.0f);
+      chromaDyn.add(new Static1D(1));
+      chromaDyn.add(new Static1D(0));
+
+      catanddog.chroma(chromaDyn, new Static3D(1,0,0), chromaRegion ,true);
+
+      Dynamic1D alphaDyn = new Dynamic1D(3000,0.0f);
+      alphaDyn.add(new Static1D(1));
+      alphaDyn.add(new Static1D(0));
+
+      catanddog.alpha( alphaDyn, alphaRegion, false );
+      
+      try
+        {
+        Distorted.onSurfaceCreated(mView.getContext());
+        }
+      catch(Exception ex)
+        {
+        android.util.Log.e("Renderer", ex.getMessage() );
+        }
+      }
+    
+///////////////////////////////////////////////////////////////////////////////////////////////////
+    
+    public void onSurfaceChanged(GL10 glUnused, int width, int height) 
+      {
+      int duration = 10000;   
+      
+      Dynamic3D diMove = new Dynamic3D(duration,0.0f);
+      diMove.add(new Static3D(width-bmpWidth,height-bmpHeight,0));
+      diMove.add(new Static3D(0,0,0));
+      
+      Dynamic3D diScale = new Dynamic3D(duration,0.0f);
+      diScale.add(new Static3D(1,1,1));
+      diScale.add(new Static3D(0.33f,0.33f,1));
+      
+      Dynamic1D diRotate = new Dynamic1D(duration,0.0f);
+      diRotate.add(new Static1D(  0));
+      diRotate.add(new Static1D(360));
+      
+      catanddog.abortEffects(EffectTypes.MATRIX);
+
+      catanddog.move(diMove);
+      catanddog.scale(diScale);
+      catanddog.rotate( diRotate, new Static3D(0,0,1), new Static3D(bmpWidth/2,bmpHeight/2,0) );
+
+      Distorted.onSurfaceChanged(width, height); 
+      }
+}
diff --git a/src/main/java/org/distorted/examples/catanddog/CatAndDogSurfaceView.java b/src/main/java/org/distorted/examples/catanddog/CatAndDogSurfaceView.java
new file mode 100644
index 0000000..4039dff
--- /dev/null
+++ b/src/main/java/org/distorted/examples/catanddog/CatAndDogSurfaceView.java
@@ -0,0 +1,45 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// 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.catanddog;
+
+import android.content.Context;
+import android.opengl.GLSurfaceView;
+import android.os.Build;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+class CatAndDogSurfaceView extends GLSurfaceView
+{
+///////////////////////////////////////////////////////////////////////////////////////////////////
+   
+    public CatAndDogSurfaceView(Context context)
+      {
+      super(context);
+      setEGLContextClientVersion(2);
+        
+      if( Build.FINGERPRINT.startsWith("generic") )
+        { 
+        setEGLConfigChooser(8, 8, 8, 8, 16, 0);   
+        }
+        
+      setRenderer(new CatAndDogRenderer(this));
+      }
+}
+
diff --git a/src/main/java/org/distorted/examples/macroblock/MacroblockActivity.java b/src/main/java/org/distorted/examples/macroblock/MacroblockActivity.java
deleted file mode 100644
index c5ec950..0000000
--- a/src/main/java/org/distorted/examples/macroblock/MacroblockActivity.java
+++ /dev/null
@@ -1,69 +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.macroblock;
-
-import org.distorted.library.Distorted;
-
-import android.app.Activity;
-import android.os.Bundle;
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-public class MacroblockActivity extends Activity 
-{
-    private MacroblockSurfaceView mView;
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-    
-    @Override
-    protected void onCreate(Bundle icicle) 
-      {
-      super.onCreate(icicle);
-      mView = new MacroblockSurfaceView(this);
-      setContentView(mView);
-      }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-    
-    @Override
-    protected void onPause() 
-      {
-      mView.onPause();
-      super.onPause();
-      }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-    
-    @Override
-    protected void onResume() 
-      {
-      super.onResume();
-      mView.onResume();
-      }
-
-///////////////////////////////////////////////////////////////////
-    @Override
-    public void onDestroy()
-      {
-      Distorted.onDestroy();
-      super.onDestroy();
-      }     
-     
-}
diff --git a/src/main/java/org/distorted/examples/macroblock/MacroblockRenderer.java b/src/main/java/org/distorted/examples/macroblock/MacroblockRenderer.java
deleted file mode 100644
index 30f7d76..0000000
--- a/src/main/java/org/distorted/examples/macroblock/MacroblockRenderer.java
+++ /dev/null
@@ -1,145 +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.macroblock;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import javax.microedition.khronos.egl.EGLConfig;
-import javax.microedition.khronos.opengles.GL10;
-
-import org.distorted.examples.R;
-import org.distorted.library.Distorted;
-import org.distorted.library.DistortedBitmap;
-import org.distorted.library.EffectTypes;
-import org.distorted.library.type.Dynamic1D;
-import org.distorted.library.type.Dynamic3D;
-import org.distorted.library.type.Static1D;
-import org.distorted.library.type.Static3D;
-import org.distorted.library.type.Static4D;
-
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.opengl.GLES20;
-import android.opengl.GLSurfaceView;
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-class MacroblockRenderer implements GLSurfaceView.Renderer 
-{
-    private GLSurfaceView mView;
-    private DistortedBitmap macroblock;
-    private Static4D macRegion, alphaRegion;
-    private int bmpHeight, bmpWidth;
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-    public MacroblockRenderer(GLSurfaceView v) 
-      {   
-      mView = v;
-      
-        macRegion = new Static4D( 530, 200,100,100);
-      alphaRegion = new Static4D( 230, 200,100,100);
-      }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-   
-    public void onDrawFrame(GL10 glUnused) 
-      {
-      GLES20.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
-      GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
-   
-      macroblock.draw(System.currentTimeMillis());
-      }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-    
-    public void onSurfaceCreated(GL10 glUnused, EGLConfig config) 
-      {  
-      InputStream is = mView.getContext().getResources().openRawResource(R.raw.cat_and_dog);
-      Bitmap bitmap;
-        
-      try 
-        {
-        bitmap = BitmapFactory.decodeStream(is);
-        } 
-      finally 
-        {
-        try 
-          {
-          is.close();
-          } 
-        catch(IOException e) { }
-        }  
-      
-      bmpHeight = bitmap.getHeight();
-      bmpWidth  = bitmap.getWidth();
-      
-      macroblock = new DistortedBitmap(bitmap, 30);
-
-      Dynamic1D macroblockDyn = new Dynamic1D(3000,0.0f);
-      macroblockDyn.add(new Static1D( 1));
-      macroblockDyn.add(new Static1D(30));
-
-      macroblock.macroblock(macroblockDyn, macRegion);
-
-      Dynamic1D alphaDyn = new Dynamic1D(3000,0.0f);
-      alphaDyn.add(new Static1D(1));
-      alphaDyn.add(new Static1D(0));
-
-      macroblock.alpha( alphaDyn, alphaRegion, false );
-      
-      try
-        {
-        Distorted.onSurfaceCreated(mView.getContext());
-        }
-      catch(Exception ex)
-        {
-        android.util.Log.e("Renderer", ex.getMessage() );
-        }
-      }
-    
-///////////////////////////////////////////////////////////////////////////////////////////////////
-    
-    public void onSurfaceChanged(GL10 glUnused, int width, int height) 
-      {
-      int duration = 10000;   
-      
-      Dynamic3D diMove = new Dynamic3D(duration,0.0f);
-      diMove.add(new Static3D(width-bmpWidth,height-bmpHeight,0));
-      diMove.add(new Static3D(0,0,0));
-      
-      Dynamic3D diScale = new Dynamic3D(duration,0.0f);
-      diScale.add(new Static3D(1,1,1));
-      diScale.add(new Static3D(0.33f,0.33f,1));
-      
-      Dynamic1D diRotate = new Dynamic1D(duration,0.0f);
-      diRotate.add(new Static1D(  0));
-      diRotate.add(new Static1D(360));
-      
-      macroblock.abortEffects(EffectTypes.MATRIX);
-
-      macroblock.move(diMove);
-      macroblock.scale(diScale);
-      macroblock.rotate( diRotate, new Static3D(0,0,1), new Static3D(bmpWidth/2,bmpHeight/2,0) );
-
-      Distorted.onSurfaceChanged(width, height); 
-      }
-}
diff --git a/src/main/java/org/distorted/examples/macroblock/MacroblockSurfaceView.java b/src/main/java/org/distorted/examples/macroblock/MacroblockSurfaceView.java
deleted file mode 100644
index d81afc7..0000000
--- a/src/main/java/org/distorted/examples/macroblock/MacroblockSurfaceView.java
+++ /dev/null
@@ -1,45 +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.macroblock;
-
-import android.content.Context;
-import android.opengl.GLSurfaceView;
-import android.os.Build;
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-class MacroblockSurfaceView extends GLSurfaceView 
-{
-///////////////////////////////////////////////////////////////////////////////////////////////////
-   
-    public MacroblockSurfaceView(Context context) 
-      {
-      super(context);
-      setEGLContextClientVersion(2);
-        
-      if( Build.FINGERPRINT.startsWith("generic") )
-        { 
-        setEGLConfigChooser(8, 8, 8, 8, 16, 0);   
-        }
-        
-      setRenderer(new MacroblockRenderer(this));
-      }
-}
-
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index ff9e533..7da174c 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -72,7 +72,7 @@
     <string name="example_girl">Girl</string>  
     <string name="example_girl_subtitle">Distort, Sink and Swirl effects all in one.</string>
     <string name="example_macroblock">Cat and Dog</string>  
-    <string name="example_macroblock_subtitle">Macroblock, Transparency and Rotation effects.</string>
+    <string name="example_macroblock_subtitle">Chroma, Transparency and Rotation effects.</string>
     <string name="example_movingeffects">Moving Effects</string>  
     <string name="example_movingeffects_subtitle">Use the Interpolator to move effects around.</string>
     <string name="example_differenteffects">Different Effects</string>  
