eZIPSDK For Harmony

  • 思澈 鸿蒙 eZipSDK

1.集成

  • 使用 ohpm 以安装 @sifli/ezipsdk

ohpm install @sifli/ezipsdk

2.接口定义

  • png/gif

 /**
   * transform png data to ezip bin, support gif to apng
   * @param pngData png or gif data
   * @param colorType color type as below: rgb565, rgb565A, rbg888, rgb888A
   * @param ezip_color_type
   * 0 keep original alpha channel
   * 1 no alpha channel
   * @param ezip_bin_type
   * set 0 to support rotation
   * set 1 for no rotation
   * @param boardType
   * 0: 55x
   * 1: 56x
   * 2: 52x
   * @return ezip or apng result, null,exception for fail
   */
  static pngToEzip(pngData: Uint8Array, colorType: string, ezip_color_type: number, ezip_bin_type: number,
    boardType: number): Uint8Array
  • 序列帧

  /**
   * Convert a set of png images
   * @param pngData png data as arraylist, will be converted in the order of the images in the arraylist
   * @param colorType color type as below: rgb565, rgb565A, rbg888, rgb888A
   * @param ezip_color_type
   * 0 keep original alpha channel
   * 1 no alpha channel
   * @param ezip_bin_type
   * set 0 to support rotation
   * set 1 for no rotation
   * @param boardType
   * 0: 55x
   * 1: 56x
   * 2: 52x
   * @param interval 动画间隔 0 默认间隔
   * @return ezip or apng result, null for fail
   */
  public static pngToEzipSequence(pngData: ArrayList<Uint8Array>, colorType: string,
    ezip_color_type: number, ezip_bin_type: number, boardType: number, interval: number): Uint8Array 

3.使用

 const pngData: Uint8Array = this.getPngData();
 let binArray =  SifliEzipUtil.pngToEzip(pngData, "RGB565A", 0, 1, 1);