11import {
22 ImageSource , ImageAsset , ImageBase , stretchProperty , imageSourceProperty , srcProperty , tintColorProperty , Color ,
3- isDataURI , isFileOrResourcePath , RESOURCE_PREFIX
3+ isDataURI , isFileOrResourcePath , RESOURCE_PREFIX , Length
44} from "./image-common" ;
55import { knownFolders } from "../../file-system" ;
66
@@ -43,16 +43,14 @@ function initializeImageLoadedListener() {
4343export class Image extends ImageBase {
4444 nativeViewProtected : org . nativescript . widgets . ImageView ;
4545
46- public decodeWidth = 0 ;
47- public decodeHeight = 0 ;
4846 public useCache = true ;
4947
5048 public createNativeView ( ) {
5149 if ( ! AndroidImageView ) {
5250 AndroidImageView = org . nativescript . widgets . ImageView ;
5351 }
5452 initializeImageLoadedListener ( ) ;
55-
53+
5654 const imageView = new AndroidImageView ( this . _context ) ;
5755 const listener = new ImageLoadedListener ( this ) ;
5856 imageView . setImageLoadedListener ( listener ) ;
@@ -73,7 +71,7 @@ export class Image extends ImageBase {
7371
7472 public resetNativeView ( ) : void {
7573 super . resetNativeView ( ) ;
76- this . nativeViewProtected . setImageMatrix ( new android . graphics . Matrix ( ) ) ;
74+ this . nativeViewProtected . setImageMatrix ( new android . graphics . Matrix ( ) ) ;
7775 }
7876
7977 public _createImageSourceFromSrc ( value : string | ImageSource | ImageAsset ) {
@@ -89,8 +87,8 @@ export class Image extends ImageBase {
8987
9088 let screen = platform . screen . mainScreen ;
9189
92- let decodeWidth = Math . min ( this . decodeWidth , screen . widthPixels ) ;
93- let decodeHeight = Math . min ( this . decodeHeight , screen . heightPixels ) ;
90+ let decodeWidth = Math . min ( Length . toDevicePixels ( this . decodeWidth , 0 ) , screen . widthPixels ) ;
91+ let decodeHeight = Math . min ( Length . toDevicePixels ( this . decodeHeight , 0 ) , screen . heightPixels ) ;
9492 let keepAspectRatio = this . _calculateKeepAspectRatio ( ) ;
9593 if ( value instanceof ImageAsset ) {
9694 if ( value . options ) {
0 commit comments