eZIPSDK For android¶
思澈 安卓 eZipSDK
1.集成¶
1.1 Gradle拉取配置¶
allprojects {
repositories {
maven {
url 'https://maven.aliyun.com/repository/public'
}
maven {
credentials {
username '65a890ad4f41789f56425965'
password 'Y-kxYEyTl5)['
}
url 'https://packages.aliyun.com/maven/repository/2457536-release-P0YgD8/'
}
}
}
1.2 sdk集成¶
implementation 'com.sifli:sifliezipsdk:2.5.5'
2.接口定义¶
public class SFBoardType {
/**
* chip 55x
* */
public final static int BOARD_TYPE_55X = 0;
/**
* chip 56x
* */
public final static int BOARD_TYPE_56X = 1;
/**
* chip 52X
* */
public final static int BOARD_TYPE_52X = 2;
/**
* chip 57x
* */
public final static int BOARD_TYPE_57X = 3;
/**
* chip 58x
* */
public final static int BOARD_TYPE_58X = 4;
public static boolean isValidBoardType(int boardType){
return boardType >= 0 && boardType <= BOARD_TYPE_58X;
}
}
/**
* 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 @see SFBoardType
* @return ezip or apng result, null for fail
*/
public static synchronized byte[] pngToEzip(byte[] pngData, String colorType,
int ezip_color_type, int ezip_bin_type, int boardType)
序列帧
/**
* 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 @see SFBoardType
* @param interval 动画间隔 0 默认间隔
* @return ezip or apng result, null for fail
*/
public static synchronized byte[] pngToEzipSequence(ArrayList<byte[]> pngData, String colorType,
int ezip_color_type, int ezip_bin_type, int boardType,int interval)
设置lvgl版本
/**
* 设置lvgl version 7/8/9
* */
public static void setLvglVersion(int lvglVersion)
gzip
/**
* gzip 数据压缩
* @param inData 输入原始数据
* @return gzip数据,返回null失败。没有header和length,不需要做偏移.
* */
public static synchronized byte[] gzipWithData(byte[] inData)
3.使用¶
byte[] result = sifliEzipUtil.pngToEzip(imageData, "RGB565A", 0, 1, 1);