Android Open Source - ImageCropRotateFilter Base Rotater






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.rotater;
//  w  ww .java  2 s .c o  m
import android.graphics.Bitmap;
import android.graphics.Matrix;

/**
 * Created by wangwang on 14-3-11.
 */
public abstract class BaseRotater {

    protected int mDegree;

    public Bitmap rotate(Bitmap bitmap) {
        Matrix matrix = new Matrix();
        matrix.setRotate(mDegree, (float) bitmap.getWidth() / 2, (float) bitmap.getHeight() / 2);
        try {
            Bitmap rotated = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
            if (bitmap != rotated) {
                bitmap.recycle();
                bitmap = rotated;
            }
        } catch (OutOfMemoryError e) {
            e.printStackTrace();
        }
        return bitmap;
    }

    public void destroy() {
    }

    abstract void setmDegree();

}




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