Photoview: How to save state of image

Created on 5 May 2017  路  11Comments  路  Source: Baseflow/PhotoView

i just want to save the current state of image in photoview.
when i change the zoom and apply some effects to it then the current state of image restore back to original state and i lose my zoomed state.
i want to keep my current zoomed state and apply effects.
is there any way to lock the panning and translation at the time i want and activate it again when i need

Most helpful comment

Try this:

        Matrix matrix = new Matrix();
        mPhotoView.getAttacher().getSuppMatrix(matrix);
        mPhotoView.setImageBitmap(filteredBitmap);
        mPhotoView.getAttacher().setDisplayMatrix(matrix);

All 11 comments

Try this:

        Matrix matrix = new Matrix();
        mPhotoView.getAttacher().getSuppMatrix(matrix);
        mPhotoView.setImageBitmap(filteredBitmap);
        mPhotoView.getAttacher().setDisplayMatrix(matrix);

getAttacher()
thers nothing like that!!

Are you sure?

am new to this so i might not understand well
it say no such method when i call photoview.getAttacher.

You should check the master branch. There is.

Filter myFilter = new Filter();
Point[] rgbKnots;
rgbKnots = new Point[3];
rgbKnots[0] = new Point(0, 0);
rgbKnots[1] = new Point(161, 86);
rgbKnots[2] = new Point(255, 255);

    myFilter.addSubFilter(new ToneCurveSubfilter(rgbKnots, null, null, null));
    Bitmap outputImage = myFilter.processFilter(gallerytxt);

    Matrix matrix = new Matrix();
    mPhotoView.getAttacher().getSuppMatrix(matrix);
    mPhotoView.setImageBitmap(outputImage );
    mPhotoView.getAttacher().setDisplayMatrix(matrix);

but i cant resolve getAttacher

no its not present in my library

Matrix matrix = new Matrix();
p1.getDisplayMatrix(matrix);
p1.setImageBitmap(outputImage );
p1.setDisplayMatrix(matrix);

is this same as you written
p1 is mphotoview

Since it calls different functions - no it's not the same 馃槤
I won't be able to help you.

@nithinpmolethu Not present in your library? Sounds like you have pulled in the code from PhotoView and are using it for some custom library? If so, this is beyond the scope of this library. Feel free to continue to chat with @vvit about this issue if he is willing to help out, but I am closing this since it is not an actual issue with PhotoView.

Was this page helpful?
0 / 5 - 0 ratings