@nativescript-community/ui-image 4.1.8 → 4.3.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.
Files changed (36) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +354 -286
  3. package/angular/directives.d.ts +2 -2
  4. package/angular/esm2020/directives.mjs +15 -0
  5. package/angular/esm2020/index.mjs +2 -0
  6. package/angular/esm2020/module.mjs +22 -0
  7. package/angular/esm2020/nativescript-community-ui-image-angular.mjs +2 -0
  8. package/angular/fesm2015/nativescript-community-ui-image-angular.mjs +39 -0
  9. package/angular/fesm2020/nativescript-community-ui-image-angular.mjs +35 -0
  10. package/angular/module.d.ts +3 -3
  11. package/angular/package.json +22 -8
  12. package/blueprint.md +561 -0
  13. package/{image-common.d.ts → index-common.d.ts} +3 -0
  14. package/{image-common.js → index-common.js} +30 -7
  15. package/{image.android.d.ts → index.android.d.ts} +3 -2
  16. package/{image.android.js → index.android.js} +50 -40
  17. package/{image.d.ts → index.d.ts} +3 -3
  18. package/{image.ios.d.ts → index.ios.d.ts} +3 -2
  19. package/{image.ios.js → index.ios.js} +18 -18
  20. package/package.json +12 -4
  21. package/platforms/android/include.gradle +5 -6
  22. package/platforms/android/java/com/nativescript/image/ScalingBlurPostprocessor.java +0 -2
  23. package/platforms/android/java/com/nativescript/image/ScalingUtils.java +487 -0
  24. package/platforms/android/ui_image.aar +0 -0
  25. package/platforms/ios/Podfile +1 -1
  26. package/vue/index.js +1 -1
  27. package/angular/bundles/nativescript-community-ui-image-angular.umd.js +0 -49
  28. package/angular/bundles/nativescript-community-ui-image-angular.umd.min.js +0 -2
  29. package/angular/esm2015/directives.js +0 -15
  30. package/angular/esm2015/index.js +0 -2
  31. package/angular/esm2015/module.js +0 -21
  32. package/angular/esm2015/nativescript-community-ui-image-angular.js +0 -2
  33. package/angular/fesm2015/nativescript-community-ui-image-angular.js +0 -33
  34. package/image-common.metadata.json +0 -1
  35. package/image.android.metadata.json +0 -1
  36. package/image.ios.metadata.json +0 -1
