Updated some APIs with @param defintions. Added .impl suffix to the ImageSource module.

This commit is contained in:
atanasovg
2014-05-21 15:15:48 +03:00
parent 9dd3ba70c5
commit a6edd119d0
12 changed files with 112 additions and 70 deletions

View File

@ -5,7 +5,7 @@ declare module "image-source" {
/**
* Defines the recognized image formats.
*/
enum ImageFormat {
export enum ImageFormat {
PNG,
JPEG,
}
@ -13,7 +13,7 @@ declare module "image-source" {
/**
* Encapsulates the common abstraction behind a platform specific object (typically a Bitmap) that is used as a source for images.
*/
class ImageSource {
export class ImageSource {
/**
* Gets the height of this instance. This is a read-only property.
*/
@ -36,54 +36,66 @@ declare module "image-source" {
/**
* 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 file.
* @param path The location of the file on the file system.
*/
loadFromFile(path: string): 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;
/**
* 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: ImageFormat, quality?: number): boolean;
}
/**
* Creates a new Image instance and loads it from the specified resource name.
* Creates a new ImageSource instance and loads it from the specified resource name.
* @param name The name of the resource (without its extension).
*/
function fromResource(name: string): ImageSource;
export function fromResource(name: string): ImageSource;
/**
* Creates a new Image instance and loads it from the specified file.
* Creates a new ImageSource instance and loads it from the specified file.
* @param path The location of the file on the file system.
*/
function fromFile(path: string): ImageSource;
export function fromFile(path: string): ImageSource;
/**
* Creates a new Image instance and loads it from the specified resource name.
* 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.
*/
function fromData(data: any): ImageSource;
export function fromData(data: any): ImageSource;
/**
* Creates a new Image instance and sets the provided native source object (typically a Bitmap).
* 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.
*/
function fromNativeSource(source: any): ImageSource;
export function fromNativeSource(source: any): ImageSource;
/**
* Downloads the image from the provided Url and creates a new Image instance from it.
* 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.
*/
function fromUrl(url: string): promises.Promise<ImageSource>;
export function fromUrl(url: string): promises.Promise<ImageSource>;
}