【问题标题】:Bitmap background is black color. Need to make it white位图背景为黑色。需要变白
【发布时间】:2016-04-14 09:25:20
【问题描述】:

我正在制作位图,背景颜色是黑色。如何将背景设置为白色?

        File filesDir = context.getFilesDir();
        signFile = new File(filesDir, name + ".jpg");

        os = new FileOutputStream(signFile);
        bitmap.compress(Bitmap.CompressFormat.JPEG, 100, os);

【问题讨论】:

标签: android bitmap


【解决方案1】:

你可以使用下面的代码来做同样的事情。

Canvas canvas = new Canvas(bitmap);
canvas.drawColor(Color.WHITE);
canvas.drawBitmap(image, 0, 0, null);

【讨论】:

  • canvas.drawBitmap(image, 0, 0, null);显示错误。我从 OutputStream 制作位图。请参阅我的问题中的代码。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-07-31
  • 2019-12-13
  • 2021-04-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-11-15
相关资源
最近更新 更多