commit 43bda3db60f258e2d6f7cb644ca1dc9d85041bc7
Author: Leszek Koltunski <leszek@distorted.org>
Date:   Sat Jan 7 00:49:27 2017 +0000

    New 'Blur' App. Actual BLUR effect, of course, does not work.

diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml
index 4d42239..796f669 100644
--- a/src/main/AndroidManifest.xml
+++ b/src/main/AndroidManifest.xml
@@ -43,5 +43,6 @@
         <activity android:name=".wind.WindActivity"/>
         <activity android:name=".aroundtheworld.AroundTheWorldActivity"/>
         <activity android:name=".mirror.MirrorActivity"/>
+        <activity android:name=".blur.BlurActivity"/>
     </application>
 </manifest>
diff --git a/src/main/java/org/distorted/examples/TableOfContents.java b/src/main/java/org/distorted/examples/TableOfContents.java
index 8014050..6484d93 100644
--- a/src/main/java/org/distorted/examples/TableOfContents.java
+++ b/src/main/java/org/distorted/examples/TableOfContents.java
@@ -61,6 +61,7 @@ import org.distorted.examples.save.SaveActivity;
 import org.distorted.examples.flag.FlagActivity;
 import org.distorted.examples.wind.WindActivity;
 import org.distorted.examples.mirror.MirrorActivity;
+import org.distorted.examples.blur.BlurActivity;
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
@@ -326,6 +327,15 @@ public class TableOfContents extends ListActivity
       activityMapping.put(i++, MirrorActivity.class);
    }
 
+   {
+      final Map<String, Object> item = new HashMap<>();
+      item.put(ITEM_IMAGE, R.drawable.icon_example_blur);
+      item.put(ITEM_TITLE, (i+1)+". "+getText(R.string.example_blur));
+      item.put(ITEM_SUBTITLE, getText(R.string.example_blur_subtitle));
+      data.add(item);
+      activityMapping.put(i++, BlurActivity.class);
+   }
+
    final SimpleAdapter dataAdapter = new SimpleAdapter(this, data, R.layout.toc_item, new String[] {ITEM_IMAGE, ITEM_TITLE, ITEM_SUBTITLE}, new int[] {R.id.Image, R.id.Title, R.id.SubTitle});
    setListAdapter(dataAdapter);  
       
