Class Image<TNative, TProps>Abstract

Since

4.5.0

Type Parameters

Hierarchy

  • NativeMobileComponent<TNative, TProps>
    • Image

Implements

Properties

_nativeObject: any
android: { createRoundedImage: any; createSystemIcon: any }

Type declaration

Format: typeof Format
iOS: { RenderingMode: typeof RenderingMode; Format: typeof Format } = ...

iOS Specific Properties.

Since

3.1.3

Type declaration

Accessors

  • get nativeObject(): any
  • Returns any

  • set nativeObject(value: any): void
  • Parameters

    • value: any

    Returns void

  • get ios(): TProps["ios"]
  • Returns TProps["ios"]

  • get android(): TProps["android"]
  • Returns TProps["android"]

  • get height(): number
  • Gets the height of image in pixels.

    Android

    Ios

    Property

    Since

    0.1

    Returns number

  • get width(): number
  • Gets the width of image in pixels.

    Android

    Ios

    Property

    Since

    0.1

    Returns number

  • get autoMirrored(): boolean
  • Gets/Sets the autoMirrored of image. This property sets direction of Image automatically related to system or application direction.

    Ios

    Android

    Property

    Since

    3.1.3

    Returns boolean

  • set autoMirrored(value: boolean): void
  • Gets/Sets the autoMirrored of image. This property sets direction of Image automatically related to system or application direction.

    Ios

    Android

    Property

    Since

    3.1.3

    Parameters

    • value: boolean

    Returns void

Methods

  • Parameters

    • Optional params: Partial<Record<string, any>>

    Returns void

  • Parameters

    • props: TProps["android"]

    Returns void

  • Parameters

    • props: TProps["ios"]

    Returns void

  • Returns a compressed blob from existing image with given quality. onSuccess and onFailure are optional parameters.

    Example

    import Image from '@smartface/native/ui/image';
    var myImage = Image.createFromFile("images://smartface.png")
    var myBlob = myImage.compress(Image.Format.JPEG, 50);
    var myCompressedImage = Image.createFromBlob(myBlob);

    Method

    compress

    Returns

    Blob

    Android

    Ios

    Since

    0.1

    Parameters

    • format: Format

      Image format.

    • quality: number

      Image quality is between 0 and 100.

    • Optional onSuccess: ((e: { blob: IBlob<any, MobileOSProps<{}, IBlobAndroidProps>> }) => void)

      Callback for success situation.

    • Optional onFailure: ((e?: { message: string }) => void)

      Callback for failure situation.

        • (e?: { message: string }): void
        • Parameters

          • Optional e: { message: string }
            • message: string

          Returns void

    Returns null | void | IBlob<any, MobileOSProps<{}, IBlobAndroidProps>>

  • Creates a new image from existing image with specified width and height. onSuccess and onFailure are optional parameters.

    Example

    import Image from '@smartface/native/ui/image';
    import ImageView from '@smartface/native/ui/imageview';
    var myImage = Image.createFromFile("images://smartface.png")
    var myImageView = new ImageView();
    myImageView.image = myImage.resize(myImage.width/2, myImage.height/2); // resize example without callback


    import Image from '@smartface/native/ui/image';
    import ImageView from '@smartface/native/ui/imageview';
    var myImage = Image.createFromFile("images://smartface.png")
    var myImageView = new ImageView();
    myImage.resize(myImage.width/2, myImage.height/2, onSuccess);

    function onSuccess(e) {
    myImageView.image = e.image
    }

    Method

    resize

    Returns

    UI.Image

    Android

    Ios

    Since

    0.1

    Parameters

    Returns null | void | IImage<any, MobileOSProps<ImageIOSProps, ImageAndroidProps>>

  • Returns a cropped image from existing image with specified rectangle. onSuccess and onFailure are optional parameters.

    Method

    crop

    Returns

    UI.Image

    Android

    Ios

    Since

    0.1

    Parameters

    • x: number

      The x pixels of the rectangle top-left corner.

    • y: number

      The y pixels of the rectangle top-left corner.

    • width: number

      Width pixels of the new bitmap.

    • height: number

      Height pixels of the new bitmap.

    • onSuccess: ((e: { image: IImage<any, MobileOSProps<ImageIOSProps, ImageAndroidProps>> }) => void)

      Callback for success situation.

    • onFailure: ((e?: { message: string }) => void)

      Callback for failure situation.

        • (e?: { message: string }): void
        • Parameters

          • Optional e: { message: string }
            • message: string

          Returns void

    Returns null | void | IImage<any, MobileOSProps<ImageIOSProps, ImageAndroidProps>>

  • Returns string

  • Used privately inside framework Creates an image object from image.nativeobject.

    Method

    createFromImage

    Returns

    UI.Image

    Static

    Android

    Ios

    Since

    0.1

    Parameters

    • image: any

      Contains image datas.

    Returns IImage<any, MobileOSProps<ImageIOSProps, ImageAndroidProps>>

  • Creates a rounded image object from given path. This method works for only Android. It returns undefined for iOS.

    Method

    createRoundedImage

    Returns

    UI.Image

    Static

    Android

    Since

    2.0.10

    Parameters

    • params: { path: string; radius?: number }
      • path: string

        Image path

      • Optional radius?: number

        Image corner radius

    Returns IImage<any, MobileOSProps<ImageIOSProps, ImageAndroidProps>>

  • Creates an Image instance from given file path. Large bitmap loading causes OutOfMemory exception on Android. width and height parameters works for only Android. No-op for iOS. These parameters are used loading large bitmaps efficiently. If you pass these parameters, the bitmap will scaled down.

    Example

    import Image from '@smartface/native/ui/image';
    var myImage = Image.createFromFile("images://smartface.png");

    Method

    createFromFile

    Returns

    An Image instance.

    Android

    Ios

    Static

    Since

    0.1

    See

    https://developer.android.com/topic/performance/graphics/load-bitmap.html

    Parameters

    • path: string

      Image file path

    • Optional width: number

      Width in pixels

    • Optional height: number

      Height in pixels

    Returns null | IImage<any, MobileOSProps<ImageIOSProps, ImageAndroidProps>>

  • Returns void

Constructors

Generated using TypeDoc