mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +08:00
Improve ImageAsset scaling (#5110)
* Do not depend on current device screen while calculating Image Asset size. * Scale the image asset to the exact requested size. * Process image assets natively, pass keepAspectRatio based on the stretch property and Asset options. * Fixed the splashscreen resource name as it cannot be read when containing a dot. * Updated the Image Asset scale and rotate logic based on the Native one. * Make the ImageAsset size more important than the Image decode size as its more specific. * Fixed tslint errors. * Added filePath support in the ImageAsset constructor for iOS in order to unify it with the Android implementation, support for relative files and file not found support errors. * Added unit tests for ImageAssets. * Added a sample app for UI testing of image-view with ImageAsset src. * chore: apply PR comments
This commit is contained in:

committed by
Alexander Djenkov

parent
27622d83ba
commit
a94ec9946f
@ -347,7 +347,7 @@
|
||||
getRotationAngle(): number;
|
||||
setRotationAngle(angle: number): void;
|
||||
|
||||
setUri(uri: string, decodeWidth: number, decodeHeight: number, useCache: boolean, async: boolean): void;
|
||||
setUri(uri: string, decodeWidth: number, decodeHeight: number, keepAspectRatio: boolean, useCache: boolean, async: boolean): void;
|
||||
setImageLoadedListener(listener: image.Worker.OnImageLoadedListener): void;
|
||||
}
|
||||
|
||||
@ -409,6 +409,8 @@
|
||||
export class Fetcher extends Worker {
|
||||
private constructor();
|
||||
public static getInstance(context: android.content.Context): Fetcher;
|
||||
public static calculateInSampleSize(imageWidth: number, imageHeight: number,
|
||||
reqWidth: number, reqHeight: number): number;
|
||||
public addImageCache(cache: Cache): void;
|
||||
public initCache(): void;
|
||||
public clearCache(): void;
|
||||
|
Reference in New Issue
Block a user