diff --git a/src/main/java/org/distorted/examples/blur/BlurActivity.java b/src/main/java/org/distorted/examples/blur/BlurActivity.java
new file mode 100644
index 0000000..e0c604f
--- /dev/null
+++ b/src/main/java/org/distorted/examples/blur/BlurActivity.java
@@ -0,0 +1,108 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// 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.blur;
+
+import android.app.Activity;
+import android.opengl.GLSurfaceView;
+import android.os.Bundle;
+import android.widget.SeekBar;
+import android.widget.SeekBar.OnSeekBarChangeListener;
+import android.widget.TextView;
+
+import org.distorted.examples.R;
+import org.distorted.library.Distorted;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+public class BlurActivity extends Activity  implements OnSeekBarChangeListener
+{
+    private TextView textBlur;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+    
+    @Override
+    protected void onCreate(Bundle icicle) 
+      {
+      super.onCreate(icicle);
+      
+      setContentView(R.layout.blurlayout);
+
+      textBlur = (TextView)findViewById(R.id.blurText);
+
+      SeekBar bar = (SeekBar)findViewById(R.id.blurSeek);
+
+      bar.setOnSeekBarChangeListener(this);
+      bar.setProgress(50);
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+    
+    @Override
+    protected void onPause() 
+      {
+      GLSurfaceView view = (GLSurfaceView) this.findViewById(R.id.blurSurfaceView);
+      view.onPause();
+      
+      super.onPause();
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+    
+    @Override
+    protected void onResume() 
+      {
+      super.onResume();
+      
+      GLSurfaceView view = (GLSurfaceView) this.findViewById(R.id.blurSurfaceView);
+      view.onResume();
+      }
+ 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+    
+    @Override
+    protected void onDestroy() 
+      {
+      Distorted.onDestroy();  
+      super.onDestroy();
+      }
+   
+///////////////////////////////////////////////////////////////////
+    
+    public void onProgressChanged(SeekBar bar, int progress, boolean fromUser) 
+      {
+      BlurSurfaceView view = (BlurSurfaceView) this.findViewById(R.id.blurSurfaceView);
+
+      switch (bar.getId()) 
+        {
+        case R.id.blurSeek: view.getRenderer().setBlur(progress);
+                            textBlur.setText(getString(R.string.blur_placeholder,progress));
+                            break;
+        }
+      }
+
+///////////////////////////////////////////////////////////////////
+
+    public void onStartTrackingTouch(SeekBar bar) { }
+    
+///////////////////////////////////////////////////////////////////
+
+    public void onStopTrackingTouch(SeekBar bar)  { }
+     
+}
diff --git a/src/main/java/org/distorted/examples/blur/BlurRenderer.java b/src/main/java/org/distorted/examples/blur/BlurRenderer.java
new file mode 100644
index 0000000..735295f
--- /dev/null
+++ b/src/main/java/org/distorted/examples/blur/BlurRenderer.java
@@ -0,0 +1,151 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// 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.blur;
+
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.opengl.GLES20;
+import android.opengl.GLSurfaceView;
+
+import org.distorted.examples.R;
+import org.distorted.library.Distorted;
+import org.distorted.library.DistortedEffects;
+import org.distorted.library.DistortedFramebuffer;
+import org.distorted.library.DistortedTexture;
+import org.distorted.library.EffectTypes;
+import org.distorted.library.MeshFlat;
+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 java.io.IOException;
+import java.io.InputStream;
+
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.opengles.GL10;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+class BlurRenderer implements GLSurfaceView.Renderer
+{
+    private GLSurfaceView mView;
+    private DistortedTexture mTexture;
+    private DistortedEffects mEffects;
+    private DistortedFramebuffer mScreen;
+    private MeshFlat mMesh;
+    private Static1D mRadiusSta;
+    private int bmpHeight, bmpWidth;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+   BlurRenderer(GLSurfaceView v)
+      {
+      mView    = v;
+      mMesh    = new MeshFlat(1,1);
+      mEffects = new DistortedEffects();
+      mScreen  = new DistortedFramebuffer(0);
+
+      mRadiusSta = new Static1D(5);
+      Dynamic1D radiusDyn = new Dynamic1D();
+      radiusDyn.add(mRadiusSta);
+
+      mEffects.blur(radiusDyn, new Static2D(0,0));
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+   void setBlur(int blur)
+     {      
+     mRadiusSta.set(blur);
+     }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+   
+   public void onDrawFrame(GL10 glUnused) 
+      {
+      GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
+      mScreen.renderTo(mTexture, mMesh, mEffects, System.currentTimeMillis() );
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+    
+    public void onSurfaceChanged(GL10 glUnused, int width, int height) 
+      { 
+      mEffects.abortEffects(EffectTypes.MATRIX);
+      
+      if( (float)bmpHeight/bmpWidth > (float)height/width )
+        {
+        int w = (height*bmpWidth)/bmpHeight;
+        float factor = (float)height/bmpHeight;
+
+        mEffects.move( new Static3D((width-w)/2,0,0) );
+        mEffects.scale(factor);
+        }
+      else
+        {
+        int h = (width*bmpHeight)/bmpWidth;
+        float factor = (float)width/bmpWidth;
+
+        mEffects.move( new Static3D(0,(height-h)/2,0) );
+        mEffects.scale(factor);
+        }
+      
+      mScreen.resize(width, height);
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+    
+    public void onSurfaceCreated(GL10 glUnused, EGLConfig config) 
+      {
+      GLES20.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
+
+      InputStream is = mView.getContext().getResources().openRawResource(R.raw.girl);
+      Bitmap bitmap;
+        
+      try 
+        {
+        bitmap = BitmapFactory.decodeStream(is);
+        } 
+      finally 
+        {
+        try 
+          {
+          is.close();
+          } 
+        catch(IOException e) { }
+        }  
+      
+      bmpHeight = bitmap.getHeight();
+      bmpWidth  = bitmap.getWidth();
+
+      mTexture = new DistortedTexture(bmpWidth,bmpHeight);
+      mTexture.setTexture(bitmap);
+
+      try
+        {
+        Distorted.onCreate(mView.getContext());
+        }
+      catch(Exception ex)
+        {
+        android.util.Log.e("Renderer", ex.getMessage() );
+        }
+      }
+}
diff --git a/src/main/java/org/distorted/examples/blur/BlurSurfaceView.java b/src/main/java/org/distorted/examples/blur/BlurSurfaceView.java
new file mode 100644
index 0000000..721127e
--- /dev/null
+++ b/src/main/java/org/distorted/examples/blur/BlurSurfaceView.java
@@ -0,0 +1,53 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////
+// 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.blur;
+
+import android.content.Context;
+import android.opengl.GLSurfaceView;
+import android.util.AttributeSet;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+class BlurSurfaceView extends GLSurfaceView
+{
+  private BlurRenderer mRenderer;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  public BlurSurfaceView(Context c, AttributeSet attrs)
+      {
+      super(c, attrs);
+
+      if(!isInEditMode())
+        {
+        setEGLContextClientVersion(2);
+        mRenderer = new BlurRenderer(this);
+        setRenderer(mRenderer);
+        }
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  BlurRenderer getRenderer()
+    {
+    return mRenderer;
+    }
+}
+
diff --git a/src/main/java/org/distorted/examples/girl/GirlSurfaceView.java b/src/main/java/org/distorted/examples/girl/GirlSurfaceView.java
index 1124f61..0c9e6ed 100644
--- a/src/main/java/org/distorted/examples/girl/GirlSurfaceView.java
+++ b/src/main/java/org/distorted/examples/girl/GirlSurfaceView.java
@@ -34,10 +34,13 @@ class GirlSurfaceView extends GLSurfaceView
   public GirlSurfaceView(Context c, AttributeSet attrs) 
       {
       super(c, attrs);
-     
-      setEGLContextClientVersion(2);
-      mRenderer = new GirlRenderer(this);
-      setRenderer(mRenderer);
+
+      if(!isInEditMode())
+        {
+        setEGLContextClientVersion(2);
+        mRenderer = new GirlRenderer(this);
+        setRenderer(mRenderer);
+        }
       }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/res/drawable-hdpi/icon_example_blur.png b/src/main/res/drawable-hdpi/icon_example_blur.png
new file mode 100644
index 0000000..766fe70
Binary files /dev/null and b/src/main/res/drawable-hdpi/icon_example_blur.png differ
diff --git a/src/main/res/layout/blurlayout.xml b/src/main/res/layout/blurlayout.xml
new file mode 100644
index 0000000..4231ca3
--- /dev/null
+++ b/src/main/res/layout/blurlayout.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    android:orientation="vertical" >
+
+    <org.distorted.examples.blur.BlurSurfaceView
+        android:id="@+id/blurSurfaceView"
+        android:layout_width="fill_parent"
+        android:layout_height="0dp"
+        android:layout_weight="1" />
+
+    <LinearLayout
+        android:id="@+id/linearLayout1"
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:gravity="center|fill_horizontal"
+        android:orientation="horizontal" >
+
+        <TextView
+                android:id="@+id/blurText"
+                android:layout_width="150dp"
+                android:layout_height="wrap_content"
+                android:layout_weight="0.5"
+                android:gravity="center_vertical|center"
+                android:text="@string/blur"
+                android:textAppearance="?android:attr/textAppearanceMedium" />
+
+        <SeekBar
+                android:id="@+id/blurSeek"
+                android:layout_width="fill_parent"
+                android:layout_height="wrap_content"
+                android:layout_weight="1"
+                android:paddingLeft="15dp"
+                android:paddingRight="10dp" />
+
+    </LinearLayout>
+
+</LinearLayout>
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index 4bb5092..1c6a9c9 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -13,6 +13,7 @@
     <string name="saturation">Saturation</string>
     <string name="contrast">Contrast</string>
     <string name="swirl">Swirl</string>
+    <string name="blur">Blur</string>
 
     <string name="continu">Continue</string>
     <string name="rows">Rows</string>
@@ -73,6 +74,7 @@
     <string name="x_placeholder">X: %1$d</string>
     <string name="y_placeholder">Y: %1$d</string>
     <string name="wind_placeholder">Wind: %1$d</string>
+    <string name="blur_placeholder">Blur: %1$d</string>
 
     <string name="example_monalisa">Mona Lisa</string>  
     <string name="example_monalisa_subtitle">The basics of Distortions.</string>
@@ -128,6 +130,8 @@
     <string name="example_aroundtheworld_subtitle">Combine several effects to change facial features.</string>
     <string name="example_mirror">Mirror</string>
     <string name="example_mirror_subtitle">Ping-pong between offscreen buffers to achieve the \'infinite mirror\' effect.</string>
+    <string name="example_blur">Blur</string>
+    <string name="example_blur_subtitle">Postprocessing effect: Blur.</string>
 
     <string name="example_movingeffects_toast">Click on \'RESET\' and define your path by touching the screen. Then click on one of the effects and see it move along your path.</string>
     <string name="example_rotate_toast">Rotate the scene by swiping the screen</string>
