// To import the "image-source" module:
var image_source = require("image-source");
How to "image-source"
Class |
Description |
ImageSource |
Encapsulates the common abstraction behind a platform specific object (typically a Bitmap) that is used as a source for images. |
Enum |
Description |
ImageFormat |
Defines the recognized image formats. |
- fromResource( name String ) ImageSource
Creates a new ImageSource instance and loads it from the specified resource name.
- name - String
The name of the resource (without its extension).
- return - ImageSource
- fromFile( path String ) ImageSource
Creates a new ImageSource instance and loads it from the specified file.
- path - String
The location of the file on the file system.
- return - ImageSource
- fromData( data Object ) ImageSource
Creates a new ImageSource instance and loads it from the specified resource name.
- data - Object
The native data (byte array) to load the image from. This will be either Stream for Android or NSData for iOS.
- return - ImageSource
- fromNativeSource( source Object ) 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.
- source - Object
The native image object. Will be either a Bitmap for Android or a UIImage for iOS.
- return - ImageSource
- fromUrl( url String ) Promise...
Downloads the image from the provided Url and creates a new ImageSource instance from it.
- url - String
The link to the remote image object. This operation will download and decode the image.
- return - Promise of ImageSource