In terms of RAM utilized by a drawable when it is rendered on on the screen, does it make any difference if the drawable is a vector or a bitmap?
I understand that vectors take less media storage space, but I'm asking about the resident RAM needed in order to render it, since in theory, it is still being drawn onto a canvas with the same amount of pixels in the end.
Thanks!
Bitmap images can be resized, but you may sacrifice pixels in the process. In contrast, vector images can resize themselves without sacrificing image quality, making them more scalable in design.
In general, a bitmap graphic is much larger than a similar vector graphic. Bitmap graphics are affected by resolution. If you enlarge a bitmap graphic, it will look jagged. When shrunk, its features become indistinct and fuzzy.
A Bitmap is a representation of a bitmap image (something like java. awt. Image). A Drawable is an abstraction of "something that can be drawn".
The main difference between bitmap and vector is that the bitmap graphics use pixels to represent images while the vector graphics use basic geometric shapes to represent the images. Graphics is a powerful media to communicate ideas and concepts.
From the document I read sometime ago (same question with you). The different between these 2 options is the size of APK file after all when you release. SVG will help you save size of apk.
The initial loading of a vector graphic can cost more CPU cycles than the corresponding raster image. Afterward, memory use and performance are similar between the two. We recommend that you limit a vector image to a maximum of 200 x 200 dp; otherwise, it can take too long to draw.
Being drawn on view will have those 2 options having same RAM (memory) consumed.
My reference source: https://developer.android.com/studio/write/vector-asset-studio.html#about
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With