资源简介

Android下仿Instagram效果的滤镜,包括库以及Demo,可以实现包括Lomo在内的十几种滤镜效果,相当不错

资源截图

代码片段和文件信息

package com.alex.instafilterdemo;

import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.List;

import org.insta.IF1977Filter;
import org.insta.IFAmaroFilter;
import org.insta.IFBrannanFilter;
import org.insta.IFEarlybirdFilter;
import org.insta.IFHefeFilter;
import org.insta.IFHudsonFilter;
import org.insta.IFInkwellFilter;
import org.insta.IFLomofiFilter;
import org.insta.IFLordKelvinFilter;
import org.insta.IFNashvilleFilter;
import org.insta.IFNormalFilter;
import org.insta.IFRiseFilter;
import org.insta.IFSierraFilter;
import org.insta.IFSutroFilter;
import org.insta.IFToasterFilter;
import org.insta.IFValenciaFilter;
import org.insta.IFWaldenFilter;
import org.insta.IFXproIIFilter;
import org.insta.InstaFilter;

import jp.co.cyberagent.android.gpuimage.GPUImageView;
import android.os.Bundle;
import android.os.Environment;
import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.text.TextUtils;
import android.util.Log;
import android.view.ContextMenu;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ContextMenu.ContextMenuInfo;
import android.widget.Toast;

public class MainActivity extends Activity {

private static final String TAG = MainActivity.class.getSimpleName();

private GPUImageView image;

private List names = new ArrayList();

private void initNames() {
for(int i = 0; i < 18; i++) {
     names.add(getFilter(i this).getClass().getSimpleName());
     }
}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

initNames();

image = (GPUImageView)findViewById(R.id.image);

Resources res = getResources();
Bitmap bitmap = BitmapFactory.decodeResource(res R.drawable.hhkb);
image.setImage(bitmap);

registerForContextMenu(image);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
        switch (id) {
            case R.id.action_save:
             saveBitmap();
                break;
                
            case R.id.action_filter:
             openContextMenu(image);
             break;
        }
        return true;
}

    @Override
    public void onCreateContextMenu(ContextMenu menu View v ContextMenuInfo menuInfo) {
     menu.setHeadertitle(“Select Filter“);
    
     int index = 0;
     for(String n : names) {
     menu.add(0 index Menu.NONE n);
     index++;
     }
        
     super.onCreateContextMenu(menu v menuInfo);
    }
    
@Override
public boolean onContextItemSelected(MenuItem item) {
Log.v(TAG “context item seleted ID = “ + item.

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2015-04-11 10:24  InstaFilterDemo\
     文件         466  2015-04-11 09:36  InstaFilterDemo\.classpath
     文件         818  2015-04-11 09:36  InstaFilterDemo\.project
     目录           0  2015-04-11 09:36  InstaFilterDemo\.settings\
     文件         173  2015-04-11 09:36  InstaFilterDemo\.settings\org.eclipse.jdt.core.prefs
     文件        1030  2015-04-11 10:21  InstaFilterDemo\AndroidManifest.xml
     目录           0  2015-04-11 09:36  InstaFilterDemo\assets\
     文件       51394  2015-04-11 09:36  InstaFilterDemo\ic_launcher-web.png
     目录           0  2015-04-11 09:37  InstaFilterDemo\libs\
     文件      484258  2015-04-08 11:39  InstaFilterDemo\libs\android-support-v4.jar
     文件         781  2015-04-11 09:36  InstaFilterDemo\proguard-project.txt
     文件         609  2015-04-11 09:36  InstaFilterDemo\project.properties
     目录           0  2015-04-11 09:36  InstaFilterDemo\res\
     目录           0  2015-04-11 09:36  InstaFilterDemo\res\drawable-hdpi\
     文件        7658  2015-04-11 09:36  InstaFilterDemo\res\drawable-hdpi\ic_launcher.png
     目录           0  2015-04-11 09:36  InstaFilterDemo\res\drawable-ldpi\
     目录           0  2015-04-11 09:36  InstaFilterDemo\res\drawable-mdpi\
     文件        3777  2015-04-11 09:36  InstaFilterDemo\res\drawable-mdpi\ic_launcher.png
     目录           0  2015-04-11 09:39  InstaFilterDemo\res\drawable-xhdpi\
     文件      124566  2015-04-11 09:39  InstaFilterDemo\res\drawable-xhdpi\hhkb.jpg
     文件       12516  2015-04-11 09:36  InstaFilterDemo\res\drawable-xhdpi\ic_launcher.png
     目录           0  2015-04-11 09:36  InstaFilterDemo\res\drawable-xxhdpi\
     文件       24777  2015-04-11 09:36  InstaFilterDemo\res\drawable-xxhdpi\ic_launcher.png
     目录           0  2015-04-11 09:36  InstaFilterDemo\res\layout\
     文件         725  2015-04-11 09:38  InstaFilterDemo\res\layout\activity_main.xml
     目录           0  2015-04-11 09:36  InstaFilterDemo\res\menu\
     文件         393  2015-04-11 09:37  InstaFilterDemo\res\menu\main.xml
     目录           0  2015-04-11 09:36  InstaFilterDemo\res\values\
     文件         213  2015-04-11 09:36  InstaFilterDemo\res\values\dimens.xml
     文件         225  2015-04-11 09:36  InstaFilterDemo\res\values\strings.xml
     文件         680  2015-04-11 09:36  InstaFilterDemo\res\values\styles.xml
............此处省略1743个文件信息

评论

共有 条评论