本帖最后由 qlp007 于 2010-04-03 10:55:24 编辑

解决方案 »

  1.   

    这个问题我测试过了,如果再建立一个
    Bitmap bitmap2=Bitmap.createBitmap(w, h, Config.ARGB_8888);
    然后使用
    bitmap2.setPixels(pixels, 0, bitmap2.getWidth(), 0, 0, bitmap2.getWidth(),
    bitmap2.getHeight());// 取出

    显示
    iv.setImageBitmap(bitmap2);// 显示
    就可以了,我分析会不会是内存处理上的问题。
      

  2.   

    我查了下,第一个错误应该是the bitmap is not mutable
      

  3.   

    Bitmap bitmap = BitmapFactory.decodeResource(getResources(),R.drawable.icon2);//返回的估计是一个immutalbe的bitmap;所以不能用setpixels而Bitmap b = Bitmap.createBitmap(2, 2, Bitmap.Config.ARGB_8888);//返回的是一个mutable的bitmap,可以用setpixels
      

  4.   

    从Bitmap.createBitmap可以看到有的返回immutable bitmap,有的返回 mutable bitmap1。static  Bitmap  createBitmap(Bitmap  src)
    Returns an immutable bitmap from the source bitmap.2.static  Bitmap   createBitmap(int[] colors, int width, int height, Bitmap.Config config)
    Returns a immutable bitmap with the specified width and height,3.static Bitmap  createBitmap(int[] colors, int offset, int stride, int width, int height, Bitmap.Config config)
    Returns a immutable bitmap with the specified width and height, 4.static Bitmap  createBitmap(Bitmap source, int x, int y, int width, int height, Matrix m, boolean filter)
    Returns an immutable bitmap from subset of the source bitmap, 5.static Bitmap  createBitmap(int width, int height, Bitmap.Config config)
    Returns a mutable bitmap with the specified width and height.6.static  Bitmap  createBitmap(Bitmap source, int x, int y, int width, int height)
    Returns an immutable bitmap from the specified subset of the source bitmap.
      

  5.   

    setPixels这个方法有什么用啊,可以向图像内写入某种颜色吗?
      

  6.   

    setPixels是可以向图像写入颜色
      

  7.   

        感谢你的这句话啊。帮助我了。。我都不知道原图加载进来是不能编辑的。没仔细看api感谢你了~