Home | History | Annotate | Download | only in subscaleview
      1 package com.davemorrissey.labs.subscaleview;
      2 
      3 import android.graphics.PointF;
      4 
      5 import java.io.Serializable;
      6 
      7 /**
      8  * Wraps the scale, center and orientation of a displayed image for easy restoration on screen rotate.
      9  */
     10 @SuppressWarnings("WeakerAccess")
     11 public class ImageViewState implements Serializable {
     12 
     13     private final float scale;
     14 
     15     private final float centerX;
     16 
     17     private final float centerY;
     18 
     19     private final int orientation;
     20 
     21     public ImageViewState(float scale, PointF center, int orientation) {
     22         this.scale = scale;
     23         this.centerX = center.x;
     24         this.centerY = center.y;
     25         this.orientation = orientation;
     26     }
     27 
     28     public float getScale() {
     29         return scale;
     30     }
     31 
     32     public PointF getCenter() {
     33         return new PointF(centerX, centerY);
     34     }
     35 
     36     public int getOrientation() {
     37         return orientation;
     38     }
     39 
     40 }
     41