Multiply path scale problem

#14 · open · 1 comments

View on GitHub ↗

MikkiMouse

Hi, I have a vector image (**vector_img.xml**): ``` <?xml version="1.0" encoding="utf-8"?> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="22dp" android:height="22dp" android:viewportWidth="300" android:viewportHeight="300"> <path android:fillColor="#FF000000" android:pathData="M 150 0 C 232.842712475 0 300 67.1572875254 300 150 C 300 232.842712475 232.842712475 300 150 300 C 67.1572875254 300 0 232.842712475 0 150 C 0 67.1572875254 67.1572875254 0 150 0 Z" /> <path android:fillColor="#FFFFFFFF" android:pathData="M 150 30 C 216.27416998 30 270 83.7258300203 270 150 C 270 216.27416998 216.27416998 270 150 270 C 83.7258300203 270 30 216.27416998 30 150 C 30 83.7258300203 83.7258300203 30 150 30 Z" /> <path android:fillColor="#FF000000" android:pathData="M 150 60 C 199.705627485 60 240 100.294372515 240 150 C 240 199.705627485 199.705627485 240 150 240 C 100.294372515 240 60 199.705627485 60 150 C 60 100.294372515 100.294372515 60 150 60 Z" /> </vector> ``` I'm trying to scale vector programmatically like this: ``` VectorMasterDrawable vectorDrawable = new VectorMasterDrawable(context, R.drawable.vector_img); vectorDrawable.setScaleX(1.5f); vectorDrawable.setScaleY(1.5f); ``` The result is not happy: ![from](https://user-images.githubusercontent.com/5021616/39512987-9c9bd0b4-4e14-11e8-8a51-073566ccafd1.png) Perhaps the problem is that when we scale vector we can't set pivot points? Or am I doing something wrong?) Thanks

Comments

harjot-oberai

Yes, the problem is with the pivot points being at the top left corner by default. I will implement another scale method which takes pivot points as arguments along with the scale factor. Thanks for opening the issue.