lmw
2024-09-25 92778728b83ce1a34ba21bcdb061afdeca16cce5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
package com.ypx.imagepicker.widget.cropimage;
 
import android.graphics.RectF;
import android.os.Parcel;
import android.os.Parcelable;
import android.widget.ImageView;
 
import java.io.Serializable;
 
/**
 * Description: 图片基本信息
 * <p>
 * Author: peixing.yang
 * Date: 2019/2/21
 */
public class Info implements Parcelable, Serializable {
    // 控件在窗口的位置
    public RectF mImgRect = new RectF();
    public RectF mWidgetRect = new RectF();
 
    public float mDegrees;
    public float mCropX;
    public float mCropY;
    public String mScaleType;
 
    public float transitX;
    public float transitY;
    public float mScale;
 
    public ImageView.ScaleType getScaleType() {
        return ImageView.ScaleType.valueOf(mScaleType);
    }
 
 
    public Info(RectF img, RectF widget, float degrees, String scaleType, float mCropX,
                float mCropY, float transitX, float transitY, float mScale) {
        mImgRect.set(img);
        mWidgetRect.set(widget);
        mScaleType = scaleType;
        mDegrees = degrees;
        this.mCropX = mCropX;
        this.mCropY = mCropY;
        this.transitX = transitX;
        this.transitY = transitY;
        this.mScale = mScale;
    }
 
    protected Info(Parcel in) {
        mImgRect = in.readParcelable(RectF.class.getClassLoader());
        mWidgetRect = in.readParcelable(RectF.class.getClassLoader());
        mScaleType = in.readString();
        mDegrees = in.readFloat();
        mCropX = in.readFloat();
        mCropY = in.readFloat();
        this.transitX = in.readFloat();;
        this.transitY = in.readFloat();;
        this.mScale = in.readFloat();;
    }
 
    public static final Creator<Info> CREATOR = new Creator<Info>() {
        @Override
        public Info createFromParcel(Parcel in) {
            return new Info(in);
        }
 
        @Override
        public Info[] newArray(int size) {
            return new Info[size];
        }
    };
 
    /**
     * Describe the kinds of special objects contained in this Parcelable
     * instance's marshaled representation. For example, if the object will
     * include a file descriptor in the output of {@link #writeToParcel(Parcel, int)},
     * the return value of this method must include the
     * {@link #CONTENTS_FILE_DESCRIPTOR} bit.
     *
     * @return a bitmask indicating the set of special object types marshaled
     * by this Parcelable object instance.
     */
    @Override
    public int describeContents() {
        return 0;
    }
 
    /**
     * Flatten this object in to a Parcel.
     *
     * @param dest  The Parcel in which the object should be written.
     * @param flags Additional flags about how the object should be written.
     *              May be 0 or {@link #PARCELABLE_WRITE_RETURN_VALUE}.
     */
    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeParcelable(mImgRect, flags);
        dest.writeParcelable(mWidgetRect, flags);
        dest.writeString(mScaleType);
        dest.writeFloat(mDegrees);
        dest.writeFloat(mCropX);
        dest.writeFloat(mCropY);
        dest.writeFloat(transitX);
        dest.writeFloat(transitY);
        dest.writeFloat(mScale);
    }
}