我猜想get / setPixels方法可能是最简单的方法。
int[] pixels = new int[bm.getWidth() * bm.getHeight()];bm.getPixels(pixels, 0, bm.getWidth(), 0, 0, bm.getWidth(), bm.getHeight()); encryptIntArray(pixels);bm.setPixels(pixels, 0, bm.getWidth(), 0, 0, bm.getWidth(), bm.getHeight());
现在,您只需要编写cryptoIntArray方法。
编辑:您也可以尝试使用ByteBuffer,则不必进行转换。
ByteBuffer bb = ByteBuffer.allocate(bm.getByteCount());bm.copyPixelsToBuffer(bb);byte[] b = bb.array();bm.copyPixelsFromBuffer(ByteBuffer.wrap(Security.encrypt(key,b)));
我还没有测试过该代码。



