title: Jetpack Compose - Image antialiasing not as smooth as native ImageView when scaled
body: <p>I'm refactoring a screen to use jetpack compose.  It had an <code>ImageView</code> that sits over the top of the background containing a large 1920x795dp PNG image (mdpi and hdpi buckets) which gets scaled down.  After changing to use an <code>Image</code> it now has noticably jaggier edges.</p>
  <p><code>ImageView</code>:</p>
  <pre><code>&lt;ImageView
      android:layout_width=&quot;match_parent&quot;
      android:layout_height=&quot;wrap_content&quot;
      android:layout_alignParentBottom=&quot;true&quot;
      android:scaleType=&quot;fitXY&quot;
      android:layout_marginBottom=&quot;-90dp&quot;
      android:src=&quot;@drawable/ic_swoosh&quot;/&gt;
  </code></pre>
  <p><a href="https://i.stack.imgur.com/0TBTE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0TBTE.png" alt="ImageView" /></a></p>
  <p><a href="https://i.stack.imgur.com/feZ2x.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/feZ2x.png" alt="ImageView" /></a></p>
  <p><code>Image</code>:</p>
  <pre><code>Image(
      modifier = Modifier
          .fillMaxWidth()
          .offset(y = 90.dp)
          .align(Alignment.BottomCenter),
      painter = painterResource(R.drawable.ic_swoosh),
      contentDescription = null,
      contentScale = ContentScale.Fit,
  )
  </code></pre>
  <p><a href="https://i.stack.imgur.com/YNh71.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YNh71.png" alt="Compose Image" /></a></p>
  <p><a href="https://i.stack.imgur.com/KCqmy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KCqmy.png" alt="Compose Image" /></a></p>
  <p>Drilling into the source of <code>Image</code>, it uses <code>AndroidPaint</code> which supposedly has it enabled:</p>
  <pre><code>internal fun makeNativePaint() =
      android.graphics.Paint(android.graphics.Paint.ANTI_ALIAS_FLAG)
  </code></pre>
  <p>If I wrap <code>ImageView</code> in <code>AndroidView</code> the problem is not present.  I can also verify that it is positioned and sized exactly the same as the <code>Image</code> version, but it is anti-aliased correctly.</p>
  <pre><code>AndroidView(
      modifier = Modifier
          .fillMaxWidth()
          .offset(y = 90.dp)
          .align(Alignment.BottomCenter),
      factory = {
          ImageView(it).apply {
              scaleType = android.widget.ImageView.ScaleType.FIT_XY
              setImageResource(R.drawable.ic_swoosh)
          }
      }
  )
  </code></pre>
  <p>If I remove scaling with <code>contentScale = ContentScale.None</code> the image is also smooth, so it does appear to be due to being scaled down.  Removing <code>contentScale</code> entirely shows the same problem because the image is automatically scaled down to fit the view.</p>
  <p>Edit: If I remove the hdpi variant it also becomes smooth!</p>