Skip to content

Latest commit

 

History

History
44 lines (42 loc) · 2.25 KB

File metadata and controls

44 lines (42 loc) · 2.25 KB

Class: "image-source".ImageSource

Encapsulates the common abstraction behind a platform specific object (typically a Bitmap) that is used as a source for images.

Instance Properties
  • height - Number.
    Gets the height of this instance. This is a read-only property.
  • width - Number.
    Gets the width of this instance. This is a read-only property.
  • ios - UIImage.
    The iOS-specific image instance. Will be undefined when running on Android.
  • android - Bitmap.
    The Android-specific image instance. Will be undefined when running on iOS.
Instance Functions
  • loadFromResource( name String ) Boolean
    Loads this instance from the specified resource name.
    • name - String
      The name of the resource (without its extension).
    • return - Boolean
  • loadFromFile( path String ) Boolean
    Loads this instance from the specified file.
    • path - String
      The location of the file on the file system.
    • return - Boolean
  • loadFromData( data Object ) Boolean
    Loads this instance from the specified native image data.
    • data - Object
      The native data (byte array) to load the image from. This will be either Stream for Android or NSData for iOS.
    • return - Boolean
  • setNativeSource( source Object ) Boolean
    Sets the provided native source object (typically a Bitmap). This 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 - Boolean
  • saveToFile( path String, format ImageFormat, quality? Number ) Boolean
    Saves this instance to the specified file, using the provided image format and quality.
    • path - String
      The path of the file on the file system to save to.
    • format - ImageFormat
      The format (encoding) of the image.
    • quality - (optional) - Number
      Optional parameter, specifying the quality of the encoding. Defaults to the maximum available quality.
    • return - Boolean