David Morrissey | ae86219 | 2014-05-30 12:38:10 +0100 | [diff] [blame] | 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 | */ |
David Morrissey | 4bcab6c | 2017-12-05 10:25:08 +0000 | [diff] [blame] | 10 | @SuppressWarnings("WeakerAccess") |
David Morrissey | ae86219 | 2014-05-30 12:38:10 +0100 | [diff] [blame] | 11 | public class ImageViewState implements Serializable { |
| 12 | |
David Morrissey | 51605f6 | 2017-12-12 08:01:19 +0000 | [diff] [blame] | 13 | private final float scale; |
David Morrissey | ae86219 | 2014-05-30 12:38:10 +0100 | [diff] [blame] | 14 | |
David Morrissey | 51605f6 | 2017-12-12 08:01:19 +0000 | [diff] [blame] | 15 | private final float centerX; |
David Morrissey | ae86219 | 2014-05-30 12:38:10 +0100 | [diff] [blame] | 16 | |
David Morrissey | 51605f6 | 2017-12-12 08:01:19 +0000 | [diff] [blame] | 17 | private final float centerY; |
David Morrissey | ae86219 | 2014-05-30 12:38:10 +0100 | [diff] [blame] | 18 | |
David Morrissey | 51605f6 | 2017-12-12 08:01:19 +0000 | [diff] [blame] | 19 | private final int orientation; |
David Morrissey | ae86219 | 2014-05-30 12:38:10 +0100 | [diff] [blame] | 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 | } |