Android Open Source - ImageCropRotateFilter Base Filter






From Project

Back to project page ImageCropRotateFilter.

License

The source code is released under:

MIT License

If you think the Android project ImageCropRotateFilter listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.sohu.myimageeditor.app.filter;
/*from  w ww.  ja v  a 2s .c  o m*/
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.support.v8.renderscript.Allocation;
import android.support.v8.renderscript.RenderScript;
import android.view.View;
import android.widget.SeekBar;
import android.widget.TextView;

/**
 * Created by wangwang on 14-3-10.
 */
public abstract class BaseFilter {

    private final String TAG = BaseFilter.class.getSimpleName();

    protected RenderScript mRS;
    protected Allocation mInPixelsAllocation;
    protected Allocation mOutPixelsAllocation;
    protected int mWidth;
    protected int mHeight;
    protected Context mContent;

    public void initBaseFilter(Context mContent, RenderScript mRS, int mWidth, int mHeight,
                               Allocation mInPixelsAllocation, Allocation mOutPixelsAllocation) {
        this.mContent = mContent;
        this.mRS = mRS;
        this.mWidth = mWidth;
        this.mHeight = mHeight;
        this.mInPixelsAllocation = mInPixelsAllocation;
        this.mOutPixelsAllocation = mOutPixelsAllocation;

        createFilter(this.mContent.getResources());
    }

    abstract public void createFilter(Resources res);

    abstract public void runFilter();

    public void onBar1Changed(int progress) {
    }

    public boolean onBar1Setup(SeekBar bar) {
        bar.setVisibility(View.GONE);
        return false;
    }

    public void finish() {
        mRS.finish();
    }

    public void destroy() {
    }

    public void update(Bitmap bitmap) {
        mOutPixelsAllocation.copyTo(bitmap);
    }

}




Java Source Code List

com.sohu.myimageeditor.app.MainActivity.java
com.sohu.myimageeditor.app.filter.BWFilter.java
com.sohu.myimageeditor.app.filter.BaseFilter.java
com.sohu.myimageeditor.app.filter.BlurFilter.java
com.sohu.myimageeditor.app.filter.CopyFilter.java
com.sohu.myimageeditor.app.rotater.BaseRotater.java
com.sohu.myimageeditor.app.rotater.CCWRotater.java
com.sohu.myimageeditor.app.rotater.CWRotater.java
com.sohu.myimageeditor.app.widget.CropImageView.java