19fc12334a7d14347cd6951d0653264b2597bd3a0Sam Juddpackage com.bumptech.glide.load;
2c27229a159bfc992874609270ab8b57981fef339Sam Judd
3b7c7c2b2505f996dbda219faeb0d08dc1c9982d7Sam Juddimport com.bumptech.glide.load.engine.Resource;
4c27229a159bfc992874609270ab8b57981fef339Sam Judd
5c27229a159bfc992874609270ab8b57981fef339Sam Judd/**
6c27229a159bfc992874609270ab8b57981fef339Sam Judd * A class for performing an arbitrary transformation on a bitmap
731b60a4ba485dcc22e5edd19c6768e1141c32f4eSam Judd * @param <T> The type of the resource being transformed.
8c27229a159bfc992874609270ab8b57981fef339Sam Judd */
931b60a4ba485dcc22e5edd19c6768e1141c32f4eSam Juddpublic interface Transformation<T> {
10c27229a159bfc992874609270ab8b57981fef339Sam Judd
11c27229a159bfc992874609270ab8b57981fef339Sam Judd    /**
12c27229a159bfc992874609270ab8b57981fef339Sam Judd     * Transform the given bitmap. It is also acceptable to simply return the given bitmap if no transformation is
13c27229a159bfc992874609270ab8b57981fef339Sam Judd     * required.
14c27229a159bfc992874609270ab8b57981fef339Sam Judd     *
1531b60a4ba485dcc22e5edd19c6768e1141c32f4eSam Judd     * @param resource The resource to transform
16c27229a159bfc992874609270ab8b57981fef339Sam Judd     * @param outWidth The width of the view or target the bitmap will be displayed in
17c27229a159bfc992874609270ab8b57981fef339Sam Judd     * @param outHeight The height of the view or target the bitmap will be displayed in
18c27229a159bfc992874609270ab8b57981fef339Sam Judd     * @return The transformed bitmap
19c27229a159bfc992874609270ab8b57981fef339Sam Judd     */
2031b60a4ba485dcc22e5edd19c6768e1141c32f4eSam Judd    public abstract Resource<T> transform(Resource<T> resource, int outWidth, int outHeight);
21c27229a159bfc992874609270ab8b57981fef339Sam Judd
22c27229a159bfc992874609270ab8b57981fef339Sam Judd    /**
2331b60a4ba485dcc22e5edd19c6768e1141c32f4eSam Judd     * A method to get a unique identifier for this particular transformation that can be used as part of a cache key.
2431b60a4ba485dcc22e5edd19c6768e1141c32f4eSam Judd     * The fully qualified class name for this class is appropriate if written out, but getClass().getName() is not
2531b60a4ba485dcc22e5edd19c6768e1141c32f4eSam Judd     * because the name may be changed by proguard.
26c27229a159bfc992874609270ab8b57981fef339Sam Judd     *
27c27229a159bfc992874609270ab8b57981fef339Sam Judd     * @return A string that uniquely identifies this transformation from other transformations
28c27229a159bfc992874609270ab8b57981fef339Sam Judd     */
2931b60a4ba485dcc22e5edd19c6768e1141c32f4eSam Judd    public String getId();
30c27229a159bfc992874609270ab8b57981fef339Sam Judd}
31