【问题标题】:How to change selected region with original color?如何用原始颜色更改选定区域?
【发布时间】:2011-07-19 16:02:21
【问题描述】:

我有 1 张位图图像,我已将该图像转换为灰度。我的问题是我必须用原始颜色更改图像的选定区域。为此,我在 onDraw() 方法中的画布上使用 getPixel() 和 setPixel() 函数。我也使用 onTouch 方法获得了该区域,但我无法保存位图。

请帮帮我

谢谢

【问题讨论】:

    标签: android


    【解决方案1】:

    执行以下操作以在 android 上存储位图(例如,作为 png):

    Bitmap bitmap = Bitmap.createBitmap(source, x, y, width, height...);
    FileOutputStream fos = new FileOutputStream("/some/place/bla.png"));
    target.compress(CompressFormat.PNG, 100, fos);
    fos.flush();
    fos.close();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-04-12
      • 2021-04-30
      • 2011-07-22
      • 1970-01-01
      • 2019-03-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多