Android SKIA Image Decoding

2019-07-19 02:37发布

HI,

I am currently studying how Android decode and image file. When I checked the code, it seems like it is calling the SKIA library. But, how do I know what are the image file format supported by android/skia basing on the source code?

I am not an expert in programming, so I am still trying to understand C++ and Java language.

I am now lost at SkImageDecoder* decoder = SkImageDecoder::Factory(stream); inside the BitmapFactory.cpp (JNI file). SkImageDecoder::Factory(stream) seems to be a template.

Anyone can explain me what is happening inside SKImageDecoder::Factory()? Any feedback will be greatly appreciated.

Thanks,
artsylar

标签: android skia
3条回答
乱世女痞
2楼-- · 2019-07-19 02:46

By looking at the source codes of Android, I think the following image formats are supported. ICO (Windows ICON image format), BMP, JPEG, WBMP, GIF, and PNG.

Please correct me if I am wrong. Thank you.

查看更多
淡お忘
3楼-- · 2019-07-19 02:54

PNG, JPEG, and GIF are the supported formats. The primary formats used on Android are PNG and JPEG.

查看更多
孤傲高冷的网名
4楼-- · 2019-07-19 03:01

In skia/include/images/SkImageDecoder.h file, there is the image list decoding supported by Skia:

enum Format {
    kUnknown_Format,
    kBMP_Format,
    kGIF_Format,
    kICO_Format,
    kJPEG_Format,
    kPNG_Format,
    kWBMP_Format,
    kWEBP_Format,

    kLastKnownFormat = kWEBP_Format
};

In SkImageDecoder::Factory(stream) function, it will new a decoder instance according to analyze the Stream's header.

查看更多
登录 后发表回答