@nativescript-community/ui-image 4.6.6 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/README.md +4 -20
- package/index-common.d.ts +47 -18
- package/index-common.js +5 -69
- package/index-common.js.map +1 -1
- package/index.android.d.ts +33 -60
- package/index.android.js +597 -702
- package/index.android.js.map +1 -1
- package/index.d.ts +17 -92
- package/index.ios.d.ts +5 -10
- package/index.ios.js +72 -54
- package/index.ios.js.map +1 -1
- package/package.json +4 -4
- package/platforms/android/include.gradle +21 -16
- package/platforms/android/java/com/nativescript/image/CacheKeyStore.java +65 -0
- package/platforms/android/java/com/nativescript/image/CapturingEngineKeyFactory.java +43 -0
- package/platforms/android/java/com/nativescript/image/CompositeRequestListener.java +58 -0
- package/platforms/android/java/com/nativescript/image/ConditionalCrossFadeFactory.java +33 -0
- package/platforms/android/java/com/nativescript/image/CustomDataFetcher.java +124 -0
- package/platforms/android/java/com/nativescript/image/CustomGlideModule.java +220 -0
- package/platforms/android/java/com/nativescript/image/CustomGlideUrl.java +52 -0
- package/platforms/android/java/com/nativescript/image/CustomUrlLoader.java +74 -0
- package/platforms/android/java/com/nativescript/image/EvictionManager.java +735 -0
- package/platforms/android/java/com/nativescript/image/ExtractRequestOptions.java +109 -0
- package/platforms/android/java/com/nativescript/image/ImageLoadSourceCallback.java +5 -0
- package/platforms/android/java/com/nativescript/image/ImageProgressCallback.java +5 -0
- package/platforms/android/java/com/nativescript/image/LoadSourceInterceptor.java +28 -0
- package/platforms/android/java/com/nativescript/image/MatrixDrawable.java +200 -0
- package/platforms/android/java/com/nativescript/image/MatrixDrawableImageViewTarget.java +154 -0
- package/platforms/android/java/com/nativescript/image/MatrixImageView.java +696 -0
- package/platforms/android/java/com/nativescript/image/ProgressInterceptor.java +25 -0
- package/platforms/android/java/com/nativescript/image/ProgressResponseBody.java +70 -0
- package/platforms/android/java/com/nativescript/image/RecordingDigest.java +48 -0
- package/platforms/android/java/com/nativescript/image/RecreatedResourceKey.java +95 -0
- package/platforms/android/java/com/nativescript/image/SaveKeysRequestListener.java +145 -0
- package/platforms/android/java/com/nativescript/image/ScaleUtils.java +129 -0
- package/platforms/android/java/com/nativescript/image/SharedPrefCacheKeyStore.java +92 -0
- package/platforms/android/native-api-usage.json +39 -37
- package/platforms/ios/Podfile +1 -1
- package/references.d.ts +0 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/typings/android.d.ts +4 -27
- package/typings/glide.android.d.ts +9395 -0
- package/typings/glide.okhttp.android.d.ts +104 -0
- package/typings/glide.transform.android.d.ts +540 -0
- package/typings/ui_image.android.d.ts +517 -0
- package/platforms/android/java/com/nativescript/image/BaseDataSubscriber.java +0 -22
- package/platforms/android/java/com/nativescript/image/BaseDataSubscriberListener.java +0 -9
- package/platforms/android/java/com/nativescript/image/DraweeView.java +0 -371
- package/platforms/android/java/com/nativescript/image/NetworkImageRequest.java +0 -55
- package/platforms/android/java/com/nativescript/image/OkHttpNetworkFetcher.java +0 -56
- package/platforms/android/java/com/nativescript/image/ScalingBlurPostprocessor.java +0 -64
- package/platforms/android/java/com/nativescript/image/ScalingUtils.java +0 -519
- package/typings/fresco-processors.d.ts +0 -53
- package/typings/fresco.d.ts +0 -12070
|
@@ -1,519 +0,0 @@
|
|
|
1
|
-
package com.nativescript.image;
|
|
2
|
-
|
|
3
|
-
import android.graphics.Matrix;
|
|
4
|
-
import android.graphics.PointF;
|
|
5
|
-
import android.graphics.Rect;
|
|
6
|
-
import android.util.Log;
|
|
7
|
-
|
|
8
|
-
/** Performs scale type calculations. */
|
|
9
|
-
public class ScalingUtils {
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Options for scaling the child bounds to the parent bounds.
|
|
13
|
-
*
|
|
14
|
-
* <p>Similar to {@link android.widget.ImageView.ScaleType}, but ScaleType.MATRIX is not
|
|
15
|
-
* supported. To use matrix scaling, use a {@link MatrixDrawable}. An additional scale type
|
|
16
|
-
* (FOCUS_CROP) is provided.
|
|
17
|
-
*
|
|
18
|
-
* <p>
|
|
19
|
-
*/
|
|
20
|
-
public interface ScaleType {
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Scales width and height independently, so that the child matches the parent exactly. This may
|
|
24
|
-
* change the aspect ratio of the child.
|
|
25
|
-
*/
|
|
26
|
-
com.facebook.drawee.drawable.ScalingUtils.ScaleType FIT_XY = ScaleTypeFitXY.INSTANCE;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Scales the child so that the child's width fits exactly. The height will be cropped if it
|
|
30
|
-
* exceeds parent's bounds. Aspect ratio is preserved. Child is centered within the parent's
|
|
31
|
-
* bounds.
|
|
32
|
-
*/
|
|
33
|
-
com.facebook.drawee.drawable.ScalingUtils.ScaleType FIT_X = ScaleTypeFitX.INSTANCE;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Scales the child so that the child's height fits exactly. The width will be cropped if it
|
|
37
|
-
* exceeds parent's bounds. Aspect ratio is preserved. Child is centered within the parent's
|
|
38
|
-
* bounds.
|
|
39
|
-
*/
|
|
40
|
-
com.facebook.drawee.drawable.ScalingUtils.ScaleType FIT_Y = ScaleTypeFitY.INSTANCE;
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Scales the child so that it fits entirely inside the parent. At least one dimension (width or
|
|
44
|
-
* height) will fit exactly. Aspect ratio is preserved. Child is aligned to the top-left corner
|
|
45
|
-
* of the parent.
|
|
46
|
-
*/
|
|
47
|
-
com.facebook.drawee.drawable.ScalingUtils.ScaleType FIT_START = ScaleTypeFitStart.INSTANCE;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Scales the child so that it fits entirely inside the parent. At least one dimension (width or
|
|
51
|
-
* height) will fit exactly. Aspect ratio is preserved. Child is centered within the parent's
|
|
52
|
-
* bounds.
|
|
53
|
-
*/
|
|
54
|
-
com.facebook.drawee.drawable.ScalingUtils.ScaleType FIT_CENTER = ScaleTypeFitCenter.INSTANCE;
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Scales the child so that it fits entirely inside the parent. At least one dimension (width or
|
|
58
|
-
* height) will fit exactly. Aspect ratio is preserved. Child is aligned to the bottom-right
|
|
59
|
-
* corner of the parent.
|
|
60
|
-
*/
|
|
61
|
-
com.facebook.drawee.drawable.ScalingUtils.ScaleType FIT_END = ScaleTypeFitEnd.INSTANCE;
|
|
62
|
-
|
|
63
|
-
/** Performs no scaling. Child is centered within parent's bounds. */
|
|
64
|
-
com.facebook.drawee.drawable.ScalingUtils.ScaleType CENTER = ScaleTypeCenter.INSTANCE;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Scales the child so that it fits entirely inside the parent. Unlike FIT_CENTER, if the child
|
|
68
|
-
* is smaller, no up-scaling will be performed. Aspect ratio is preserved. Child is centered
|
|
69
|
-
* within parent's bounds.
|
|
70
|
-
*/
|
|
71
|
-
com.facebook.drawee.drawable.ScalingUtils.ScaleType CENTER_INSIDE = ScaleTypeCenterInside.INSTANCE;
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Scales the child so that both dimensions will be greater than or equal to the corresponding
|
|
75
|
-
* dimension of the parent. At least one dimension (width or height) will fit exactly. Child is
|
|
76
|
-
* centered within parent's bounds.
|
|
77
|
-
*/
|
|
78
|
-
com.facebook.drawee.drawable.ScalingUtils.ScaleType CENTER_CROP = ScaleTypeCenterCrop.INSTANCE;
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Scales the child so that both dimensions will be greater than or equal to the corresponding
|
|
82
|
-
* dimension of the parent. At least one dimension (width or height) will fit exactly. The
|
|
83
|
-
* child's focus point will be centered within the parent's bounds as much as possible without
|
|
84
|
-
* leaving empty space. It is guaranteed that the focus point will be visible and centered as
|
|
85
|
-
* much as possible. If the focus point is set to (0.5f, 0.5f), result will be equivalent to
|
|
86
|
-
* CENTER_CROP.
|
|
87
|
-
*/
|
|
88
|
-
com.facebook.drawee.drawable.ScalingUtils.ScaleType FOCUS_CROP = ScaleTypeFocusCrop.INSTANCE;
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Scales the child so that it fits entirely inside the parent. At least one dimension (width or
|
|
92
|
-
* height) will fit exactly. Aspect ratio is preserved. Child is aligned to the bottom-left
|
|
93
|
-
* corner of the parent.
|
|
94
|
-
*/
|
|
95
|
-
com.facebook.drawee.drawable.ScalingUtils.ScaleType FIT_BOTTOM_START = ScaleTypeFitBottomStart.INSTANCE;
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Gets transformation matrix based on the scale type.
|
|
99
|
-
*
|
|
100
|
-
* @param outTransform out matrix to store result
|
|
101
|
-
* @param parentBounds parent bounds
|
|
102
|
-
* @param childWidth child width
|
|
103
|
-
* @param childHeight child height
|
|
104
|
-
* @param focusX focus point x coordinate, relative [0...1]
|
|
105
|
-
* @param focusY focus point y coordinate, relative [0...1]
|
|
106
|
-
* @return same reference to the out matrix for convenience
|
|
107
|
-
*/
|
|
108
|
-
Matrix getTransform(
|
|
109
|
-
Matrix outTransform,
|
|
110
|
-
Rect parentBounds,
|
|
111
|
-
int childWidth,
|
|
112
|
-
int childHeight,
|
|
113
|
-
float focusX,
|
|
114
|
-
float focusY);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
/** A convenience base class that has some common logic. */
|
|
120
|
-
public abstract static class AbstractScaleType implements com.facebook.drawee.drawable.ScalingUtils.ScaleType, com.facebook.drawee.drawable.ScalingUtils.StatefulScaleType {
|
|
121
|
-
protected Matrix _imageMatrix = null;
|
|
122
|
-
protected float _imageRotation = 0;
|
|
123
|
-
public void setImageMatrix(Matrix matrix) {
|
|
124
|
-
_imageMatrix = matrix;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
public float getImageRotation() {
|
|
128
|
-
return _imageRotation;
|
|
129
|
-
}
|
|
130
|
-
public void setImageRotation(float rotation) {
|
|
131
|
-
_imageRotation = rotation;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
@Override
|
|
135
|
-
public Object getState() {
|
|
136
|
-
if (_imageMatrix != null) {
|
|
137
|
-
return _imageMatrix;
|
|
138
|
-
}
|
|
139
|
-
return _imageRotation;
|
|
140
|
-
}
|
|
141
|
-
@Override
|
|
142
|
-
public Matrix getTransform(
|
|
143
|
-
Matrix outTransform,
|
|
144
|
-
Rect parentRect,
|
|
145
|
-
int childWidth,
|
|
146
|
-
int childHeight,
|
|
147
|
-
float focusX,
|
|
148
|
-
float focusY) {
|
|
149
|
-
float sX = (float) parentRect.width() / (float) childWidth;
|
|
150
|
-
float sY = (float) parentRect.height() / (float) childHeight;
|
|
151
|
-
// add 360 to ensure we get positive value
|
|
152
|
-
float rotationDelta = (90 - ((_imageRotation + 360) % 180))/90.0f;
|
|
153
|
-
if (rotationDelta != 1) {
|
|
154
|
-
float destSX = (float) parentRect.width() / (float) childHeight;
|
|
155
|
-
float destSY = (float) parentRect.height() / (float) childWidth;
|
|
156
|
-
if (rotationDelta < 0) {
|
|
157
|
-
sX = destSX + rotationDelta * (destSX - sX);
|
|
158
|
-
sY = destSY + rotationDelta * (destSY - sY);
|
|
159
|
-
} else {
|
|
160
|
-
sX = sX + (1 - rotationDelta) * (destSX - sX);
|
|
161
|
-
sY = sY + (1 - rotationDelta) * (destSY - sY);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
getTransformImpl(outTransform, parentRect, childWidth, childHeight, focusX, focusY, sX, sY, rotationDelta);
|
|
166
|
-
if (_imageMatrix != null) {
|
|
167
|
-
outTransform.preConcat(_imageMatrix);
|
|
168
|
-
} else if (_imageRotation != 0) {
|
|
169
|
-
outTransform.preRotate(_imageRotation, childWidth / 2.0f, childHeight / 2.0f);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
return outTransform;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
public abstract void getTransformImpl(
|
|
176
|
-
Matrix outTransform,
|
|
177
|
-
Rect parentRect,
|
|
178
|
-
int childWidth,
|
|
179
|
-
int childHeight,
|
|
180
|
-
float focusX,
|
|
181
|
-
float focusY,
|
|
182
|
-
float scaleX,
|
|
183
|
-
float scaleY,
|
|
184
|
-
float rotationDelta);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
public static class ScaleTypeFitXY extends AbstractScaleType {
|
|
188
|
-
|
|
189
|
-
public static final com.facebook.drawee.drawable.ScalingUtils.ScaleType INSTANCE = new ScaleTypeFitXY();
|
|
190
|
-
|
|
191
|
-
@Override
|
|
192
|
-
public void getTransformImpl(
|
|
193
|
-
Matrix outTransform,
|
|
194
|
-
Rect parentRect,
|
|
195
|
-
int childWidth,
|
|
196
|
-
int childHeight,
|
|
197
|
-
float focusX,
|
|
198
|
-
float focusY,
|
|
199
|
-
float scaleX,
|
|
200
|
-
float scaleY,
|
|
201
|
-
float rotationDelta) {
|
|
202
|
-
float deltaX = ((rotationDelta != 1) ? (childWidth - childHeight) * scaleX/ 2.0f : 0.0f);
|
|
203
|
-
float deltaY = ((rotationDelta != 1) ? (childWidth - childHeight) * scaleY/ 2.0f : 0.0f);
|
|
204
|
-
float dx = parentRect.left - deltaX;
|
|
205
|
-
float dy = parentRect.top + deltaY;
|
|
206
|
-
outTransform.setScale(scaleX, scaleY);
|
|
207
|
-
|
|
208
|
-
outTransform.postTranslate((int) (dx + 0.5f), (int) (dy + 0.5f));
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
@Override
|
|
212
|
-
public String toString() {
|
|
213
|
-
return "fit_xy";
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
public static class ScaleTypeFitStart extends AbstractScaleType {
|
|
218
|
-
|
|
219
|
-
public static final com.facebook.drawee.drawable.ScalingUtils.ScaleType INSTANCE = new ScaleTypeFitStart();
|
|
220
|
-
|
|
221
|
-
@Override
|
|
222
|
-
public void getTransformImpl(
|
|
223
|
-
Matrix outTransform,
|
|
224
|
-
Rect parentRect,
|
|
225
|
-
int childWidth,
|
|
226
|
-
int childHeight,
|
|
227
|
-
float focusX,
|
|
228
|
-
float focusY,
|
|
229
|
-
float scaleX,
|
|
230
|
-
float scaleY,
|
|
231
|
-
float rotationDelta) {
|
|
232
|
-
float scale = Math.min(scaleX, scaleY);
|
|
233
|
-
float delta = ((rotationDelta != 1) ? (childWidth - childHeight) * scale/ 2.0f : 0.0f);
|
|
234
|
-
|
|
235
|
-
float dx = parentRect.left - delta;
|
|
236
|
-
float dy = parentRect.top + delta;
|
|
237
|
-
outTransform.setScale(scale, scale);
|
|
238
|
-
outTransform.postTranslate((int) (dx + 0.5f), (int) (dy + 0.5f));
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
@Override
|
|
242
|
-
public String toString() {
|
|
243
|
-
return "fit_start";
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
public static class ScaleTypeFitBottomStart extends AbstractScaleType {
|
|
248
|
-
|
|
249
|
-
public static final com.facebook.drawee.drawable.ScalingUtils.ScaleType INSTANCE = new ScaleTypeFitBottomStart();
|
|
250
|
-
|
|
251
|
-
@Override
|
|
252
|
-
public void getTransformImpl(
|
|
253
|
-
Matrix outTransform,
|
|
254
|
-
Rect parentRect,
|
|
255
|
-
int childWidth,
|
|
256
|
-
int childHeight,
|
|
257
|
-
float focusX,
|
|
258
|
-
float focusY,
|
|
259
|
-
float scaleX,
|
|
260
|
-
float scaleY,
|
|
261
|
-
float rotationDelta) {
|
|
262
|
-
float scale = Math.min(scaleX, scaleY);
|
|
263
|
-
float dx = parentRect.left;
|
|
264
|
-
float dy = parentRect.top + (parentRect.height() - childHeight * scale);
|
|
265
|
-
outTransform.setScale(scale, scale);
|
|
266
|
-
outTransform.postTranslate((int) (dx + 0.5f), (int) (dy + 0.5f));
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
@Override
|
|
270
|
-
public String toString() {
|
|
271
|
-
return "fit_bottom_start";
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
public static class ScaleTypeFitCenter extends AbstractScaleType {
|
|
276
|
-
|
|
277
|
-
public static final com.facebook.drawee.drawable.ScalingUtils.ScaleType INSTANCE = new ScaleTypeFitCenter();
|
|
278
|
-
|
|
279
|
-
@Override
|
|
280
|
-
public void getTransformImpl(
|
|
281
|
-
Matrix outTransform,
|
|
282
|
-
Rect parentRect,
|
|
283
|
-
int childWidth,
|
|
284
|
-
int childHeight,
|
|
285
|
-
float focusX,
|
|
286
|
-
float focusY,
|
|
287
|
-
float scaleX,
|
|
288
|
-
float scaleY,
|
|
289
|
-
float rotationDelta) {
|
|
290
|
-
float scale = Math.min(scaleX, scaleY);
|
|
291
|
-
float dx = parentRect.left + (parentRect.width() - childWidth * scale) * 0.5f;
|
|
292
|
-
float dy = parentRect.top + (parentRect.height() - childHeight * scale) * 0.5f;
|
|
293
|
-
outTransform.setScale(scale, scale);
|
|
294
|
-
outTransform.postTranslate((int) (dx + 0.5f), (int) (dy + 0.5f));
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
@Override
|
|
298
|
-
public String toString() {
|
|
299
|
-
return "fit_center";
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
public static class ScaleTypeFitEnd extends AbstractScaleType {
|
|
304
|
-
|
|
305
|
-
public static final com.facebook.drawee.drawable.ScalingUtils.ScaleType INSTANCE = new ScaleTypeFitEnd();
|
|
306
|
-
|
|
307
|
-
@Override
|
|
308
|
-
public void getTransformImpl(
|
|
309
|
-
Matrix outTransform,
|
|
310
|
-
Rect parentRect,
|
|
311
|
-
int childWidth,
|
|
312
|
-
int childHeight,
|
|
313
|
-
float focusX,
|
|
314
|
-
float focusY,
|
|
315
|
-
float scaleX,
|
|
316
|
-
float scaleY,
|
|
317
|
-
float rotationDelta) {
|
|
318
|
-
float scale = Math.min(scaleX, scaleY);
|
|
319
|
-
float delta = ((rotationDelta != 1) ? (childWidth - childHeight) * scale/ 2.0f : 0.0f);
|
|
320
|
-
float dx = parentRect.left + (parentRect.width() - childWidth * scale) + delta;
|
|
321
|
-
float dy = parentRect.top + (parentRect.height() - childHeight * scale) - delta;
|
|
322
|
-
outTransform.setScale(scale, scale);
|
|
323
|
-
outTransform.postTranslate((int) (dx + 0.5f), (int) (dy + 0.5f));
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
@Override
|
|
327
|
-
public String toString() {
|
|
328
|
-
return "fit_end";
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
public static class ScaleTypeCenter extends AbstractScaleType {
|
|
333
|
-
|
|
334
|
-
public static final com.facebook.drawee.drawable.ScalingUtils.ScaleType INSTANCE = new ScaleTypeCenter();
|
|
335
|
-
|
|
336
|
-
@Override
|
|
337
|
-
public void getTransformImpl(
|
|
338
|
-
Matrix outTransform,
|
|
339
|
-
Rect parentRect,
|
|
340
|
-
int childWidth,
|
|
341
|
-
int childHeight,
|
|
342
|
-
float focusX,
|
|
343
|
-
float focusY,
|
|
344
|
-
float scaleX,
|
|
345
|
-
float scaleY,
|
|
346
|
-
float rotationDelta) {
|
|
347
|
-
float dx = parentRect.left + (parentRect.width() - childWidth) * 0.5f;
|
|
348
|
-
float dy = parentRect.top + (parentRect.height() - childHeight) * 0.5f;
|
|
349
|
-
outTransform.setTranslate((int) (dx + 0.5f), (int) (dy + 0.5f));
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
@Override
|
|
353
|
-
public String toString() {
|
|
354
|
-
return "center";
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
public static class ScaleTypeCenterInside extends AbstractScaleType {
|
|
359
|
-
|
|
360
|
-
public static final com.facebook.drawee.drawable.ScalingUtils.ScaleType INSTANCE = new ScaleTypeCenterInside();
|
|
361
|
-
|
|
362
|
-
@Override
|
|
363
|
-
public void getTransformImpl(
|
|
364
|
-
Matrix outTransform,
|
|
365
|
-
Rect parentRect,
|
|
366
|
-
int childWidth,
|
|
367
|
-
int childHeight,
|
|
368
|
-
float focusX,
|
|
369
|
-
float focusY,
|
|
370
|
-
float scaleX,
|
|
371
|
-
float scaleY,
|
|
372
|
-
float rotationDelta) {
|
|
373
|
-
float scale = Math.min(Math.min(scaleX, scaleY), 1.0f);
|
|
374
|
-
float dx = parentRect.left + (parentRect.width() - childWidth * scale) * 0.5f;
|
|
375
|
-
float dy = parentRect.top + (parentRect.height() - childHeight * scale) * 0.5f;
|
|
376
|
-
outTransform.setScale(scale, scale);
|
|
377
|
-
outTransform.postTranslate((int) (dx + 0.5f), (int) (dy + 0.5f));
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
@Override
|
|
381
|
-
public String toString() {
|
|
382
|
-
return "center_inside";
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
public static class ScaleTypeCenterCrop extends AbstractScaleType {
|
|
387
|
-
|
|
388
|
-
public static final com.facebook.drawee.drawable.ScalingUtils.ScaleType INSTANCE = new ScaleTypeCenterCrop();
|
|
389
|
-
|
|
390
|
-
@Override
|
|
391
|
-
public void getTransformImpl(
|
|
392
|
-
Matrix outTransform,
|
|
393
|
-
Rect parentRect,
|
|
394
|
-
int childWidth,
|
|
395
|
-
int childHeight,
|
|
396
|
-
float focusX,
|
|
397
|
-
float focusY,
|
|
398
|
-
float scaleX,
|
|
399
|
-
float scaleY,
|
|
400
|
-
float rotationDelta) {
|
|
401
|
-
float scale, dx, dy;
|
|
402
|
-
if (scaleY > scaleX) {
|
|
403
|
-
scale = scaleY;
|
|
404
|
-
dx = parentRect.left + (parentRect.width() - childWidth * scale) * 0.5f;
|
|
405
|
-
dy = parentRect.top + (parentRect.height() - childHeight * scale) * 0.5f;
|
|
406
|
-
} else {
|
|
407
|
-
scale = scaleX;
|
|
408
|
-
dx = parentRect.left + (parentRect.width() - childWidth * scale) * 0.5f;
|
|
409
|
-
dy = parentRect.top + (parentRect.height() - childHeight * scale) * 0.5f;
|
|
410
|
-
}
|
|
411
|
-
outTransform.setScale(scale, scale);
|
|
412
|
-
outTransform.postTranslate((int) (dx + 0.5f), (int) (dy + 0.5f));
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
@Override
|
|
416
|
-
public String toString() {
|
|
417
|
-
return "center_crop";
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
public static class ScaleTypeFocusCrop extends AbstractScaleType {
|
|
422
|
-
|
|
423
|
-
public static final com.facebook.drawee.drawable.ScalingUtils.ScaleType INSTANCE = new ScaleTypeFocusCrop();
|
|
424
|
-
|
|
425
|
-
@Override
|
|
426
|
-
public void getTransformImpl(
|
|
427
|
-
Matrix outTransform,
|
|
428
|
-
Rect parentRect,
|
|
429
|
-
int childWidth,
|
|
430
|
-
int childHeight,
|
|
431
|
-
float focusX,
|
|
432
|
-
float focusY,
|
|
433
|
-
float scaleX,
|
|
434
|
-
float scaleY,
|
|
435
|
-
float rotationDelta) {
|
|
436
|
-
float scale, dx, dy, delta;
|
|
437
|
-
if (scaleY > scaleX) {
|
|
438
|
-
scale = scaleY;
|
|
439
|
-
delta = ((rotationDelta != 1) ? (childWidth - childHeight) * scale/ 2.0f : 0.0f);
|
|
440
|
-
dx = parentRect.width() * 0.5f - childWidth * scale * focusX;
|
|
441
|
-
dx = parentRect.left + Math.max(Math.min(dx, 0), parentRect.width() - childWidth * scale);
|
|
442
|
-
dy = parentRect.height() * 0.5f - childHeight * scale * focusY;
|
|
443
|
-
dy = parentRect.top + Math.max(Math.min(dy, 0), parentRect.height() - childHeight * scale) - delta;
|
|
444
|
-
} else {
|
|
445
|
-
scale = scaleX;
|
|
446
|
-
delta = ((rotationDelta != 1) ? (childWidth - childHeight) * scale: 0.0f);
|
|
447
|
-
dx = parentRect.width() * 0.5f - childWidth * scale * focusX;
|
|
448
|
-
dx = parentRect.left + Math.max(Math.min(dx, 0), parentRect.width() - childWidth * scale) + Math.min(delta / 2.0f, 0.0f);
|
|
449
|
-
dy = parentRect.height() * 0.5f - childHeight * scale * focusY;
|
|
450
|
-
dy = parentRect.top + Math.max(Math.min(dy, 0), parentRect.height() - childHeight * scale);
|
|
451
|
-
}
|
|
452
|
-
outTransform.setScale(scale, scale);
|
|
453
|
-
outTransform.postTranslate((int) (dx + 0.5f), (int) (dy + 0.5f));
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
@Override
|
|
457
|
-
public String toString() {
|
|
458
|
-
return "focus_crop";
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
public static class ScaleTypeFitX extends AbstractScaleType {
|
|
463
|
-
|
|
464
|
-
public static final com.facebook.drawee.drawable.ScalingUtils.ScaleType INSTANCE = new ScaleTypeFitX();
|
|
465
|
-
|
|
466
|
-
@Override
|
|
467
|
-
public void getTransformImpl(
|
|
468
|
-
Matrix outTransform,
|
|
469
|
-
Rect parentRect,
|
|
470
|
-
int childWidth,
|
|
471
|
-
int childHeight,
|
|
472
|
-
float focusX,
|
|
473
|
-
float focusY,
|
|
474
|
-
float scaleX,
|
|
475
|
-
float scaleY,
|
|
476
|
-
float rotationDelta) {
|
|
477
|
-
float scale, dx, dy;
|
|
478
|
-
scale = scaleX;
|
|
479
|
-
dx = parentRect.left;
|
|
480
|
-
dy = parentRect.top + (parentRect.height() - childHeight * scale) * 0.5f;
|
|
481
|
-
outTransform.setScale(scale, scale);
|
|
482
|
-
outTransform.postTranslate((int) (dx + 0.5f), (int) (dy + 0.5f));
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
@Override
|
|
486
|
-
public String toString() {
|
|
487
|
-
return "fit_x";
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
public static class ScaleTypeFitY extends AbstractScaleType {
|
|
492
|
-
|
|
493
|
-
public static final com.facebook.drawee.drawable.ScalingUtils.ScaleType INSTANCE = new ScaleTypeFitY();
|
|
494
|
-
|
|
495
|
-
@Override
|
|
496
|
-
public void getTransformImpl(
|
|
497
|
-
Matrix outTransform,
|
|
498
|
-
Rect parentRect,
|
|
499
|
-
int childWidth,
|
|
500
|
-
int childHeight,
|
|
501
|
-
float focusX,
|
|
502
|
-
float focusY,
|
|
503
|
-
float scaleX,
|
|
504
|
-
float scaleY,
|
|
505
|
-
float rotationDelta) {
|
|
506
|
-
float scale, dx, dy;
|
|
507
|
-
scale = scaleY;
|
|
508
|
-
dx = parentRect.left + (parentRect.width() - childWidth * scale) * 0.5f;
|
|
509
|
-
dy = parentRect.top;
|
|
510
|
-
outTransform.setScale(scale, scale);
|
|
511
|
-
outTransform.postTranslate((int) (dx + 0.5f), (int) (dy + 0.5f));
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
@Override
|
|
515
|
-
public String toString() {
|
|
516
|
-
return "fit_y";
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/adjacent-overload-signatures */
|
|
2
|
-
/* eslint-disable @typescript-eslint/unified-signatures */
|
|
3
|
-
|
|
4
|
-
declare namespace jp {
|
|
5
|
-
export namespace wasabeef {
|
|
6
|
-
export namespace fresco {
|
|
7
|
-
export namespace processors {
|
|
8
|
-
export class BlurPostprocessor {
|
|
9
|
-
public static class: java.lang.Class<BlurPostprocessor>;
|
|
10
|
-
public constructor(param0: globalAndroid.content.Context);
|
|
11
|
-
public getName(): string;
|
|
12
|
-
public constructor(param0: globalAndroid.content.Context, param1: number);
|
|
13
|
-
public getPostprocessorCacheKey(): com.facebook.cache.common.CacheKey;
|
|
14
|
-
public constructor(param0: globalAndroid.content.Context, param1: number, param2: number);
|
|
15
|
-
public process(param0: globalAndroid.graphics.Bitmap, param1: globalAndroid.graphics.Bitmap): void;
|
|
16
|
-
}
|
|
17
|
-
export class ColorFilterPostprocessor {
|
|
18
|
-
public static class: java.lang.Class<ColorFilterPostprocessor>;
|
|
19
|
-
public getName(): string;
|
|
20
|
-
public getPostprocessorCacheKey(): com.facebook.cache.common.CacheKey;
|
|
21
|
-
public process(param0: globalAndroid.graphics.Bitmap, param1: globalAndroid.graphics.Bitmap): void;
|
|
22
|
-
public constructor(param0: number);
|
|
23
|
-
}
|
|
24
|
-
export class CombinePostProcessors {
|
|
25
|
-
public static class: java.lang.Class<CombinePostProcessors>;
|
|
26
|
-
public process(param0: globalAndroid.graphics.Bitmap, param1: globalAndroid.graphics.Bitmap): void;
|
|
27
|
-
}
|
|
28
|
-
export namespace CombinePostProcessors {
|
|
29
|
-
export class Builder {
|
|
30
|
-
public static class: java.lang.Class<Builder>;
|
|
31
|
-
public build(): CombinePostProcessors;
|
|
32
|
-
public constructor();
|
|
33
|
-
public add(param0: com.facebook.imagepipeline.request.BasePostprocessor): Builder;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
export class GrayscalePostprocessor {
|
|
37
|
-
public static class: java.lang.Class<GrayscalePostprocessor>;
|
|
38
|
-
public constructor();
|
|
39
|
-
public getName(): string;
|
|
40
|
-
public getPostprocessorCacheKey(): com.facebook.cache.common.CacheKey;
|
|
41
|
-
public process(param0: globalAndroid.graphics.Bitmap, param1: globalAndroid.graphics.Bitmap): void;
|
|
42
|
-
}
|
|
43
|
-
export class MaskPostprocessor {
|
|
44
|
-
public static class: java.lang.Class<MaskPostprocessor>;
|
|
45
|
-
public getName(): string;
|
|
46
|
-
public constructor(param0: globalAndroid.content.Context, param1: number);
|
|
47
|
-
public getPostprocessorCacheKey(): com.facebook.cache.common.CacheKey;
|
|
48
|
-
public process(param0: globalAndroid.graphics.Bitmap, param1: globalAndroid.graphics.Bitmap): void;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|