package/blueprint.md ADDED
@@ -0,0 +1,561 @@
1
+ {{ load:../../tools/readme/edit-warning.md }}
2
+ {{ template:title }}
3
+ {{ template:badges }}
4
+ {{ template:description }}
5
+
6
+ | <img src="https://github.com/nativescript-community/ui-image/raw/master/images/demo-ios.gif" height="500" /> | <img src="https://github.com/nativescript-community/ui-image/raw/master/images/demo-android.gif" height="500" /> |
7
+ | --- | ----------- |
8
+ | iOS Demo | Android Demo |
9
+
10
+ {{ template:toc }}
11
+
12
+ ## Installation
13
+ Run the following command from the root of your project:
14
+
15
+ `ns plugin add {{ pkg.name }}`
16
+
17
+ ## setup
18
+
19
+ ```javascript
20
+ import imageModule = require("@nativescript-community/ui-image");
21
+
22
+ //do this before creating any image view
23
+ imageModule.initialize({ isDownsampleEnabled: true });
24
+ ```
25
+
26
+ ## API
27
+
28
+ ### Events
29
+
30
+ **finalImageSet** - arguments *FinalEventData*
31
+
32
+ This event is fired after the final image has been set. When working with animated images you could use this event to start the animation by calling the *FinalEventData.animatable.start()* function.
33
+
34
+ ```xml
35
+ <@nativescript-community/ui-image:Img finalImageSet="onFinalImageSet"/>
36
+ ```
37
+
38
+ JavaScript:
39
+
40
+ ```javascript
41
+ function onFinalImageSet(args) {
42
+ var imageModuleEventData = args;
43
+ var img = imageModuleEventData.object;
44
+ }
45
+ exports.onFinalImageSet = onFinalImageSet;
46
+ ```
47
+
48
+ TypeScript:
49
+
50
+ ```typescript
51
+ import {Img, FinalEventData } from "@nativescript-community/ui-image";
52
+
53
+ export function onFinalImageSet(args: FinalEventData) {
54
+ var img = args.object as Img;
55
+ }
56
+ ```
57
+
58
+ - **failure** - arguments *FailureEventData*
59
+
60
+ This event is fired after the fetch of the final image failed.
61
+
62
+ ```xml
63
+ <@nativescript-community/ui-image:Img failure="onFailure"/>
64
+ ```
65
+
66
+ JavaScript:
67
+
68
+ ```javascript
69
+ function onFailure(args) {
70
+ var img = args.object;
71
+ }
72
+ exports.onFailure = onFailure;
73
+ ```
74
+
75
+ TypeScript:
76
+
77
+ ```typescript
78
+ import {Img, FailureEventData } from "@nativescript-community/ui-image";
79
+
80
+ export function onFailure(args: FailureEventData) {
81
+ var img = args.object as Img;
82
+ }
83
+ ```
84
+
85
+ - **intermediateImageSet** - arguments *IntermediateEventData* (Android only)
86
+
87
+ This event is fired after any intermediate image has been set.
88
+
89
+ ```xml
90
+ <@nativescript-community/ui-image:Img intermediateImageSet="onIntermediateImageSet"/>
91
+ ```
92
+
93
+ JavaScript:
94
+
95
+ ```javascript
96
+ function onIntermediateImageSet(args) {
97
+ var img = args.object;
98
+ }
99
+ exports.onIntermediateImageSet = onIntermediateImageSet;
100
+ ```
101
+
102
+ TypeScript:
103
+
104
+ ```typescript
105
+ import {Img, IntermediateEventData } from "@nativescript-community/ui-image";
106
+
107
+ export function onIntermediateImageSet(args: IntermediateEventData) {
108
+ var img = args.object as Img;
109
+ }
110
+ ```
111
+
112
+ - **intermediateImageFailed** - arguments *FailureEventData* (Android only)
113
+
114
+ This event is fired after the fetch of the intermediate image failed.
115
+
116
+ ```xml
117
+ <@nativescript-community/ui-image:Img intermediateImageFailed="onIntermediateImageFailed"/>
118
+ ```
119
+
120
+ JavaScript:
121
+
122
+ ```javascript
123
+ function intermediateImageFailed(args) {
124
+ var img = args.object;
125
+ }
126
+ exports.intermediateImageFailed = intermediateImageFailed;
127
+ ```
128
+
129
+ TypeScript:
130
+
131
+ ```typescript
132
+ import {Img, FailureEventData } from "@nativescript-community/ui-image";
133
+
134
+ export function intermediateImageFailed(args: FailureEventData) {
135
+ var img = args.object as Img;
136
+ }
137
+ ```
138
+
139
+ - **submit** - arguments *EventData* (Android only)
140
+
141
+ This event is fired before the image request is submitted.
142
+
143
+ ```xml
144
+ <@nativescript-community/ui-image:Img submit="onSubmit"/>
145
+ ```
146
+
147
+ JavaScript:
148
+
149
+ ```javascript
150
+ function onSubmit(args) {
151
+ var img = args.object;
152
+ }
153
+ exports.onSubmit = onSubmit;
154
+ ```
155
+
156
+ TypeScript:
157
+
158
+ ```typescript
159
+ import {Img, EventData } from "@nativescript-community/ui-image";
160
+
161
+ export function onSubmit(args: EventData) {
162
+ var img = args.object as Img;
163
+ }
164
+ ```
165
+
166
+ - **release** - arguments *EventData* (Android only)
167
+
168
+ This event is fired after the controller released the fetched image.
169
+
170
+ ```xml
171
+ <@nativescript-community/ui-image:Img release="onRelease"/>
172
+ ```
173
+
174
+ JavaScript:
175
+
176
+ ```javascript
177
+ function onRelease(args) {
178
+ var img = args.object;
179
+ }
180
+ exports.onRelease = onRelease;
181
+ ```
182
+
183
+ TypeScript:
184
+
185
+ ```typescript
186
+ import {Img, EventData } from "@nativescript-community/ui-image";
187
+
188
+ export function onRelease(args: EventData) {
189
+ var img = args.object as Img;
190
+ }
191
+ ```
192
+
193
+ #### Event arguments
194
+
195
+ Instances of this class are provided to the handlers of the *finalImageSet*.
196
+
197
+ ```typescript
198
+ import {Img, FinalEventData, ImageInfo, AnimatedImage } from "@nativescript-community/ui-image";
199
+
200
+ export function onFinalImageSet(args: FinalEventData) {
201
+ var info: ImageInfo = args.imageInfo;
202
+ var animatable: AnimatedImage = args.animatable;
203
+ var quality: number = info.getQualityInfo().getQuality();
204
+ var isFullQuality: boolean = info.getQualityInfo().isOfFullQuality();
205
+ var isOfGoodEnoughQuality: boolean = info.getQualityInfo().isOfGoodEnoughQuality();
206
+ }
207
+ ```
208
+
209
+ - **FailureEventData**
210
+
211
+ Instances of this class are provided to the handlers of the *failure* and *intermediateImageFailed*.
212
+
213
+ ```typescript
214
+ import {Img, FailureEventData, imageModuleError } from "@nativescript-community/ui-image";
215
+
216
+ export function onFailure(args: FailureEventData) {
217
+ var error: imageModuleError = args.error;
218
+ var message: string = error.getMessage();
219
+ var type: string = error.getErrorType();
220
+ var fullError: string = error.toString();
221
+ }
222
+ ```
223
+
224
+ - **IntermediateEventData**
225
+
226
+ Instances of this class are provided to the handlers of the *intermediateImageSet*.
227
+
228
+ ```typescript
229
+ import {Img, IntermediateEventData, ImageInfo } from "@nativescript-community/ui-image";
230
+
231
+ export function onIntermediateImageSet(args: IntermediateEventData) {
232
+ var info: ImageInfo = args.imageInfo;
233
+ var quality: number = info.getQualityInfo().getQuality();
234
+ var isFullQuality: boolean = info.getQualityInfo().isOfFullQuality();
235
+ var isOfGoodEnoughQuality: boolean = info.getQualityInfo().isOfGoodEnoughQuality();}
236
+ ```
237
+
238
+ - **EventData**
239
+
240
+ Instances of this class are provided to the handlers of the *release* and *submit*.
241
+
242
+ ```typescript
243
+ import {Img, EventData } from "@nativescript-community/ui-image";
244
+
245
+ export function onSubmit(args: EventData) {
246
+ var img = args.object as Img;
247
+ }
248
+ ```
249
+
250
+
251
+ ### Properties
252
+
253
+ - **src**
254
+
255
+ String value used for the image URI. You can use this property to set the image to be loaded from remote location (http, https), from the resources and local files of your {N} application.
256
+
257
+ ```xml
258
+ <@nativescript-community/ui-image:Img src="https://docs.nativescript.org/angular/img/cli-getting-started/angular/chapter0/NativeScript_logo.png"/>
259
+ ```
260
+
261
+ - **placeholderImageUri**
262
+
263
+ String value used for the placeholder image URI. You can use this property to set a placeholder image loaded from the local and resources files of your {N} application.
264
+
265
+ **Note: Currently there are limitations on how many different Images can be set to as 'placeholderImage' before OutOfMemoryError is thrown. For best results its recommended to use a single image for all ```placeholderImageUri``` of your Img instances.*
266
+
267
+ ```xml
268
+ <@nativescript-community/ui-image:Img placeholderImageUri="~/placeholder.jpg"/>
269
+ ```
270
+
271
+ - **failureImageUri**
272
+
273
+ String value used for the failure image URI. You can use this property to set a failure image loaded from the local and resources files of your {N} application that will be shown if the loading of the src is not successful.
274
+
275
+ ```xml
276
+ <@nativescript-community/ui-image:Img failureImageUri="~/failure.jpg"/>
277
+ ```
278
+
279
+
280
+ ### Advanced *optional* attributes
281
+
282
+ There are a couple of *optional* attributes that could be set on the Img instance to achieve advanced behaviors:
283
+
284
+ - **backgroundUri** (Android only)
285
+
286
+ String value used for the background image URI. Using this property has similar effect as the placeholderImageUri but the image is stretched to the size of the Img.
287
+
288
+ **Note: Currently there are limitations on how many different Images can be set to as 'background' before OutOfMemoryError is thrown. For best results its recommended to use a single image for all ```backgroundUri``` of your Img instances.*
289
+
290
+ ```xml
291
+ <@nativescript-community/ui-image:Img backgroundUri="~/image.jpg"/>
292
+ ```
293
+
294
+ - **stretch**
295
+
296
+ String value used by Img image scale type. This property can be set to:
297
+
298
+ '*center*' - Performs no scaling.
299
+
300
+ '*centerCrop*' - Scales the child so that both dimensions will be greater than or equal to the corresponding dimension of the parent.
301
+
302
+ '*centerInside*' - Scales the child so that it fits entirely inside the parent.
303
+
304
+ '*fitCenter*' - Scales the child so that it fits entirely inside the parent.
305
+
306
+ '*aspectFit*' - Scales the child so that it fits entirely inside the parent.
307
+
308
+ '*fitStart*' - Scales the child so that it fits entirely inside the parent.
309
+
310
+ '*fitEnd*' - Scales the child so that it fits entirely inside the parent.
311
+
312
+ '*fitXY*' - Scales width and height independently, so that the child matches the parent exactly.
313
+
314
+ '*fill*' - Scales width and height independently, so that the child matches the parent exactly.
315
+
316
+ '*focusCrop*' - Scales the child so that both dimensions will be greater than or equal to the corresponding dimension of the parent.
317
+
318
+ '*aspectFill*' - Scales the child so that both dimensions will be greater than or equal to the corresponding dimension of the parent.
319
+
320
+
321
+ ```xml
322
+ <@nativescript-community/ui-image:Img stretch="centerInside"/>
323
+ ```
324
+
325
+ - **fadeDuration**
326
+
327
+ Number value used for the fade-in duration. This value is in milliseconds.
328
+
329
+ ```xml
330
+ <@nativescript-community/ui-image:Img fadeDuration="3000"/>
331
+ ```
332
+
333
+ - **blurRadius**
334
+
335
+ Number value greater than zero, used as input for the blur function. Larger value means slower processing. For example a value of `10` means that each pixel in the image will be blurred using all adjacent pixels up to a distance of 10.
336
+
337
+ ```xml
338
+ <@nativescript-community/ui-image:Img blurRadius="25"/>
339
+ ```
340
+
341
+ - **blurDownSampling** (Android only)
342
+
343
+ Number value greater than zero, used to scale the image before applying the blur function. Larger value means faster processing. For example a value of `2` means that the image will be scaled by a factor of two before applying blur.
344
+
345
+ ```xml
346
+ <@nativescript-community/ui-image:Img blurDownSampling="2"/>
347
+ ```
348
+
349
+ - **aspectRatio**
350
+
351
+ Number value used as the aspect ratio of the image. This property is useful when you are working with different aspect ratio images and want to have a fixed Width or Height. The ratio of an image is calculated by dividing its width by its height.
352
+
353
+ *Note: In some layout scenarios it is necessary to set the ```verticalAlignment``` of the Img to 'top' or 'bottom' in order to "anchor" the img and achieve dynamic sizing.*
354
+
355
+ ```xml
356
+ <@nativescript-community/ui-image:Img aspectRatio="1.33" verticalAlignment="top"/>
357
+ ```
358
+
359
+ - **decodeWidth** (downsampling) - make sure to enable downsample (**isDownsampleEnabled**) in the initialize function of the plugin otherwise this property is disregarded.
360
+
361
+ Number value used as the downsampled width of the imageModule drawable.
362
+
363
+ ```xml
364
+ <@nativescript-community/ui-image:Img decodeWidth="100"/>
365
+ ```
366
+
367
+ - **decodeHeight** (downsampling) - make sure to enable downsample (**isDownsampleEnabled**) in the initialize function of the plugin otherwise this property is disregarded.
368
+
369
+ Number value used as the downsampled width of the imageModule drawable.
370
+
371
+ ```xml
372
+ <@nativescript-community/ui-image:Img decodeHeight="100"/>
373
+ ```
374
+
375
+
376
+ - **progressiveRenderingEnabled**
377
+
378
+ Boolean value used for enabling or disabling the streaming of progressive JPEG images. This property is set to 'false' by default. Setting this property to 'true' while loading JPEG images not encoded in progressive format will lead to a standard loading of those images.
379
+
380
+ ```xml
381
+ <@nativescript-community/ui-image:Img progressiveRenderingEnabled="true"/>
382
+ ```
383
+
384
+ - **showProgressBar** (Android only)
385
+
386
+ Boolean value used for showing or hiding the progress bar.
387
+
388
+ ```xml
389
+ <@nativescript-community/ui-image:Img showProgressBar="true"/>
390
+ ```
391
+
392
+ - **progressBarColor** (Android only)
393
+
394
+ String value used for setting the color of the progress bar. You can set it to hex values ("*#FF0000*") and/or predefined colors ("*green*").
395
+
396
+ ```xml
397
+ <@nativescript-community/ui-image:Img progressBarColor="blue"/>
398
+ ```
399
+
400
+ - **roundAsCircle**
401
+
402
+ Boolean value used for determining if the image will be rounded as a circle. Its default value is false. If set to true the image will be rounder to a circle.
403
+
404
+ ```xml
405
+ <@nativescript-community/ui-image:Img roundAsCircle="true"/>
406
+ ```
407
+
408
+ - **roundTopLeftRadius**
409
+
410
+ Radius of the Top Left corner in
411
+
412
+ ```xml
413
+ <@nativescript-community/ui-image:Img roundTopLeftRadius="50"/>
414
+ ```
415
+
416
+ - **roundTopRightRadius**
417
+
418
+ Radius of the Top Right corner in
419
+
420
+ ```xml
421
+ <@nativescript-community/ui-image:Img roundTopRightRadius="50"/>
422
+ ```
423
+ - **roundBottomLeftRadius**
424
+
425
+ Radius of the Bottom Left corner in
426
+
427
+ ```xml
428
+ <@nativescript-community/ui-image:Img roundBottomLeftRadius="50"/>
429
+ ```
430
+ - **roundBottomRightRadius**
431
+
432
+ Radius of the Bottom Right corner in
433
+
434
+ ```xml
435
+ <@nativescript-community/ui-image:Img roundBottomRightRadius="50"/>
436
+ ```
437
+
438
+ - **autoPlayAnimations**
439
+
440
+ Boolean value used for enabling the automatic playing of animated images. Note that rounding of such images is not supported and will be ignored.
441
+
442
+ ```xml
443
+ <@nativescript-community/ui-image:Img autoPlayAnimations="true"/>
444
+ ```
445
+
446
+ - **tapToRetryEnabled** (Android only)
447
+
448
+ Boolean value used for enabling/disabling a tap to retry action for the download of the Img image.
449
+
450
+ ```xml
451
+ <@nativescript-community/ui-image:Img tapToRetryEnabled="true"/>
452
+ ```
453
+
454
+ ### Cache
455
+ The @nativescript-community/ui-image {N} plugin has built-in cache mechanism which handles managing the images in the memory. There are two types of cache mechanisms `memory` and `disk`, you can manually manage both of them with the following functionality.
456
+
457
+ #### 'Refresh' the 'src'
458
+ Not so rarely you may have a scenario where the actual image on your remote service from the `src` of the `Img` has changed but the {N} app already has an image in its internal cache. In such scenario you can easily 'refresh' the `src` by calling the `updateImageUri()`:
459
+
460
+ ```
461
+ // 'img' is the instance the 'Img' in the project.
462
+ img.updateImageUri();
463
+ ```
464
+
465
+
466
+ #### Clear everything from the cache
467
+ Managing the caches in @nativescript-community/ui-image is done via the `ImagePipeline`. In order to get the reference of the ImagePipeline simply call the `getImagePipeline()` function:
468
+
469
+ ```
470
+ var imageModuleModel = require("@nativescript-community/ui-image");
471
+
472
+ var imagePipeLine = imageModuleModel.getImagePipeline();
473
+ ```
474
+
475
+ - Clear both the memory and disk caches
476
+
477
+ ```
478
+ imagePipeLine.clearCaches();
479
+ ```
480
+
481
+ - Clear the memory cache
482
+
483
+ ```
484
+ imagePipeLine.clearMemoryCaches();
485
+ ```
486
+
487
+ - Clear the disk cache
488
+
489
+ ```
490
+ imagePipeLine.clearDiskCaches();
491
+ ```
492
+
493
+ #### Evict all images with a specific URI from the cache
494
+ If clearing the entire cache is not what you desired, you can clear only the images linked with a specific URI (`src`). Evicting is done again via the ImagePipeline:
495
+
496
+ ```
497
+ var imageModuleModel = require("@nativescript-community/ui-image");
498
+
499
+ var imagePipeLine = imageModuleModel.getImagePipeline();
500
+ ```
501
+
502
+ - Evict URI from both the memory and disk caches
503
+
504
+ ```
505
+ imagePipeLine.evictFromCache("<uri-to-a-photo-from-the-web>");
506
+ ```
507
+
508
+ - Evict URI from the memory cache
509
+
510
+ ```
511
+ imagePipeLine.evictFromMemoryCache("<uri-to-a-photo-from-the-web>");
512
+ ```
513
+
514
+ - Evict URI from the disk cache
515
+
516
+ ```
517
+ imagePipeLine.evictFromDiskCache("<uri-to-a-photo-from-the-web>");
518
+ ```
519
+
520
+ #### Manually shut down the native imageModule library
521
+ In very very rare occasions the native Android imageModule library may experience strange memory leak issues, in such scenarios as a last resort you may want to "shut down" the library forcing all of the managed memory to possibly be released. You can do that by calling the `shutDown` function exposed by the @nativescript-community/ui-image module, one good application lifecycle event to call it inside may be in the `exit` event of the application:
522
+
523
+ ```javascript
524
+ import * as app from "application";
525
+ import * as imageModuleModule from "@nativescript-community/ui-image";
526
+
527
+ if (app.android) {
528
+ app.on(app.exitEvent, (args) => {
529
+ imageModuleModule.shutDown();
530
+ });
531
+ }
532
+ ```
533
+
534
+ ## Flavors
535
+
536
+ Using core
537
+ ```xml
538
+ <Page
539
+ xmlns="http://www.nativescript.org/tns.xsd"
540
+ xmlns:@nativescript-community/ui-image="@nativescript-community/ui-image">
541
+ <@nativescript-community/ui-image:Img width="250" height="250"
542
+ src="<uri-to-a-photo-from-the-web-or-a-local-resource>"/>
543
+ </Page>
544
+ ```
545
+
546
+ Other flavors are presented in the demo apps that you can find under `demo-snippets`
547
+
548
+ ## Demos
549
+ This repository includes Angular, Vue.js demos. In order to run these execute the following in your shell:
550
+ ```shell
551
+ $ git clone https://github.com/@nativescript-community/ui-image
552
+ $ cd ui-image
553
+ $ npm i
554
+ $ npm run setup
555
+ $ npm run build # && npm run build.angular
556
+ $ cd demo-ng # or demo-vue or demo-svelte
557
+ $ ns run ios|android
558
+ ```
559
+
560
+ {{ load:../../tools/readme/demos-and-development.md }}
561
+ {{ load:../../tools/readme/questions.md }}
@@ -65,6 +65,7 @@ export declare class ImageBase extends View {
65
65
  failureImageUri: string;
66
66
  stretch: ScaleType;
67
67
  fadeDuration: number;
68
+ imageRotation: number;
68
69
  backgroundUri: string;
69
70
  progressiveRenderingEnabled: boolean;
70
71
  localThumbnailPreviewsEnabled: boolean;
@@ -100,6 +101,7 @@ export declare class ImageBase extends View {
100
101
  static roundAsCircleProperty: Property<ImageBase, boolean>;
101
102
  static blurRadiusProperty: Property<ImageBase, number>;
102
103
  static blurDownSamplingProperty: Property<ImageBase, number>;
104
+ static imageRotationProperty: Property<ImageBase, number>;
103
105
  static autoPlayAnimationsProperty: Property<ImageBase, boolean>;
104
106
  static tapToRetryEnabledProperty: Property<ImageBase, boolean>;
105
107
  static aspectRatioProperty: Property<ImageBase, number>;
@@ -115,6 +117,7 @@ export declare class ImageBase extends View {
115
117
  static roundBottomRightRadiusProperty: Property<ImageBase, CoreTypes.LengthType>;
116
118
  static clipToBoundsProperty: Property<ImageBase, boolean>;
117
119
  static animatedImageViewProperty: Property<ImageBase, boolean>;
120
+ get nativeImageViewProtected(): any;
118
121
  protected handleImageProgress(value: number, totalSize?: number): void;
119
122
  private static needsSizeAdjustment;
120
123
  computeScaleFactor(measureWidth: number, measureHeight: number, widthIsFinite: boolean, heightIsFinite: boolean, nativeWidth: number, nativeHeight: number, aspectRatio: number): {
@@ -1,4 +1,6 @@
1
- import { Length, Property, Trace, View, booleanConverter } from '@nativescript/core';
1
+ import { Color, CoreTypes, Length, Property, ShorthandProperty, Trace, View, booleanConverter } from '@nativescript/core';
2
+ import { ImageAsset } from '@nativescript/core/image-asset';
3
+ import { ImageSource } from '@nativescript/core/image-source';
2
4
  import { isAndroid } from '@nativescript/core/platform';
3
5
  function isNonNegativeFiniteNumber(value) {
4
6
  return isFinite(value) && !isNaN(value) && value >= 0;
@@ -12,7 +14,7 @@ export var CLogTypes;
12
14
  })(CLogTypes || (CLogTypes = {}));
13
15
  export const ImageViewTraceCategory = 'NativescriptImage';
14
16
  export const CLog = (type, ...args) => {
15
- Trace.write(args.map(a => (a && typeof a === 'object' ? JSON.stringify(a) : a)).join(' '), ImageViewTraceCategory, type);
17
+ Trace.write(args.map((a) => (a && typeof a === 'object' ? JSON.stringify(a) : a)).join(' '), ImageViewTraceCategory, type);
16
18
  };
17
19
  export var ScaleType;
18
20
  (function (ScaleType) {
@@ -44,6 +46,9 @@ export class EventData {
44
46
  }
45
47
  }
46
48
  export class ImageBase extends View {
49
+ get nativeImageViewProtected() {
50
+ return this.nativeViewProtected;
51
+ }
47
52
  handleImageProgress(value, totalSize) { }
48
53
  static needsSizeAdjustment(scaleType) {
49
54
  if (scaleType === undefined) {
@@ -133,6 +138,7 @@ ImageBase.progressBarColorProperty = new Property({ name: 'progressBarColor', de
133
138
  ImageBase.roundAsCircleProperty = new Property({ name: 'roundAsCircle', valueConverter: booleanConverter, affectsLayout: isAndroid });
134
139
  ImageBase.blurRadiusProperty = new Property({ name: 'blurRadius', valueConverter: (v) => parseFloat(v) });
135
140
  ImageBase.blurDownSamplingProperty = new Property({ name: 'blurDownSampling', valueConverter: (v) => parseFloat(v) });
141
+ ImageBase.imageRotationProperty = new Property({ name: 'imageRotation', valueConverter: (v) => parseFloat(v) });
136
142
  ImageBase.autoPlayAnimationsProperty = new Property({ name: 'autoPlayAnimations', valueConverter: booleanConverter });
137
143
  ImageBase.tapToRetryEnabledProperty = new Property({ name: 'tapToRetryEnabled', valueConverter: booleanConverter });
138
144
  ImageBase.aspectRatioProperty = new Property({ name: 'aspectRatio', affectsLayout: true, valueConverter: (v) => parseFloat(v) });
@@ -142,10 +148,26 @@ ImageBase.tintColorProperty = new Property({ name: 'tintColor' });
142
148
  ImageBase.alwaysFadeProperty = new Property({ name: 'alwaysFade', valueConverter: booleanConverter, defaultValue: false });
143
149
  ImageBase.fadeDurationProperty = new Property({ name: 'fadeDuration', valueConverter: (v) => parseFloat(v) });
144
150
  ImageBase.noCacheProperty = new Property({ name: 'noCache', defaultValue: false, valueConverter: booleanConverter });
145
- ImageBase.roundTopLeftRadiusProperty = new Property({ name: 'roundTopLeftRadius', defaultValue: 0, valueConverter: (v) => Length.toDevicePixels(Length.parse(v)) });
146
- ImageBase.roundTopRightRadiusProperty = new Property({ name: 'roundTopRightRadius', defaultValue: 0, valueConverter: (v) => Length.toDevicePixels(Length.parse(v)) });
147
- ImageBase.roundBottomLeftRadiusProperty = new Property({ name: 'roundBottomLeftRadius', defaultValue: 0, valueConverter: (v) => Length.toDevicePixels(Length.parse(v)) });
148
- ImageBase.roundBottomRightRadiusProperty = new Property({ name: 'roundBottomRightRadius', defaultValue: 0, valueConverter: (v) => Length.toDevicePixels(Length.parse(v)) });
151
+ ImageBase.roundTopLeftRadiusProperty = new Property({
152
+ name: 'roundTopLeftRadius',
153
+ defaultValue: 0,
154
+ valueConverter: (v) => Length.toDevicePixels(Length.parse(v))
155
+ });
156
+ ImageBase.roundTopRightRadiusProperty = new Property({
157
+ name: 'roundTopRightRadius',
158
+ defaultValue: 0,
159
+ valueConverter: (v) => Length.toDevicePixels(Length.parse(v))
160
+ });
161
+ ImageBase.roundBottomLeftRadiusProperty = new Property({
162
+ name: 'roundBottomLeftRadius',
163
+ defaultValue: 0,
164
+ valueConverter: (v) => Length.toDevicePixels(Length.parse(v))
165
+ });
166
+ ImageBase.roundBottomRightRadiusProperty = new Property({
167
+ name: 'roundBottomRightRadius',
168
+ defaultValue: 0,
169
+ valueConverter: (v) => Length.toDevicePixels(Length.parse(v))
170
+ });
149
171
  ImageBase.clipToBoundsProperty = new Property({ name: 'clipToBounds', defaultValue: true, valueConverter: booleanConverter });
150
172
  ImageBase.animatedImageViewProperty = new Property({ name: 'animatedImageView', defaultValue: false, valueConverter: booleanConverter });
151
173
  ImageBase.srcProperty.register(ImageBase);
@@ -166,6 +188,7 @@ ImageBase.roundBottomLeftRadiusProperty.register(ImageBase);
166
188
  ImageBase.roundBottomRightRadiusProperty.register(ImageBase);
167
189
  ImageBase.blurRadiusProperty.register(ImageBase);
168
190
  ImageBase.blurDownSamplingProperty.register(ImageBase);
191
+ ImageBase.imageRotationProperty.register(ImageBase);
169
192
  ImageBase.autoPlayAnimationsProperty.register(ImageBase);
170
193
  ImageBase.tapToRetryEnabledProperty.register(ImageBase);
171
194
  ImageBase.aspectRatioProperty.register(ImageBase);
@@ -175,4 +198,4 @@ ImageBase.alwaysFadeProperty.register(ImageBase);
175
198
  ImageBase.noCacheProperty.register(ImageBase);
176
199
  ImageBase.clipToBoundsProperty.register(ImageBase);
177
200
  ImageBase.animatedImageViewProperty.register(ImageBase);
178
- //# sourceMappingURL=image-common.js.map
201
+ //# sourceMappingURL=index-common.js.map
@@ -1,5 +1,5 @@
1
- export * from './image-common';
2
- import { AnimatedImage, EventData, ImageBase, ImageError as ImageErrorBase, ImageInfo as ImageInfoBase, ImagePipelineConfigSetting } from './image-common';
1
+ export * from './index-common';
2
+ import { AnimatedImage, EventData, ImageBase, ImageError as ImageErrorBase, ImageInfo as ImageInfoBase, ImagePipelineConfigSetting } from './index-common';
3
3
  export declare function initialize(config?: ImagePipelineConfigSetting): void;
4
4
  export declare function getImagePipeline(): ImagePipeline;
5
5
  export declare function shutDown(): void;
@@ -64,6 +64,7 @@ export declare class FailureEventData extends EventData {
64
64
  export declare const needRequestImage: (target: any, propertyKey: string | Symbol, descriptor: PropertyDescriptor) => void;
65
65
  export declare class Img extends ImageBase {
66
66
  nativeViewProtected: com.nativescript.image.DraweeView;
67
+ nativeImageViewProtected: com.nativescript.image.DraweeView;
67
68
  isLoading: boolean;
68
69
  _canRequestImage: boolean;
69
70
  _canUpdateHierarchy: boolean;