mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
Image-source modules refactoring
This commit is contained in:
27
image-source/image-source.d.ts
vendored
27
image-source/image-source.d.ts
vendored
@ -3,22 +3,7 @@
|
||||
*/
|
||||
declare module "image-source" {
|
||||
|
||||
/**
|
||||
* Defines the recognized image formats.
|
||||
*/
|
||||
export enum ImageFormat {
|
||||
/**
|
||||
* The W3C Portable Network Graphics (PNG) image format.
|
||||
*/
|
||||
PNG,
|
||||
|
||||
/**
|
||||
* The Joint Photographic Experts Group (JPEG) image format.
|
||||
*/
|
||||
JPEG,
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Encapsulates the common abstraction behind a platform specific object (typically a Bitmap) that is used as a source for images.
|
||||
*/
|
||||
export class ImageSource {
|
||||
@ -73,14 +58,14 @@ declare module "image-source" {
|
||||
* @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: ImageFormat, quality?: number): boolean;
|
||||
saveToFile(path: string, format: string, 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: ImageFormat, quality?: number): string;
|
||||
toBase64String(format: string, quality?: number): string;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -113,4 +98,10 @@ declare module "image-source" {
|
||||
* @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;
|
||||
}
|
Reference in New Issue
Block a user