Sergey V.
Sergey V.

Reputation: 1028

Android: Lossless quality image scaling

Is it possible in Android to use the Vector images (for example, contours made in Adobe Illustrator) to be drawn on Canvas?

I looked at Vector graphics in Android but I don't want to use any additional third-party libraries.

So, is there any another way to make this idea? One thought, that came to mind, was to convert to the 9patch images. But still I'm not sure whether it sounds good.

All of fuss just over the aim to make the complex countour from which I want to create android.graphics.Path using public void addPath (Path src, Matrix matrix) function.

Upvotes: 0

Views: 974

Answers (1)

GaRRaPeTa
GaRRaPeTa

Reputation: 5598

You cannot use vector images in Android, at least with the built in SDK. It may exist libraries to use vector images, but this is not the Android best practice.

What you need to do in order of not pixelating/blurring your images is to use the different drawable folders existing in android.

You should provide different images depending on the screen density of the display, and android will pick the correct one in runtime.

http://developer.android.com/guide/practices/screens_support.html

9 patches are good only if the image is meant to stretch to fit its content, while its borders should repeat following a pattern. The typical use of this are buttons. For images that dont work as the background of a View, 9 patches are not a good option.

Upvotes: 1

Related Questions