1

我想在我的表盘上显示我的手机从 api 检索到的图像。大小是固定的。为此,我使用 ion 并缩小图像以使其适合表盘。然后,我使用DataApi.

问题是图像根本不平滑,边缘看起来像素化: 图像

我已经尝试了这些解决方案,但没有一个有所作为:

  • 在移动端:使用ion调整位图大小:

    Ion.with(context).load(url).withBitmap().resize(80, 80).centerInside().asBitmap().setCallback(bitmapFutureCallback);

或使用bitmapFutureCallback中的位图(上图):

float side = result.getHeight() > result.getWidth() ? result.getHeight() : result.getWidth();
float scale = 80f / side;
receivingLogo = Bitmap.createScaledBitmap(result,
                                        (int) (result.getWidth() * scale),
                                        (int) (result.getHeight() * scale),
                                        true);
  • 在磨损方面:在位图绘制上设置AntiAlias和为真。FilterBitmap

我可以用什么来平滑位图?

之前/之后的图像:图像

4

0 回答 0