Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ImageSource

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

Hierarchy

  • ImageSource

Index

Properties

android

android: any

The Android-specific image instance. Will be undefined when running on iOS.

height

height: number

Gets the height of this instance. This is a read-only property.

ios

ios: any

The iOS-specific UIImage instance. Will be undefined when running on Android.

rotationAngle

rotationAngle: number

Gets or sets the rotation angle that should be applied to image. (Used in android)

width

width: number

Gets the width of this instance. This is a read-only property.

Methods

fromAsset

fromBase64

  • fromBase64(source: string): Promise<boolean>
  • Loads this instance from the specified native image data asynchronously.

    Parameters

    • source: string

      The Base64 string to load the image from.

    Returns Promise<boolean>

fromData

  • fromData(data: any): Promise<boolean>
  • Loads this instance from the specified native image data asynchronously.

    Parameters

    • data: any

      The native data (byte array) to load the image from. This will be either Stream for Android or NSData for iOS.

    Returns Promise<boolean>

fromFile

  • fromFile(path: string): Promise<boolean>
  • Loads this instance from the specified file asynchronously.

    Parameters

    • path: string

      The location of the file on the file system.

    Returns Promise<boolean>

fromResource

  • fromResource(name: string): Promise<boolean>
  • Loads this instance from the specified resource name asynchronously.

    Parameters

    • name: string

      The name of the resource (without its extension).

    Returns Promise<boolean>

loadFromBase64

  • loadFromBase64(source: string): boolean
  • Loads this instance from the specified native image data.

    Parameters

    • source: string

      The Base64 string to load the image from.

    Returns boolean

loadFromData

  • loadFromData(data: any): boolean
  • Loads this instance from the specified native image data.

    Parameters

    • data: any

      The native data (byte array) to load the image from. This will be either Stream for Android or NSData for iOS.

    Returns boolean

loadFromFile

  • loadFromFile(path: string): boolean
  • Loads this instance from the specified file.

    Parameters

    • path: string

      The location of the file on the file system.

    Returns boolean

loadFromResource

  • loadFromResource(name: string): boolean
  • Loads this instance from the specified resource name.

    Parameters

    • name: string

      The name of the resource (without its extension).

    Returns boolean

saveToFile

  • saveToFile(path: string, format: string, quality?: number): boolean
  • Saves this instance to the specified file, using the provided image format and quality.

    Parameters

    • path: string

      The path of the file on the file system to save to.

    • format: string

      The format (encoding) of the image.

    • Optional quality: number

      Optional parameter, specifying the quality of the encoding. Defaults to the maximum available quality.

    Returns boolean

setNativeSource

  • setNativeSource(source: 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.

    Parameters

    • source: any

      The native image object. Will be either a Bitmap for Android or a UIImage for iOS.

    Returns boolean

toBase64String

  • toBase64String(format: string, quality?: number): string
  • Converts the image to base64 encoded string, using the provided image format and quality.

    Parameters

    • format: string

      The format (encoding) of the image.

    • Optional quality: number

      Optional parameter, specifying the quality of the encoding. Defaults to the maximum available quality.

    Returns string

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method