mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
No more ambient modules for tns-core-modules/* subpackages.
- Use path mappings in tsconfig.json to resolve module typings - Only use ambient mobules for global API's - Move single-file modules to a subdir with the same name so that we can provide a hand-written typing next to it (via package.json) - Delete all mentions of tns-core-modules.d.ts - Delete reference d.ts assembly build steps. Not needed anymore. - HACK! Use a <reference> for global typings in application.d.ts to avoid publishing a separate @types/tns-core-modules package. - Rename declarations.d.ts to tns-core-modules.d.ts to preserve JS project mappings in references.d.ts (the only place we use those)
This commit is contained in:
committed by
Hristo Deshev
parent
1af8c6ca8e
commit
b45cbe929b
262
tns-core-modules/image-source/image-source.d.ts
vendored
262
tns-core-modules/image-source/image-source.d.ts
vendored
@@ -1,162 +1,160 @@
|
||||
/**
|
||||
* Contains the ImageSource class, which encapsulates the common abstraction behind a platform specific object (typically a Bitmap) that is used as a source for images.
|
||||
*/
|
||||
declare module "image-source" {
|
||||
import * as imageAssetModule from "image-asset";
|
||||
/**
|
||||
* Encapsulates the common abstraction behind a platform specific object (typically a Bitmap) that is used as a source for images.
|
||||
*/
|
||||
export class ImageSource {
|
||||
/**
|
||||
* Gets the height of this instance. This is a read-only property.
|
||||
*/
|
||||
height: number;
|
||||
|
||||
/**
|
||||
* Gets the width of this instance. This is a read-only property.
|
||||
*/
|
||||
width: number;
|
||||
|
||||
/**
|
||||
* Gets or sets the rotation angle that should be applied to image. (Used in android)
|
||||
*/
|
||||
rotationAngle: number;
|
||||
|
||||
/**
|
||||
* The iOS-specific [UIImage](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIImage_Class/) instance. Will be undefined when running on Android.
|
||||
*/
|
||||
ios: any /* UIImage */;
|
||||
|
||||
/**
|
||||
* The Android-specific [image](http://developer.android.com/reference/android/graphics/Bitmap.html) instance. Will be undefined when running on iOS.
|
||||
*/
|
||||
android: any /* android.graphics.Bitmap */;
|
||||
|
||||
/**
|
||||
* Loads this instance from the specified asset asynchronously.
|
||||
* @param asset The ImageAsset instance used to create ImageSource.
|
||||
*/
|
||||
fromAsset(asset: imageAssetModule.ImageAsset): Promise<ImageSource>;
|
||||
|
||||
/**
|
||||
* Loads this instance from the specified resource name.
|
||||
* @param name The name of the resource (without its extension).
|
||||
*/
|
||||
loadFromResource(name: string): boolean;
|
||||
|
||||
/**
|
||||
* Loads this instance from the specified resource name asynchronously.
|
||||
* @param name The name of the resource (without its extension).
|
||||
*/
|
||||
fromResource(name: string): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Loads this instance from the specified file.
|
||||
* @param path The location of the file on the file system.
|
||||
*/
|
||||
loadFromFile(path: string): boolean;
|
||||
|
||||
/**
|
||||
* Loads this instance from the specified file asynchronously.
|
||||
* @param path The location of the file on the file system.
|
||||
*/
|
||||
fromFile(path: string): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Loads this instance from the specified native image data.
|
||||
* @param data The native data (byte array) to load the image from. This will be either Stream for Android or NSData for iOS.
|
||||
*/
|
||||
loadFromData(data: any): boolean;
|
||||
|
||||
/**
|
||||
* Loads this instance from the specified native image data asynchronously.
|
||||
* @param data The native data (byte array) to load the image from. This will be either Stream for Android or NSData for iOS.
|
||||
*/
|
||||
fromData(data: any): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Loads this instance from the specified native image data.
|
||||
* @param source The Base64 string to load the image from.
|
||||
*/
|
||||
loadFromBase64(source: string): boolean;
|
||||
|
||||
/**
|
||||
* Loads this instance from the specified native image data asynchronously.
|
||||
* @param source The Base64 string to load the image from.
|
||||
*/
|
||||
fromBase64(source: string): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Sets the provided native source object (typically a Bitmap).
|
||||
* This will update either the android or ios properties, depending on the target os.
|
||||
* @param source The native image object. Will be either a Bitmap for Android or a UIImage for iOS.
|
||||
*/
|
||||
setNativeSource(source: any): boolean;
|
||||
|
||||
/**
|
||||
* Saves this instance to the specified file, using the provided image format and quality.
|
||||
* @param path The path of the file on the file system to save to.
|
||||
* @param format The format (encoding) of the image.
|
||||
* @param quality Optional parameter, specifying the quality of the encoding. Defaults to the maximum available quality.
|
||||
*/
|
||||
saveToFile(path: string, format: "png" | "jpeg" | "jpg", quality?: number): boolean;
|
||||
|
||||
/**
|
||||
* Converts the image to base64 encoded string, using the provided image format and quality.
|
||||
* @param format The format (encoding) of the image.
|
||||
* @param quality Optional parameter, specifying the quality of the encoding. Defaults to the maximum available quality.
|
||||
*/
|
||||
toBase64String(format: "png" | "jpeg" | "jpg", quality?: number): string;
|
||||
}
|
||||
|
||||
export function fromAsset(asset: imageAssetModule.ImageAsset): Promise<ImageSource>;
|
||||
import * as imageAssetModule from "image-asset";
|
||||
/**
|
||||
* Encapsulates the common abstraction behind a platform specific object (typically a Bitmap) that is used as a source for images.
|
||||
*/
|
||||
export class ImageSource {
|
||||
/**
|
||||
* Gets the height of this instance. This is a read-only property.
|
||||
*/
|
||||
height: number;
|
||||
|
||||
/**
|
||||
* Creates a new ImageSource instance and loads it from the specified resource name.
|
||||
* Gets the width of this instance. This is a read-only property.
|
||||
*/
|
||||
width: number;
|
||||
|
||||
/**
|
||||
* Gets or sets the rotation angle that should be applied to image. (Used in android)
|
||||
*/
|
||||
rotationAngle: number;
|
||||
|
||||
/**
|
||||
* The iOS-specific [UIImage](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIImage_Class/) instance. Will be undefined when running on Android.
|
||||
*/
|
||||
ios: any /* UIImage */;
|
||||
|
||||
/**
|
||||
* The Android-specific [image](http://developer.android.com/reference/android/graphics/Bitmap.html) instance. Will be undefined when running on iOS.
|
||||
*/
|
||||
android: any /* android.graphics.Bitmap */;
|
||||
|
||||
/**
|
||||
* Loads this instance from the specified asset asynchronously.
|
||||
* @param asset The ImageAsset instance used to create ImageSource.
|
||||
*/
|
||||
fromAsset(asset: imageAssetModule.ImageAsset): Promise<ImageSource>;
|
||||
|
||||
/**
|
||||
* Loads this instance from the specified resource name.
|
||||
* @param name The name of the resource (without its extension).
|
||||
*/
|
||||
export function fromResource(name: string): ImageSource;
|
||||
loadFromResource(name: string): boolean;
|
||||
|
||||
/**
|
||||
* Creates a new ImageSource instance and loads it from the specified file.
|
||||
* Loads this instance from the specified resource name asynchronously.
|
||||
* @param name The name of the resource (without its extension).
|
||||
*/
|
||||
fromResource(name: string): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Loads this instance from the specified file.
|
||||
* @param path The location of the file on the file system.
|
||||
*/
|
||||
export function fromFile(path: string): ImageSource;
|
||||
loadFromFile(path: string): boolean;
|
||||
|
||||
/**
|
||||
* Creates a new ImageSource instance and loads it from the specified resource name.
|
||||
* Loads this instance from the specified file asynchronously.
|
||||
* @param path The location of the file on the file system.
|
||||
*/
|
||||
fromFile(path: string): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Loads this instance from the specified native image data.
|
||||
* @param data The native data (byte array) to load the image from. This will be either Stream for Android or NSData for iOS.
|
||||
*/
|
||||
export function fromData(data: any): ImageSource;
|
||||
loadFromData(data: any): boolean;
|
||||
|
||||
/**
|
||||
* Loads this instance from the specified native image data asynchronously.
|
||||
* @param data The native data (byte array) to load the image from. This will be either Stream for Android or NSData for iOS.
|
||||
*/
|
||||
fromData(data: any): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Creates a new ImageSource instance and loads it from the specified resource name.
|
||||
* Loads this instance from the specified native image data.
|
||||
* @param source The Base64 string to load the image from.
|
||||
*/
|
||||
export function fromBase64(source: string): ImageSource;
|
||||
loadFromBase64(source: string): boolean;
|
||||
|
||||
/**
|
||||
* Loads this instance from the specified native image data asynchronously.
|
||||
* @param source The Base64 string to load the image from.
|
||||
*/
|
||||
fromBase64(source: string): Promise<boolean>;
|
||||
|
||||
/**
|
||||
* Creates a new ImageSource instance and sets the provided native source object (typically a Bitmap).
|
||||
* The native source object will update either the android or ios properties, depending on the target os.
|
||||
* Sets the provided native source object (typically a Bitmap).
|
||||
* This will update either the android or ios properties, depending on the target os.
|
||||
* @param source The native image object. Will be either a Bitmap for Android or a UIImage for iOS.
|
||||
*/
|
||||
export function fromNativeSource(source: any): ImageSource;
|
||||
setNativeSource(source: any): boolean;
|
||||
|
||||
/**
|
||||
* Downloads the image from the provided Url and creates a new ImageSource instance from it.
|
||||
* @param url The link to the remote image object. This operation will download and decode the image.
|
||||
* Saves this instance to the specified file, using the provided image format and quality.
|
||||
* @param path The path of the file on the file system to save to.
|
||||
* @param format The format (encoding) of the image.
|
||||
* @param quality Optional parameter, specifying the quality of the encoding. Defaults to the maximum available quality.
|
||||
*/
|
||||
export function fromUrl(url: string): Promise<ImageSource>;
|
||||
saveToFile(path: string, format: "png" | "jpeg" | "jpg", quality?: number): boolean;
|
||||
|
||||
/**
|
||||
* Creates a new ImageSource instance and loads it from the specified local file or resource(if spexified with "res://" prefix)
|
||||
* @param path The location of the file on the file system.
|
||||
* Converts the image to base64 encoded string, using the provided image format and quality.
|
||||
* @param format The format (encoding) of the image.
|
||||
* @param quality Optional parameter, specifying the quality of the encoding. Defaults to the maximum available quality.
|
||||
*/
|
||||
export function fromFileOrResource(path: string): ImageSource;
|
||||
|
||||
/**
|
||||
* [Obsolete. Please use utils.isFileOrResourcePath instead!] Returns true if the specified path points to a resource or local file.
|
||||
* @param path The path.
|
||||
*/
|
||||
export function isFileOrResourcePath(path: string): boolean
|
||||
toBase64String(format: "png" | "jpeg" | "jpg", quality?: number): string;
|
||||
}
|
||||
|
||||
export function fromAsset(asset: imageAssetModule.ImageAsset): Promise<ImageSource>;
|
||||
|
||||
/**
|
||||
* Creates a new ImageSource instance and loads it from the specified resource name.
|
||||
* @param name The name of the resource (without its extension).
|
||||
*/
|
||||
export function fromResource(name: string): ImageSource;
|
||||
|
||||
/**
|
||||
* Creates a new ImageSource instance and loads it from the specified file.
|
||||
* @param path The location of the file on the file system.
|
||||
*/
|
||||
export function fromFile(path: string): ImageSource;
|
||||
|
||||
/**
|
||||
* Creates a new ImageSource instance and loads it from the specified resource name.
|
||||
* @param data The native data (byte array) to load the image from. This will be either Stream for Android or NSData for iOS.
|
||||
*/
|
||||
export function fromData(data: any): ImageSource;
|
||||
|
||||
/**
|
||||
* Creates a new ImageSource instance and loads it from the specified resource name.
|
||||
* @param source The Base64 string to load the image from.
|
||||
*/
|
||||
export function fromBase64(source: string): ImageSource;
|
||||
|
||||
/**
|
||||
* Creates a new ImageSource instance and sets the provided native source object (typically a Bitmap).
|
||||
* The native source object will update either the android or ios properties, depending on the target os.
|
||||
* @param source The native image object. Will be either a Bitmap for Android or a UIImage for iOS.
|
||||
*/
|
||||
export function fromNativeSource(source: any): ImageSource;
|
||||
|
||||
/**
|
||||
* Downloads the image from the provided Url and creates a new ImageSource instance from it.
|
||||
* @param url The link to the remote image object. This operation will download and decode the image.
|
||||
*/
|
||||
export function fromUrl(url: string): Promise<ImageSource>;
|
||||
|
||||
/**
|
||||
* Creates a new ImageSource instance and loads it from the specified local file or resource(if spexified with "res://" prefix)
|
||||
* @param path The location of the file on the file system.
|
||||
*/
|
||||
export function fromFileOrResource(path: string): ImageSource;
|
||||
|
||||
/**
|
||||
* [Obsolete. Please use utils.isFileOrResourcePath instead!] Returns true if the specified path points to a resource or local file.
|
||||
* @param path The path.
|
||||
*/
|
||||
export function isFileOrResourcePath(path: string): boolean
|
||||
|
||||
Reference in New Issue
Block a user