FaceBook open-source library Fresco and facebook open-source fresco
The materials have been compiled into e-books. Welcome to group 284568173 for discussion and usage.
About Fresco
Fresco is a powerful image loading component.
Fresco has designed a module called image pipeline. It loads images from the network, from the local file system, and from local resources. To maximize space and CPU time savings, it contains three levels of Cache Design (two levels of memory, one level of files ).
The Drawees module is designed in Fresco to conveniently display the loading graph. When the image is no longer displayed on the screen, the memory and space usage are released in a timely manner.
Fresco supports Android2.3 (API level 9) and later systems.
Features
Memory Management
A non-compressed image, that is, Bitmap in Android, occupies a large amount of memory. Large memory usage will inevitably lead to more frequent GC. Below 5.0, GC will significantly cause interface freezing.
In systems lower than 5.0, Fresco places images in a special memory area. Of course, when the image is not displayed, the occupied memory is automatically released. This will make the APP smoother and reduce OOM caused by image memory usage.
Fresco is doing just as well on low-end machines, so you no longer have to think about it.
Progressive rendering of images
The progressive JPEG image format has been popular for several years. The progressive image format first presents a rough picture outline, and then gradually shows clear pictures as the picture continues to be downloaded, in particular, the slow network has great benefits, which can bring a better user experience.
The image library of Android does not support this format, but Fresco does. As usual, Fresco only needs to provide the URI of an image.
Gif and WebP formats
Yes. Supports loading Gif images and WebP format.
Image Rendering
Fresco's Drawees design brings some useful features:
• Custom center focus (very helpful for face and other image display)
• Rounded corner graph, of course, the circle also works.
• After the download fails, click to reproduce the download
• Custom bitmap, custom overlay, or progress bar
• Specifies the overlay during user press.
Image loading
Fresco's image pipeline design allows users to control image loading in multiple ways:
• Specify different remote paths for the same image or use images already in the local cache
• A low-resolution image is displayed first, and a high-definition image is downloaded before being displayed.
• Callback notification for loading completion
• For this map, if there is an EXIF thumbnail, you can display the thumbnail before the large image is loaded.
• Scale or rotate Images
• Process downloaded Images
• WebP support