├── .gitignore ├── ImageEffect_NabilahJKT48.iml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── inagata │ │ └── imageeffects │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── inagata │ │ └── imageeffects │ │ ├── Activity │ │ ├── AboutMe.java │ │ └── MainMenuActivity.java │ │ ├── Adapter │ │ ├── FilterAdapterDrawable.java │ │ ├── FilterAdapterFactory.java │ │ └── FilterAdapterGPU.java │ │ ├── Fragment │ │ ├── EffectsFilterFragment.java │ │ ├── GpuFilterFragment.java │ │ └── LayerDrawableFragment.java │ │ └── Utilities │ │ ├── FilterType.java │ │ ├── GLToolbox.java │ │ ├── RecyclerItemClickListener.java │ │ └── TextureRenderer.java │ └── res │ ├── drawable-hdpi │ ├── ic_dashboard.png │ ├── ic_discuss.png │ ├── ic_done.png │ ├── ic_event.png │ ├── ic_forum.png │ ├── ic_graphic_eq.png │ ├── ic_headset.png │ └── ic_menu.png │ ├── drawable-mdpi │ ├── ic_dashboard.png │ ├── ic_discuss.png │ ├── ic_done.png │ ├── ic_event.png │ ├── ic_forum.png │ ├── ic_graphic_eq.png │ ├── ic_headset.png │ └── ic_menu.png │ ├── drawable-xhdpi │ ├── ic_dashboard.png │ ├── ic_discuss.png │ ├── ic_done.png │ ├── ic_event.png │ ├── ic_forum.png │ ├── ic_graphic_eq.png │ ├── ic_headset.png │ └── ic_menu.png │ ├── drawable-xxhdpi │ ├── ic_dashboard.png │ ├── ic_discuss.png │ ├── ic_done.png │ ├── ic_event.png │ ├── ic_forum.png │ ├── ic_graphic_eq.png │ ├── ic_headset.png │ └── ic_menu.png │ ├── drawable-xxxhdpi │ ├── ic_done.png │ ├── ic_graphic_eq.png │ └── ic_menu.png │ ├── drawable │ ├── logo_oke.png │ ├── nabilah.jpg │ ├── wall10box.png │ ├── wall11box.png │ ├── wall12box.png │ ├── wall1box.png │ ├── wall2box.png │ ├── wall3box.png │ ├── wall4box.png │ ├── wall5box.png │ ├── wall6box.png │ ├── wall7box.png │ ├── wall8box.png │ └── wall9box.png │ ├── layout │ ├── imf_aboutme.xml │ ├── imf_effect_factory.xml │ ├── imf_filter_item.xml │ ├── imf_gpu.xml │ ├── imf_layer_drawable.xml │ ├── imf_mainmenu_layout.xml │ ├── imf_mainpage.xml │ └── imf_nav_header.xml │ ├── menu │ ├── about_githubmenu.xml │ └── drawer_view.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── device-2015-09-09-211522.png ├── device-2015-09-09-211615.png ├── device-2015-09-09-211705.png ├── device-2015-09-09-211757.png ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | /.idea/workspace.xml 4 | /.idea/libraries 5 | .DS_Store 6 | /build 7 | /captures 8 | 9 | ## New 10 | .idea/ 11 | *.iml 12 | -------------------------------------------------------------------------------- /ImageEffect_NabilahJKT48.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ImageEffectFilter 2 | Android image filter processing using layer drawable and effect factory android. 3 | 4 | Choose Effect Factory if you want select effect from effect factory from Android (Use minimum API 14). 5 | Choose layer drawable if want use 2 stacked drawable to create effect, this is using layer drawable. For future sample development I want to create effect with GPUImage Pricessing library, keep in touch. 6 | 7 | Home Menu 9 | Effect 11 | Effect 13 | Effect 15 | 16 | License 17 | ------- 18 | Copyright (c) 2016 mnafian. 19 | 20 | Licensed under the Apache License, Version 2.0 (the "License"); 21 | you may not use this file except in compliance with the License. 22 | You may obtain a copy of the License at 23 | 24 | http://www.apache.org/licenses/LICENSE-2.0 25 | 26 | Unless required by applicable law or agreed to in writing, software 27 | distributed under the License is distributed on an "AS IS" BASIS, 28 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | See the License for the specific language governing permissions and 30 | limitations under the License. 31 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.3" 6 | 7 | defaultConfig { 8 | applicationId "com.inagata.imageeffects" 9 | minSdkVersion 16 10 | targetSdkVersion 22 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | repositories{ 23 | jcenter() 24 | maven { 25 | url 'http://dl.bintray.com/amulyakhare/maven' 26 | } 27 | } 28 | 29 | dependencies { 30 | compile fileTree(dir: 'libs', include: ['*.jar']) 31 | compile 'com.android.support:appcompat-v7:23.0.0' 32 | compile 'com.android.support:design:23.+' 33 | compile 'com.android.support:recyclerview-v7:23.0.+' 34 | compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1' 35 | compile 'de.hdodenhof:circleimageview:1.3.0' 36 | compile 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.4.1' 37 | } 38 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/mnafian/Documents/sdk-android/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/inagata/imageeffects/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.inagata.imageeffects; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/inagata/imageeffects/Activity/AboutMe.java: -------------------------------------------------------------------------------- 1 | package com.inagata.imageeffects.Activity; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.ActionBar; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.support.v7.widget.Toolbar; 7 | import android.view.MenuItem; 8 | 9 | import com.inagata.imageeffects.R; 10 | 11 | /** 12 | * Created by mnafian on 6/16/15. 13 | */ 14 | public class AboutMe extends AppCompatActivity { 15 | 16 | @Override 17 | protected void onCreate(Bundle savedInstanceState) { 18 | super.onCreate(savedInstanceState); 19 | setContentView(R.layout.imf_aboutme); 20 | 21 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 22 | setSupportActionBar(toolbar); 23 | 24 | final ActionBar ab = getSupportActionBar(); 25 | ab.setDisplayHomeAsUpEnabled(true); 26 | } 27 | 28 | 29 | @Override 30 | public boolean onOptionsItemSelected(MenuItem item) { 31 | 32 | int id = item.getItemId(); 33 | switch (id) { 34 | case android.R.id.home: 35 | finish(); 36 | return true; 37 | } 38 | 39 | return super.onOptionsItemSelected(item); 40 | } 41 | 42 | @Override 43 | public void onBackPressed() { 44 | finish(); 45 | super.onBackPressed(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app/src/main/java/com/inagata/imageeffects/Activity/MainMenuActivity.java: -------------------------------------------------------------------------------- 1 | package com.inagata.imageeffects.Activity; 2 | 3 | import android.content.Intent; 4 | import android.net.Uri; 5 | import android.os.Bundle; 6 | import android.support.design.widget.NavigationView; 7 | import android.support.v4.app.Fragment; 8 | import android.support.v4.view.GravityCompat; 9 | import android.support.v4.widget.DrawerLayout; 10 | import android.support.v7.app.ActionBar; 11 | import android.support.v7.app.AppCompatActivity; 12 | import android.support.v7.widget.Toolbar; 13 | import android.view.Menu; 14 | import android.view.MenuItem; 15 | 16 | import com.inagata.imageeffects.Fragment.EffectsFilterFragment; 17 | import com.inagata.imageeffects.Fragment.GpuFilterFragment; 18 | import com.inagata.imageeffects.Fragment.LayerDrawableFragment; 19 | import com.inagata.imageeffects.R; 20 | 21 | /** 22 | * Created by mnafian on 6/16/15. 23 | */ 24 | public class MainMenuActivity extends AppCompatActivity{ 25 | 26 | private DrawerLayout mDrawerLayout; 27 | 28 | @Override 29 | protected void onCreate(Bundle savedInstanceState) { 30 | super.onCreate(savedInstanceState); 31 | setContentView(R.layout.imf_mainmenu_layout); 32 | 33 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 34 | setSupportActionBar(toolbar); 35 | 36 | final ActionBar ab = getSupportActionBar(); 37 | ab.setHomeAsUpIndicator(R.drawable.ic_menu); 38 | ab.setDisplayHomeAsUpEnabled(true); 39 | 40 | mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); 41 | 42 | NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); 43 | if (navigationView != null) { 44 | setupDrawerContent(navigationView); 45 | changeFragment(new EffectsFilterFragment()); 46 | } 47 | } 48 | 49 | private void setupDrawerContent(NavigationView navigationView) { 50 | navigationView.setNavigationItemSelectedListener( 51 | new NavigationView.OnNavigationItemSelectedListener() { 52 | @Override 53 | public boolean onNavigationItemSelected(MenuItem menuItem) { 54 | menuItem.setChecked(true); 55 | mDrawerLayout.closeDrawers(); 56 | 57 | int id = menuItem.getItemId(); 58 | switch (id) { 59 | case R.id.bt_gles: 60 | changeFragment(new EffectsFilterFragment()); 61 | break; 62 | case R.id.bt_layerd: 63 | changeFragment(new LayerDrawableFragment()); 64 | break; 65 | case R.id.bt_gpu: 66 | changeFragment(new GpuFilterFragment()); 67 | break; 68 | } 69 | 70 | return true; 71 | } 72 | }); 73 | } 74 | 75 | @Override 76 | public boolean onCreateOptionsMenu(Menu menu) { 77 | // Inflate the menu; this adds items to the action bar if it is present. 78 | getMenuInflater().inflate(R.menu.about_githubmenu, menu); 79 | return true; 80 | } 81 | 82 | @Override 83 | public boolean onOptionsItemSelected(MenuItem item) { 84 | 85 | int id = item.getItemId(); 86 | switch (id) { 87 | case R.id.About: 88 | Intent inAbout = new Intent(this, AboutMe.class); 89 | startActivity(inAbout); 90 | break; 91 | 92 | case R.id.Github: 93 | String url = "https://github.com/mnafian"; 94 | Intent i = new Intent(Intent.ACTION_VIEW); 95 | i.setData(Uri.parse(url)); 96 | startActivity(i); 97 | break; 98 | 99 | case android.R.id.home: 100 | mDrawerLayout.openDrawer(GravityCompat.START); 101 | return true; 102 | } 103 | 104 | return super.onOptionsItemSelected(item); 105 | } 106 | 107 | public void changeFragment(Fragment targetFragment) { 108 | android.support.v4.app.FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); 109 | transaction.replace(R.id.main_fragment, targetFragment); 110 | transaction.commit(); 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /app/src/main/java/com/inagata/imageeffects/Adapter/FilterAdapterDrawable.java: -------------------------------------------------------------------------------- 1 | package com.inagata.imageeffects.Adapter; 2 | 3 | import android.content.Context; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.widget.ImageView; 9 | 10 | import com.amulyakhare.textdrawable.TextDrawable; 11 | import com.amulyakhare.textdrawable.util.ColorGenerator; 12 | import com.inagata.imageeffects.R; 13 | 14 | /** 15 | * Created by mnafian on 6/16/15. 16 | */ 17 | public class FilterAdapterDrawable extends RecyclerView.Adapter { 18 | 19 | private String itemData[] = { 20 | "Autumn", 21 | "Layering", 22 | "Pattern", 23 | "Contrast", 24 | "Violet", 25 | "Pattern2", 26 | "RockPattern", 27 | "Angsa", 28 | "Pasir", 29 | "Smooth", 30 | "Relief", 31 | "AquaBlue"}; 32 | private Context mContext; 33 | 34 | public FilterAdapterDrawable(Context mContext) { 35 | super(); 36 | this.mContext = mContext; 37 | } 38 | 39 | @Override 40 | public FilterHolder onCreateViewHolder(ViewGroup parent, int viewType) { 41 | View itemView = LayoutInflater. 42 | from(parent.getContext()). 43 | inflate(R.layout.imf_filter_item, parent, false); 44 | FilterHolder viewHolder = new FilterHolder(itemView); 45 | return viewHolder; 46 | } 47 | 48 | @Override 49 | public void onBindViewHolder(FilterHolder holder, int position) { 50 | String val = itemData[position]; 51 | 52 | ColorGenerator generator = ColorGenerator.MATERIAL; 53 | // generate random color 54 | int color1 = generator.getRandomColor(); 55 | 56 | TextDrawable.IBuilder builder = TextDrawable.builder() 57 | .beginConfig() 58 | .withBorder(2) 59 | .fontSize(23) 60 | .endConfig() 61 | .rect(); 62 | 63 | TextDrawable drawable = builder.build(val.substring(0,5), color1); 64 | 65 | holder.imFilter.setImageDrawable(drawable); 66 | } 67 | 68 | @Override 69 | public int getItemCount() { 70 | return itemData.length; 71 | } 72 | 73 | public class FilterHolder extends RecyclerView.ViewHolder { 74 | public ImageView imFilter; 75 | 76 | public FilterHolder(View itemView) { 77 | super(itemView); 78 | imFilter = (ImageView) itemView.findViewById(R.id.effectsviewimage_item); 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /app/src/main/java/com/inagata/imageeffects/Adapter/FilterAdapterFactory.java: -------------------------------------------------------------------------------- 1 | package com.inagata.imageeffects.Adapter; 2 | 3 | import android.content.Context; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.widget.ImageView; 9 | 10 | import com.amulyakhare.textdrawable.TextDrawable; 11 | import com.amulyakhare.textdrawable.util.ColorGenerator; 12 | import com.inagata.imageeffects.R; 13 | 14 | /** 15 | * Created by mnafian on 6/16/15. 16 | */ 17 | public class FilterAdapterFactory extends RecyclerView.Adapter { 18 | 19 | private String itemData[] = { 20 | "No Effect", 21 | "Autofix", 22 | "BlackAndWhite", 23 | "Brightness", 24 | "Contrast", 25 | "CrossProcess", 26 | "Documentary", 27 | "Duotone", 28 | "Fillight", 29 | "FishEye", 30 | "Flipert", 31 | "Fliphor", 32 | "Grain", 33 | "Grayscale", 34 | "Lomoish", 35 | "Negative", 36 | "Posterize", 37 | "Rotate", 38 | "Saturate", 39 | "Sepia", 40 | "Sharpen", 41 | "Temperature", 42 | "TintEffect", 43 | "Vignette"}; 44 | private Context mContext; 45 | 46 | public FilterAdapterFactory(Context mContext) { 47 | super(); 48 | this.mContext = mContext; 49 | } 50 | 51 | @Override 52 | public FilterHolder onCreateViewHolder(ViewGroup parent, int viewType) { 53 | View itemView = LayoutInflater. 54 | from(parent.getContext()). 55 | inflate(R.layout.imf_filter_item, parent, false); 56 | FilterHolder viewHolder = new FilterHolder(itemView); 57 | return viewHolder; 58 | } 59 | 60 | @Override 61 | public void onBindViewHolder(FilterHolder holder, int position) { 62 | String val = itemData[position]; 63 | 64 | ColorGenerator generator = ColorGenerator.MATERIAL; 65 | // generate random color 66 | int color1 = generator.getRandomColor(); 67 | 68 | TextDrawable.IBuilder builder = TextDrawable.builder() 69 | .beginConfig() 70 | .withBorder(2) 71 | .fontSize(23) 72 | .endConfig() 73 | .rect(); 74 | 75 | TextDrawable drawable = builder.build(val.substring(0,5), color1); 76 | 77 | holder.imFilter.setImageDrawable(drawable); 78 | } 79 | 80 | @Override 81 | public int getItemCount() { 82 | return itemData.length; 83 | } 84 | 85 | public class FilterHolder extends RecyclerView.ViewHolder { 86 | public ImageView imFilter; 87 | 88 | public FilterHolder(View itemView) { 89 | super(itemView); 90 | imFilter = (ImageView) itemView.findViewById(R.id.effectsviewimage_item); 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /app/src/main/java/com/inagata/imageeffects/Adapter/FilterAdapterGPU.java: -------------------------------------------------------------------------------- 1 | package com.inagata.imageeffects.Adapter; 2 | 3 | import android.content.Context; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import android.widget.ImageView; 9 | 10 | import com.amulyakhare.textdrawable.TextDrawable; 11 | import com.amulyakhare.textdrawable.util.ColorGenerator; 12 | import com.inagata.imageeffects.R; 13 | import com.inagata.imageeffects.Utilities.FilterType; 14 | 15 | import java.util.LinkedList; 16 | import java.util.List; 17 | 18 | /** 19 | * Created by mnafian on 6/16/15. 20 | */ 21 | public class FilterAdapterGPU extends RecyclerView.Adapter { 22 | 23 | private FilterList filterList; 24 | private Context mContext; 25 | 26 | public FilterAdapterGPU(Context mContext) { 27 | super(); 28 | this.mContext = mContext; 29 | populateData(); 30 | } 31 | 32 | public FilterType getItem(int position) { 33 | return filterList.filters.get(position); 34 | } 35 | 36 | private void populateData() { 37 | filterList = new FilterList(); 38 | filterList.addFilter("No Filter", null); 39 | filterList.addFilter("Toon", FilterType.TOON); 40 | filterList.addFilter("Sketch", FilterType.SKETCH); 41 | filterList.addFilter("Vignette", FilterType.VIGNETTE); 42 | filterList.addFilter("Invert", FilterType.INVERT); 43 | filterList.addFilter("Grayscale", FilterType.GRAYSCALE); 44 | } 45 | 46 | @Override 47 | public FilterHolder onCreateViewHolder(ViewGroup parent, int viewType) { 48 | View itemView = LayoutInflater. 49 | from(parent.getContext()). 50 | inflate(R.layout.imf_filter_item, parent, false); 51 | FilterHolder viewHolder = new FilterHolder(itemView); 52 | return viewHolder; 53 | } 54 | 55 | @Override 56 | public void onBindViewHolder(FilterHolder holder, int position) { 57 | String val = filterList.names.get(position); 58 | 59 | ColorGenerator generator = ColorGenerator.MATERIAL; 60 | // generate random color 61 | int color1 = generator.getRandomColor(); 62 | 63 | TextDrawable.IBuilder builder = TextDrawable.builder() 64 | .beginConfig() 65 | .withBorder(2) 66 | .fontSize(23) 67 | .endConfig() 68 | .rect(); 69 | 70 | TextDrawable drawable = builder.build(val.substring(0, Math.min(5, val.length() - 1)), color1); 71 | 72 | holder.imFilter.setImageDrawable(drawable); 73 | } 74 | 75 | @Override 76 | public int getItemCount() { 77 | return filterList.names.size(); 78 | } 79 | 80 | public class FilterHolder extends RecyclerView.ViewHolder { 81 | public ImageView imFilter; 82 | 83 | public FilterHolder(View itemView) { 84 | super(itemView); 85 | imFilter = (ImageView) itemView.findViewById(R.id.effectsviewimage_item); 86 | } 87 | } 88 | 89 | private static class FilterList { 90 | public List names = new LinkedList<>(); 91 | public List filters = new LinkedList(); 92 | 93 | public void addFilter(final String name, final FilterType filter) { 94 | names.add(name); 95 | filters.add(filter); 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /app/src/main/java/com/inagata/imageeffects/Fragment/EffectsFilterFragment.java: -------------------------------------------------------------------------------- 1 | package com.inagata.imageeffects.Fragment; 2 | 3 | import android.graphics.Bitmap; 4 | import android.graphics.BitmapFactory; 5 | import android.graphics.Color; 6 | import android.media.effect.Effect; 7 | import android.media.effect.EffectContext; 8 | import android.media.effect.EffectFactory; 9 | import android.opengl.GLES20; 10 | import android.opengl.GLSurfaceView; 11 | import android.opengl.GLUtils; 12 | import android.os.Bundle; 13 | import android.support.v4.app.Fragment; 14 | import android.support.v7.widget.LinearLayoutManager; 15 | import android.support.v7.widget.RecyclerView; 16 | import android.view.LayoutInflater; 17 | import android.view.View; 18 | import android.view.ViewGroup; 19 | 20 | import com.inagata.imageeffects.Adapter.FilterAdapterFactory; 21 | import com.inagata.imageeffects.Utilities.GLToolbox; 22 | import com.inagata.imageeffects.R; 23 | import com.inagata.imageeffects.Utilities.RecyclerItemClickListener; 24 | import com.inagata.imageeffects.Utilities.TextureRenderer; 25 | 26 | import javax.microedition.khronos.egl.EGLConfig; 27 | import javax.microedition.khronos.opengles.GL10; 28 | 29 | public class EffectsFilterFragment extends Fragment implements GLSurfaceView.Renderer { 30 | 31 | private RecyclerView recList; 32 | int mCurrentEffect; 33 | private GLSurfaceView mEffectView; 34 | private int[] mTextures = new int[2]; 35 | private EffectContext mEffectContext; 36 | private Effect mEffect; 37 | private TextureRenderer mTexRenderer = new TextureRenderer(); 38 | private int mImageWidth; 39 | private int mImageHeight; 40 | private boolean mInitialized = false; 41 | private volatile boolean saveFrame; 42 | 43 | public void setCurrentEffect(int effect) { 44 | mCurrentEffect = effect; 45 | } 46 | 47 | @Override 48 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 49 | View rootView = inflater.inflate(R.layout.imf_effect_factory, container, false); 50 | mEffectView = (GLSurfaceView) rootView.findViewById(R.id.effectsview); 51 | mEffectView.setEGLContextClientVersion(2); 52 | mEffectView.setRenderer(this); 53 | mEffectView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY); 54 | mCurrentEffect = 0; 55 | 56 | LinearLayoutManager layoutManager 57 | = new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false); 58 | 59 | recList = (RecyclerView) rootView.findViewById(R.id.rc_filter); 60 | recList.setHasFixedSize(true); 61 | recList.setLayoutManager(layoutManager); 62 | 63 | FilterAdapterFactory filterAdapter = new FilterAdapterFactory(getActivity()); 64 | recList.setAdapter(filterAdapter); 65 | 66 | recList.addOnItemTouchListener(new RecyclerItemClickListener(getActivity(), new RecyclerItemClickListener.OnItemClickListener() { 67 | @Override 68 | public void onItemClick(View view, int position) { 69 | setCurrentEffect(position); 70 | mEffectView.requestRender(); 71 | } 72 | })); 73 | 74 | return rootView; 75 | } 76 | 77 | private void loadTextures() { 78 | // Generate textures 79 | GLES20.glGenTextures(2, mTextures, 0); 80 | 81 | // Load input bitmap 82 | Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.nabilah); 83 | mImageWidth = bitmap.getWidth(); 84 | mImageHeight = bitmap.getHeight(); 85 | mTexRenderer.updateTextureSize(mImageWidth, mImageHeight); 86 | 87 | // Upload to texture 88 | GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextures[0]); 89 | GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0); 90 | 91 | // Set texture parameters 92 | GLToolbox.initTexParams(); 93 | bitmap.recycle(); 94 | } 95 | 96 | private void initEffect() { 97 | EffectFactory effectFactory = mEffectContext.getFactory(); 98 | if (mEffect != null) { 99 | mEffect.release(); 100 | } 101 | /** 102 | * Initialize the correct effect based on the selected menu/action item 103 | */ 104 | switch (mCurrentEffect) { 105 | 106 | case 0: 107 | break; 108 | 109 | case 1: 110 | mEffect = effectFactory.createEffect(EffectFactory.EFFECT_AUTOFIX); 111 | mEffect.setParameter("scale", 0.5f); 112 | break; 113 | 114 | case 2: 115 | mEffect = effectFactory.createEffect(EffectFactory.EFFECT_BLACKWHITE); 116 | mEffect.setParameter("black", .1f); 117 | mEffect.setParameter("white", .7f); 118 | break; 119 | 120 | case 3: 121 | mEffect = effectFactory.createEffect(EffectFactory.EFFECT_BRIGHTNESS); 122 | mEffect.setParameter("brightness", 2.0f); 123 | break; 124 | 125 | case 4: 126 | mEffect = effectFactory.createEffect(EffectFactory.EFFECT_CONTRAST); 127 | mEffect.setParameter("contrast", 1.4f); 128 | break; 129 | 130 | case 5: 131 | mEffect = effectFactory.createEffect(EffectFactory.EFFECT_CROSSPROCESS); 132 | break; 133 | 134 | case 6: 135 | mEffect = effectFactory.createEffect(EffectFactory.EFFECT_DOCUMENTARY); 136 | break; 137 | 138 | case 7: 139 | mEffect = effectFactory.createEffect(EffectFactory.EFFECT_DUOTONE); 140 | mEffect.setParameter("first_color", Color.YELLOW); 141 | mEffect.setParameter("second_color", Color.DKGRAY); 142 | break; 143 | 144 | case 8: 145 | mEffect = effectFactory.createEffect(EffectFactory.EFFECT_FILLLIGHT); 146 | mEffect.setParameter("strength", .8f); 147 | break; 148 | 149 | case 9: 150 | mEffect = effectFactory.createEffect(EffectFactory.EFFECT_FISHEYE); 151 | mEffect.setParameter("scale", .5f); 152 | break; 153 | 154 | case 10: 155 | mEffect = effectFactory.createEffect(EffectFactory.EFFECT_FLIP); 156 | mEffect.setParameter("vertical", true); 157 | break; 158 | 159 | case 11: 160 | mEffect = effectFactory.createEffect(EffectFactory.EFFECT_FLIP); 161 | mEffect.setParameter("horizontal", true); 162 | break; 163 | 164 | case 12: 165 | mEffect = effectFactory.createEffect(EffectFactory.EFFECT_GRAIN); 166 | mEffect.setParameter("strength", 1.0f); 167 | break; 168 | 169 | case 13: 170 | mEffect = effectFactory.createEffect(EffectFactory.EFFECT_GRAYSCALE); 171 | break; 172 | 173 | case 14: 174 | mEffect = effectFactory.createEffect(EffectFactory.EFFECT_LOMOISH); 175 | break; 176 | 177 | case 15: 178 | mEffect = effectFactory.createEffect(EffectFactory.EFFECT_NEGATIVE); 179 | break; 180 | 181 | case 16: 182 | mEffect = effectFactory.createEffect(EffectFactory.EFFECT_POSTERIZE); 183 | break; 184 | 185 | case 17: 186 | mEffect = effectFactory.createEffect(EffectFactory.EFFECT_ROTATE); 187 | mEffect.setParameter("angle", 180); 188 | break; 189 | 190 | case 18: 191 | mEffect = effectFactory.createEffect(EffectFactory.EFFECT_SATURATE); 192 | mEffect.setParameter("scale", .5f); 193 | break; 194 | 195 | case 19: 196 | mEffect = effectFactory.createEffect(EffectFactory.EFFECT_SEPIA); 197 | break; 198 | 199 | case 20: 200 | mEffect = effectFactory.createEffect(EffectFactory.EFFECT_SHARPEN); 201 | break; 202 | 203 | case 21: 204 | mEffect = effectFactory.createEffect(EffectFactory.EFFECT_TEMPERATURE); 205 | mEffect.setParameter("scale", .9f); 206 | break; 207 | 208 | case 22: 209 | mEffect = effectFactory.createEffect(EffectFactory.EFFECT_TINT); 210 | mEffect.setParameter("tint", Color.MAGENTA); 211 | break; 212 | 213 | case 23: 214 | mEffect = effectFactory.createEffect(EffectFactory.EFFECT_VIGNETTE); 215 | mEffect.setParameter("scale", .5f); 216 | break; 217 | 218 | default: 219 | break; 220 | 221 | } 222 | } 223 | 224 | private void applyEffect() { 225 | mEffect.apply(mTextures[0], mImageWidth, mImageHeight, mTextures[1]); 226 | } 227 | 228 | private void renderResult() { 229 | if (mCurrentEffect != 0) { 230 | // if no effect is chosen, just render the original bitmap 231 | mTexRenderer.renderTexture(mTextures[1]); 232 | } else { 233 | saveFrame=true; 234 | // render the result of applyEffect() 235 | mTexRenderer.renderTexture(mTextures[0]); 236 | } 237 | } 238 | 239 | @Override 240 | public void onDrawFrame(GL10 gl) { 241 | if (!mInitialized) { 242 | // Only need to do this once 243 | mEffectContext = EffectContext.createWithCurrentGlContext(); 244 | mTexRenderer.init(); 245 | loadTextures(); 246 | mInitialized = true; 247 | } 248 | if (mCurrentEffect != 0) { 249 | // if an effect is chosen initialize it and apply it to the texture 250 | initEffect(); 251 | applyEffect(); 252 | } 253 | renderResult(); 254 | } 255 | 256 | @Override 257 | public void onSurfaceChanged(GL10 gl, int width, int height) { 258 | if (mTexRenderer != null) { 259 | mTexRenderer.updateViewSize(width, height); 260 | } 261 | } 262 | 263 | @Override 264 | public void onSurfaceCreated(GL10 gl, EGLConfig config) { 265 | } 266 | } 267 | -------------------------------------------------------------------------------- /app/src/main/java/com/inagata/imageeffects/Fragment/GpuFilterFragment.java: -------------------------------------------------------------------------------- 1 | package com.inagata.imageeffects.Fragment; 2 | 3 | import android.graphics.Bitmap; 4 | import android.graphics.drawable.BitmapDrawable; 5 | import android.os.Bundle; 6 | import android.support.annotation.Nullable; 7 | import android.support.v4.app.Fragment; 8 | import android.support.v4.content.ContextCompat; 9 | import android.support.v7.widget.LinearLayoutManager; 10 | import android.support.v7.widget.RecyclerView; 11 | import android.view.LayoutInflater; 12 | import android.view.View; 13 | import android.view.ViewGroup; 14 | 15 | import com.inagata.imageeffects.Adapter.FilterAdapterGPU; 16 | import com.inagata.imageeffects.R; 17 | import com.inagata.imageeffects.Utilities.FilterType; 18 | import com.inagata.imageeffects.Utilities.RecyclerItemClickListener; 19 | 20 | import jp.co.cyberagent.android.gpuimage.GPUImageColorInvertFilter; 21 | import jp.co.cyberagent.android.gpuimage.GPUImageFilter; 22 | import jp.co.cyberagent.android.gpuimage.GPUImageGrayscaleFilter; 23 | import jp.co.cyberagent.android.gpuimage.GPUImageSketchFilter; 24 | import jp.co.cyberagent.android.gpuimage.GPUImageToonFilter; 25 | import jp.co.cyberagent.android.gpuimage.GPUImageView; 26 | import jp.co.cyberagent.android.gpuimage.GPUImageVignetteFilter; 27 | 28 | /** 29 | * Created by esafirm on 6/15/16. 30 | */ 31 | public class GpuFilterFragment extends Fragment { 32 | 33 | private RecyclerView recyclerView; 34 | private GPUImageView effectView; 35 | private Bitmap image; 36 | 37 | @Nullable 38 | @Override 39 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 40 | return inflater.inflate(R.layout.imf_gpu, container, false); 41 | } 42 | 43 | @Override 44 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { 45 | super.onViewCreated(view, savedInstanceState); 46 | 47 | effectView = (GPUImageView) view.findViewById(R.id.effectsview); 48 | 49 | LinearLayoutManager linearLayoutManager = 50 | new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false); 51 | 52 | recyclerView = (RecyclerView) view.findViewById(R.id.rc_filter); 53 | recyclerView.setHasFixedSize(true); 54 | recyclerView.setLayoutManager(linearLayoutManager); 55 | 56 | final FilterAdapterGPU adapter = new FilterAdapterGPU(getActivity()); 57 | recyclerView.setAdapter(adapter); 58 | 59 | recyclerView.addOnItemTouchListener(new RecyclerItemClickListener(getActivity(), new RecyclerItemClickListener.OnItemClickListener() { 60 | @Override 61 | public void onItemClick(View view, int position) { 62 | applyEffect(adapter.getItem(position)); 63 | } 64 | })); 65 | } 66 | 67 | @Override 68 | public void onActivityCreated(@Nullable Bundle savedInstanceState) { 69 | super.onActivityCreated(savedInstanceState); 70 | init(); 71 | } 72 | 73 | private void init(){ 74 | image = ((BitmapDrawable) ContextCompat.getDrawable(getActivity(), R.drawable.nabilah)).getBitmap(); 75 | effectView.setImage(image); 76 | } 77 | 78 | private void applyEffect(FilterType filterType) { 79 | if (filterType == null) { 80 | applyEffect(new GPUImageFilter()); 81 | return; 82 | } 83 | 84 | switch (filterType) { 85 | case GRAYSCALE: 86 | applyEffect(new GPUImageGrayscaleFilter()); 87 | break; 88 | case TOON: 89 | applyEffect(new GPUImageToonFilter()); 90 | break; 91 | case VIGNETTE: 92 | applyEffect(new GPUImageVignetteFilter()); 93 | break; 94 | case INVERT: 95 | applyEffect(new GPUImageColorInvertFilter()); 96 | break; 97 | case SKETCH: 98 | applyEffect(new GPUImageSketchFilter()); 99 | break; 100 | } 101 | } 102 | 103 | private void applyEffect(final GPUImageFilter filter) { 104 | effectView.setFilter(filter); 105 | } 106 | } -------------------------------------------------------------------------------- /app/src/main/java/com/inagata/imageeffects/Fragment/LayerDrawableFragment.java: -------------------------------------------------------------------------------- 1 | package com.inagata.imageeffects.Fragment; 2 | 3 | import android.content.res.Resources; 4 | import android.graphics.drawable.Drawable; 5 | import android.os.Bundle; 6 | import android.support.v4.app.Fragment; 7 | import android.support.v7.widget.LinearLayoutManager; 8 | import android.support.v7.widget.RecyclerView; 9 | import android.view.LayoutInflater; 10 | import android.view.View; 11 | import android.view.ViewGroup; 12 | import android.widget.ImageView; 13 | 14 | import com.inagata.imageeffects.Adapter.FilterAdapterDrawable; 15 | import com.inagata.imageeffects.R; 16 | import com.inagata.imageeffects.Utilities.RecyclerItemClickListener; 17 | 18 | 19 | public class LayerDrawableFragment extends Fragment { 20 | private ImageView testimage; 21 | private RecyclerView recList; 22 | 23 | @Override 24 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 25 | View view = inflater.inflate(R.layout.imf_layer_drawable, container, false); 26 | testimage = (ImageView) view.findViewById(R.id.testimage); 27 | 28 | LinearLayoutManager layoutManager 29 | = new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false); 30 | 31 | recList = (RecyclerView) view.findViewById(R.id.rc_filter); 32 | recList.setHasFixedSize(true); 33 | recList.setLayoutManager(layoutManager); 34 | 35 | FilterAdapterDrawable filterAdapter = new FilterAdapterDrawable(getActivity()); 36 | recList.setAdapter(filterAdapter); 37 | 38 | recList.addOnItemTouchListener(new RecyclerItemClickListener(getActivity(), new RecyclerItemClickListener.OnItemClickListener() { 39 | @Override 40 | public void onItemClick(View view, int position) { 41 | updateImage(position); 42 | } 43 | })); 44 | 45 | return view; 46 | } 47 | public void updateImage(int position){ 48 | Resources r = getResources(); 49 | Drawable[] layers = new Drawable[2]; 50 | layers[0] = r.getDrawable(R.drawable.nabilah); 51 | switch (position) { 52 | case 0: 53 | layers[1] = r.getDrawable(R.drawable.wall1box); 54 | layers[1].setAlpha(90); 55 | break; 56 | 57 | case 1: 58 | layers[1] = r.getDrawable(R.drawable.wall2box); 59 | layers[1].setAlpha(90); 60 | break; 61 | 62 | case 2: 63 | layers[1] = r.getDrawable(R.drawable.wall3box); 64 | layers[1].setAlpha(90); 65 | break; 66 | 67 | case 3: 68 | layers[1] = r.getDrawable(R.drawable.wall4box); 69 | layers[1].setAlpha(90); 70 | break; 71 | 72 | case 4: 73 | layers[1] = r.getDrawable(R.drawable.wall5box); 74 | layers[1].setAlpha(90); 75 | break; 76 | 77 | case 5: 78 | layers[1] = r.getDrawable(R.drawable.wall6box); 79 | layers[1].setAlpha(90); 80 | break; 81 | 82 | case 6: 83 | layers[1] = r.getDrawable(R.drawable.wall7box); 84 | layers[1].setAlpha(90); 85 | break; 86 | 87 | case 7: 88 | layers[1] = r.getDrawable(R.drawable.wall8box); 89 | layers[1].setAlpha(90); 90 | break; 91 | 92 | case 8: 93 | layers[1] = r.getDrawable(R.drawable.wall9box); 94 | layers[1].setAlpha(90); 95 | break; 96 | 97 | case 9: 98 | layers[1] = r.getDrawable(R.drawable.wall10box); 99 | layers[1].setAlpha(90); 100 | break; 101 | 102 | case 10: 103 | layers[1] = r.getDrawable(R.drawable.wall11box); 104 | layers[1].setAlpha(90); 105 | break; 106 | 107 | case 11: 108 | layers[1] = r.getDrawable(R.drawable.wall12box); 109 | layers[1].setAlpha(90); 110 | break; 111 | } 112 | android.graphics.drawable.LayerDrawable layerDrawable = new android.graphics.drawable.LayerDrawable(layers); 113 | testimage.setImageDrawable(layerDrawable); 114 | testimage.destroyDrawingCache(); 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /app/src/main/java/com/inagata/imageeffects/Utilities/FilterType.java: -------------------------------------------------------------------------------- 1 | package com.inagata.imageeffects.Utilities; 2 | 3 | public enum FilterType{ 4 | GRAYSCALE, TOON, VIGNETTE, INVERT, SKETCH 5 | } -------------------------------------------------------------------------------- /app/src/main/java/com/inagata/imageeffects/Utilities/GLToolbox.java: -------------------------------------------------------------------------------- 1 | package com.inagata.imageeffects.Utilities; 2 | import android.opengl.GLES20; 3 | 4 | public class GLToolbox { 5 | 6 | public static int loadShader(int shaderType, String source) { 7 | int shader = GLES20.glCreateShader(shaderType); 8 | if (shader != 0) { 9 | GLES20.glShaderSource(shader, source); 10 | GLES20.glCompileShader(shader); 11 | int[] compiled = new int[1]; 12 | GLES20.glGetShaderiv(shader, GLES20.GL_COMPILE_STATUS, compiled, 0); 13 | if (compiled[0] == 0) { 14 | String info = GLES20.glGetShaderInfoLog(shader); 15 | GLES20.glDeleteShader(shader); 16 | shader = 0; 17 | throw new RuntimeException("Could not compile shader " + 18 | shaderType + ":" + info); 19 | } 20 | } 21 | return shader; 22 | } 23 | 24 | public static int createProgram(String vertexSource, 25 | String fragmentSource) { 26 | int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, vertexSource); 27 | if (vertexShader == 0) { 28 | return 0; 29 | } 30 | int pixelShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentSource); 31 | if (pixelShader == 0) { 32 | return 0; 33 | } 34 | 35 | int program = GLES20.glCreateProgram(); 36 | if (program != 0) { 37 | GLES20.glAttachShader(program, vertexShader); 38 | checkGlError("glAttachShader"); 39 | GLES20.glAttachShader(program, pixelShader); 40 | checkGlError("glAttachShader"); 41 | GLES20.glLinkProgram(program); 42 | int[] linkStatus = new int[1]; 43 | GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, linkStatus, 44 | 0); 45 | if (linkStatus[0] != GLES20.GL_TRUE) { 46 | String info = GLES20.glGetProgramInfoLog(program); 47 | GLES20.glDeleteProgram(program); 48 | program = 0; 49 | throw new RuntimeException("Could not link program: " + info); 50 | } 51 | } 52 | return program; 53 | } 54 | 55 | public static void checkGlError(String op) { 56 | int error; 57 | while ((error = GLES20.glGetError()) != GLES20.GL_NO_ERROR) { 58 | throw new RuntimeException(op + ": glError " + error); 59 | } 60 | } 61 | 62 | public static void initTexParams() { 63 | GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, 64 | GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR); 65 | GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, 66 | GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR); 67 | GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, 68 | GLES20.GL_CLAMP_TO_EDGE); 69 | GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, 70 | GLES20.GL_CLAMP_TO_EDGE); 71 | } 72 | 73 | } -------------------------------------------------------------------------------- /app/src/main/java/com/inagata/imageeffects/Utilities/RecyclerItemClickListener.java: -------------------------------------------------------------------------------- 1 | package com.inagata.imageeffects.Utilities; 2 | 3 | /** 4 | * Created by mnafian on 6/17/15. 5 | */ 6 | 7 | import android.content.Context; 8 | import android.support.v7.widget.RecyclerView; 9 | import android.view.GestureDetector; 10 | import android.view.MotionEvent; 11 | import android.view.View; 12 | 13 | public class RecyclerItemClickListener implements RecyclerView.OnItemTouchListener { 14 | GestureDetector mGestureDetector; 15 | private OnItemClickListener mListener; 16 | 17 | public RecyclerItemClickListener(Context context, OnItemClickListener listener) { 18 | mListener = listener; 19 | mGestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() { 20 | @Override 21 | public boolean onSingleTapUp(MotionEvent e) { 22 | return true; 23 | } 24 | }); 25 | } 26 | 27 | @Override 28 | public boolean onInterceptTouchEvent(RecyclerView view, MotionEvent e) { 29 | View childView = view.findChildViewUnder(e.getX(), e.getY()); 30 | if (childView != null && mListener != null && mGestureDetector.onTouchEvent(e)) { 31 | mListener.onItemClick(childView, view.getChildPosition(childView)); 32 | } 33 | return false; 34 | } 35 | 36 | @Override 37 | public void onTouchEvent(RecyclerView view, MotionEvent motionEvent) { 38 | } 39 | 40 | @Override 41 | public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) { 42 | 43 | } 44 | 45 | public interface OnItemClickListener { 46 | public void onItemClick(View view, int position); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /app/src/main/java/com/inagata/imageeffects/Utilities/TextureRenderer.java: -------------------------------------------------------------------------------- 1 | package com.inagata.imageeffects.Utilities; 2 | import android.opengl.GLES20; 3 | 4 | import java.nio.ByteBuffer; 5 | import java.nio.ByteOrder; 6 | import java.nio.FloatBuffer; 7 | 8 | public class TextureRenderer { 9 | 10 | private int mProgram; 11 | private int mTexSamplerHandle; 12 | private int mTexCoordHandle; 13 | private int mPosCoordHandle; 14 | 15 | private FloatBuffer mTexVertices; 16 | private FloatBuffer mPosVertices; 17 | 18 | private int mViewWidth; 19 | private int mViewHeight; 20 | 21 | private int mTexWidth; 22 | private int mTexHeight; 23 | 24 | private static final String VERTEX_SHADER = 25 | "attribute vec4 a_position;\n" + 26 | "attribute vec2 a_texcoord;\n" + 27 | "varying vec2 v_texcoord;\n" + 28 | "void main() {\n" + 29 | " gl_Position = a_position;\n" + 30 | " v_texcoord = a_texcoord;\n" + 31 | "}\n"; 32 | 33 | private static final String FRAGMENT_SHADER = 34 | "precision mediump float;\n" + 35 | "uniform sampler2D tex_sampler;\n" + 36 | "varying vec2 v_texcoord;\n" + 37 | "void main() {\n" + 38 | " gl_FragColor = texture2D(tex_sampler, v_texcoord);\n" + 39 | "}\n"; 40 | 41 | private static final float[] TEX_VERTICES = { 42 | 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f 43 | }; 44 | 45 | private static final float[] POS_VERTICES = { 46 | -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, 1.0f 47 | }; 48 | 49 | private static final int FLOAT_SIZE_BYTES = 4; 50 | 51 | public void init() { 52 | // Create program 53 | mProgram = GLToolbox.createProgram(VERTEX_SHADER, FRAGMENT_SHADER); 54 | 55 | // Bind attributes and uniforms 56 | mTexSamplerHandle = GLES20.glGetUniformLocation(mProgram, 57 | "tex_sampler"); 58 | mTexCoordHandle = GLES20.glGetAttribLocation(mProgram, "a_texcoord"); 59 | mPosCoordHandle = GLES20.glGetAttribLocation(mProgram, "a_position"); 60 | 61 | // Setup coordinate buffers 62 | mTexVertices = ByteBuffer.allocateDirect( 63 | TEX_VERTICES.length * FLOAT_SIZE_BYTES) 64 | .order(ByteOrder.nativeOrder()).asFloatBuffer(); 65 | mTexVertices.put(TEX_VERTICES).position(0); 66 | mPosVertices = ByteBuffer.allocateDirect( 67 | POS_VERTICES.length * FLOAT_SIZE_BYTES) 68 | .order(ByteOrder.nativeOrder()).asFloatBuffer(); 69 | mPosVertices.put(POS_VERTICES).position(0); 70 | } 71 | 72 | public void tearDown() { 73 | GLES20.glDeleteProgram(mProgram); 74 | } 75 | 76 | public void updateTextureSize(int texWidth, int texHeight) { 77 | mTexWidth = texWidth; 78 | mTexHeight = texHeight; 79 | computeOutputVertices(); 80 | } 81 | 82 | public void updateViewSize(int viewWidth, int viewHeight) { 83 | mViewWidth = viewWidth; 84 | mViewHeight = viewHeight; 85 | computeOutputVertices(); 86 | } 87 | 88 | public void renderTexture(int texId) { 89 | // Bind default FBO 90 | GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0); 91 | 92 | // Use our shader program 93 | GLES20.glUseProgram(mProgram); 94 | GLToolbox.checkGlError("glUseProgram"); 95 | 96 | // Set viewport 97 | GLES20.glViewport(0, 0, mViewWidth, mViewHeight); 98 | GLToolbox.checkGlError("glViewport"); 99 | 100 | // Disable blending 101 | GLES20.glDisable(GLES20.GL_BLEND); 102 | 103 | // Set the vertex attributes 104 | GLES20.glVertexAttribPointer(mTexCoordHandle, 2, GLES20.GL_FLOAT, false, 105 | 0, mTexVertices); 106 | GLES20.glEnableVertexAttribArray(mTexCoordHandle); 107 | GLES20.glVertexAttribPointer(mPosCoordHandle, 2, GLES20.GL_FLOAT, false, 108 | 0, mPosVertices); 109 | GLES20.glEnableVertexAttribArray(mPosCoordHandle); 110 | GLToolbox.checkGlError("vertex attribute setup"); 111 | 112 | // Set the input texture 113 | GLES20.glActiveTexture(GLES20.GL_TEXTURE0); 114 | GLToolbox.checkGlError("glActiveTexture"); 115 | GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texId); 116 | GLToolbox.checkGlError("glBindTexture"); 117 | GLES20.glUniform1i(mTexSamplerHandle, 0); 118 | 119 | // Draw 120 | GLES20.glClearColor(0.0f, 0.0f, 0.0f, 1.0f); 121 | GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT); 122 | GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4); 123 | } 124 | 125 | private void computeOutputVertices() { 126 | if (mPosVertices != null) { 127 | float imgAspectRatio = mTexWidth / (float)mTexHeight; 128 | float viewAspectRatio = mViewWidth / (float)mViewHeight; 129 | float relativeAspectRatio = viewAspectRatio / imgAspectRatio; 130 | float x0, y0, x1, y1; 131 | if (relativeAspectRatio > 1.0f) { 132 | x0 = -1.0f / relativeAspectRatio; 133 | y0 = -1.0f; 134 | x1 = 1.0f / relativeAspectRatio; 135 | y1 = 1.0f; 136 | } else { 137 | x0 = -1.0f; 138 | y0 = -relativeAspectRatio; 139 | x1 = 1.0f; 140 | y1 = relativeAspectRatio; 141 | } 142 | float[] coords = new float[] { x0, y0, x1, y0, x0, y1, x1, y1 }; 143 | mPosVertices.put(coords).position(0); 144 | } 145 | } 146 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-hdpi/ic_dashboard.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_discuss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-hdpi/ic_discuss.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-hdpi/ic_done.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_event.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-hdpi/ic_event.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_forum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-hdpi/ic_forum.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_graphic_eq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-hdpi/ic_graphic_eq.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_headset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-hdpi/ic_headset.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-hdpi/ic_menu.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-mdpi/ic_dashboard.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_discuss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-mdpi/ic_discuss.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-mdpi/ic_done.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_event.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-mdpi/ic_event.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_forum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-mdpi/ic_forum.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_graphic_eq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-mdpi/ic_graphic_eq.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_headset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-mdpi/ic_headset.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-mdpi/ic_menu.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-xhdpi/ic_dashboard.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_discuss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-xhdpi/ic_discuss.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-xhdpi/ic_done.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_event.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-xhdpi/ic_event.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_forum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-xhdpi/ic_forum.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_graphic_eq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-xhdpi/ic_graphic_eq.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_headset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-xhdpi/ic_headset.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-xhdpi/ic_menu.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-xxhdpi/ic_dashboard.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_discuss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-xxhdpi/ic_discuss.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-xxhdpi/ic_done.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_event.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-xxhdpi/ic_event.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_forum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-xxhdpi/ic_forum.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_graphic_eq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-xxhdpi/ic_graphic_eq.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_headset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-xxhdpi/ic_headset.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-xxhdpi/ic_menu.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-xxxhdpi/ic_done.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_graphic_eq.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-xxxhdpi/ic_graphic_eq.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable-xxxhdpi/ic_menu.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/logo_oke.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable/logo_oke.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/nabilah.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable/nabilah.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/wall10box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable/wall10box.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/wall11box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable/wall11box.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/wall12box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable/wall12box.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/wall1box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable/wall1box.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/wall2box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable/wall2box.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/wall3box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable/wall3box.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/wall4box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable/wall4box.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/wall5box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable/wall5box.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/wall6box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable/wall6box.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/wall7box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable/wall7box.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/wall8box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable/wall8box.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/wall9box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/drawable/wall9box.png -------------------------------------------------------------------------------- /app/src/main/res/layout/imf_aboutme.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 22 | 23 | 24 | 25 | 30 | 31 | 39 | 40 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /app/src/main/res/layout/imf_effect_factory.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 16 | 17 | 22 | 23 | 24 | 25 | 32 | 33 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /app/src/main/res/layout/imf_filter_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/layout/imf_gpu.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 16 | 17 | 22 | 23 | 24 | 25 | 32 | 33 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /app/src/main/res/layout/imf_layer_drawable.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 17 | 18 | 25 | 26 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/res/layout/imf_mainmenu_layout.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/layout/imf_mainpage.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 24 | 25 | 30 | 31 | 38 | 39 | 40 | 41 | 46 | 47 | -------------------------------------------------------------------------------- /app/src/main/res/layout/imf_nav_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 26 | 27 | 35 | 36 | 42 | 43 | -------------------------------------------------------------------------------- /app/src/main/res/menu/about_githubmenu.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/menu/drawer_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 13 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #4CAF50 5 | #1B5E20 6 | #E8F5E9 7 | 8 | #212121 9 | #000000 10 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | 256dp 7 | 16dp 8 | 16dp 9 | 40dp 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ImageEffects 3 | 4 | Hello world! 5 | Settings 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 15 | 16 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:2.1.2' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | jcenter() 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /device-2015-09-09-211522.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/device-2015-09-09-211522.png -------------------------------------------------------------------------------- /device-2015-09-09-211615.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/device-2015-09-09-211615.png -------------------------------------------------------------------------------- /device-2015-09-09-211705.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/device-2015-09-09-211705.png -------------------------------------------------------------------------------- /device-2015-09-09-211757.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/device-2015-09-09-211757.png -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mnafian/ImageEffectFilter/ea455e4a68f6269168fbbb1687c9dabb5939b2b1/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Jun 15 11:40:15 WIT 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.12-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | --------------------------------------------------------------------------------