blob: a5b8aafefe314276d416e8af31aec2e86c6662e1 [file] [log] [blame]
David Morrisseyae862192014-05-30 12:38:10 +01001package com.davemorrissey.labs.subscaleview;
2
3import android.graphics.PointF;
4
5import java.io.Serializable;
6
7/**
8 * Wraps the scale, center and orientation of a displayed image for easy restoration on screen rotate.
9 */
David Morrissey4bcab6c2017-12-05 10:25:08 +000010@SuppressWarnings("WeakerAccess")
David Morrisseyae862192014-05-30 12:38:10 +010011public class ImageViewState implements Serializable {
12
David Morrissey51605f62017-12-12 08:01:19 +000013 private final float scale;
David Morrisseyae862192014-05-30 12:38:10 +010014
David Morrissey51605f62017-12-12 08:01:19 +000015 private final float centerX;
David Morrisseyae862192014-05-30 12:38:10 +010016
David Morrissey51605f62017-12-12 08:01:19 +000017 private final float centerY;
David Morrisseyae862192014-05-30 12:38:10 +010018
David Morrissey51605f62017-12-12 08:01:19 +000019 private final int orientation;
David Morrisseyae862192014-05-30 12:38:10 +010020
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}