title: Android RotateDrawable on SVG produces jagged edges
body: <p>I'm trying to visualize a rotating object on an Android 9 device by programmatically rotating a vector drawable, created from a .svg file using the <strong>New->Vector Asset</strong> method. The rotation of the object should follow the changes of some external property, instead of a predefined animation. </p>
  
  <p>When a vector image is drawn on an ImageView as a VectorDrawable, the image produced has smooth edges as it should, but when the image is rotated programmatically using a RotateDrawable, the edges become jagged, as if the image was treated as a bitmap, and not redrawn as vector graphics. </p>
  
  <p>The image below illustrates this problem:</p>
  
  <p><a href="https://i.stack.imgur.com/1u8Wj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1u8Wj.png" alt="Below is the pure Drawable, top is the rotated version with jagged edges"></a></p>
  
  <p>According to the <a href="https://developer.android.com/reference/android/graphics/drawable/VectorDrawable" rel="nofollow noreferrer">VectorDrawable</a> documentation, a bitmap cache is created for each vector asset when it is first loaded, but is there a possibility to force the re-rendering when the image is rotated?</p>
  
  <p>Below is some sample code used to create the effect.</p>
  
  <p>Drawable class:</p>
  
  <pre><code>    public class MyDrawable extends Drawable implements Drawable.Callback, Runnable {
  
      @Override
      public void draw(Canvas canvas)
      {
          VectorDrawable vectorDrawable = (VectorDrawable)mainActivity.getResources().getDrawable(R.drawable.test_drawable, mainActivity.getTheme());
          vectorDrawable.setBounds(canvas.getClipBounds());
          vectorDrawable.draw(canvas);    // This looks OK
  
          RotateDrawable rotator = new RotateDrawable();
          rotator.setBounds(canvas.getClipBounds());
          rotator.setLevel(1000);
          rotator.setDrawable(vectorDrawable.mutate());
          rotator.draw(canvas);       // Jagged edges
      }
  }
  </code></pre>
  
  <p>Used in an ImageView in a Fragment:</p>
  
  <pre><code>    @Override
      public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
          final ImageView testView = (ImageView)getView().findViewById(R.id.test_view);
          testView.setImageDrawable(new MyDrawable());
      }
  </code></pre>