mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
Added "External Ambient Module Declarations" for most modules.
Now they are required by module name e.g require("file-system") instead of by file name.
This commit is contained in:
133
image-source/image-source.d.ts
vendored
133
image-source/image-source.d.ts
vendored
@ -1,86 +1,89 @@
|
||||
import promises = require("promises/promises");
|
||||
|
||||
/**
|
||||
* Defines the recognized image formats.
|
||||
*/
|
||||
export declare enum ImageFormat {
|
||||
PNG,
|
||||
JPEG,
|
||||
}
|
||||
|
||||
/**
|
||||
* Encapsulates the common abstraction behind a platform specific object (typically a Bitmap) that is used as a source for images.
|
||||
*/
|
||||
export declare class ImageSource {
|
||||
/**
|
||||
* Gets the height of this instance. This is a read-only property.
|
||||
*/
|
||||
height: number;
|
||||
|
||||
declare module "image-source" {
|
||||
import promises = require("promises/promises");
|
||||
|
||||
/**
|
||||
* Gets the width of this instance. This is a read-only property.
|
||||
* Defines the recognized image formats.
|
||||
*/
|
||||
width: number;
|
||||
enum ImageFormat {
|
||||
PNG,
|
||||
JPEG,
|
||||
}
|
||||
|
||||
/**
|
||||
* The iOS-specific image instance. Will be undefined when running on Android.
|
||||
* Encapsulates the common abstraction behind a platform specific object (typically a Bitmap) that is used as a source for images.
|
||||
*/
|
||||
ios: UIKit.UIImage;
|
||||
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;
|
||||
|
||||
/**
|
||||
* The iOS-specific image instance. Will be undefined when running on Android.
|
||||
*/
|
||||
ios: UIKit.UIImage;
|
||||
|
||||
/**
|
||||
* The Android-specific image instance. Will be undefined when running on iOS.
|
||||
*/
|
||||
android: android.graphics.Bitmap;
|
||||
|
||||
/**
|
||||
* Loads this instance from the specified resource name.
|
||||
*/
|
||||
loadFromResource(name: string): boolean;
|
||||
|
||||
/**
|
||||
* Loads this instance from the specified file.
|
||||
*/
|
||||
loadFromFile(path: string): boolean;
|
||||
|
||||
/**
|
||||
* Loads this instance from the specified native image data.
|
||||
*/
|
||||
loadFromData(data: any): boolean;
|
||||
|
||||
/**
|
||||
* Sets the provided native source object (typically a Bitmap).
|
||||
* This will update either the android or ios properties, depending on the target os.
|
||||
*/
|
||||
setNativeSource(source: any): boolean;
|
||||
|
||||
/**
|
||||
* Saves this instance to the specified file, using the provided image format and quality.
|
||||
*/
|
||||
saveToFile(path: string, format: ImageFormat, quality?: number): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Android-specific image instance. Will be undefined when running on iOS.
|
||||
* Creates a new Image instance and loads it from the specified resource name.
|
||||
*/
|
||||
android: android.graphics.Bitmap;
|
||||
function fromResource(name: string): ImageSource;
|
||||
|
||||
/**
|
||||
* Loads this instance from the specified resource name.
|
||||
* Creates a new Image instance and loads it from the specified file.
|
||||
*/
|
||||
loadFromResource(name: string): boolean;
|
||||
function fromFile(path: string): ImageSource;
|
||||
|
||||
/**
|
||||
* Loads this instance from the specified file.
|
||||
* Creates a new Image instance and loads it from the specified resource name.
|
||||
*/
|
||||
loadFromFile(path: string): boolean;
|
||||
function fromData(data: any): ImageSource;
|
||||
|
||||
/**
|
||||
* Loads this instance from the specified native image data.
|
||||
* Creates a new Image 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.
|
||||
*/
|
||||
loadFromData(data: any): boolean;
|
||||
function fromNativeSource(source: any): ImageSource;
|
||||
|
||||
/**
|
||||
* Sets the provided native source object (typically a Bitmap).
|
||||
* This will update either the android or ios properties, depending on the target os.
|
||||
* Downloads the image from the provided Url and creates a new Image instance from it.
|
||||
*/
|
||||
setNativeSource(source: any): boolean;
|
||||
|
||||
/**
|
||||
* Saves this instance to the specified file, using the provided image format and quality.
|
||||
*/
|
||||
saveToFile(path: string, format: ImageFormat, quality?: number): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Image instance and loads it from the specified resource name.
|
||||
*/
|
||||
export declare function fromResource(name: string): ImageSource;
|
||||
|
||||
/**
|
||||
* Creates a new Image instance and loads it from the specified file.
|
||||
*/
|
||||
export declare function fromFile(path: string): ImageSource;
|
||||
|
||||
/**
|
||||
* Creates a new Image instance and loads it from the specified resource name.
|
||||
*/
|
||||
export declare function fromData(data: any): ImageSource;
|
||||
|
||||
/**
|
||||
* Creates a new Image 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.
|
||||
*/
|
||||
export declare function fromNativeSource(source: any): ImageSource;
|
||||
|
||||
/**
|
||||
* Downloads the image from the provided Url and creates a new Image instance from it.
|
||||
*/
|
||||
export declare function fromUrl(url: string): promises.Promise<ImageSource>;
|
||||
function fromUrl(url: string): promises.Promise<ImageSource>;
|
||||
}
|
Reference in New Issue
Block a user