美文网首页
安卓判断bitmap是否相等

安卓判断bitmap是否相等

作者: 不会弹钢琴de大叔 | 来源:发表于2024-06-24 15:26 被阅读0次
    public static boolean isSameBitmap(Bitmap bitmap1, Bitmap bitmap2) {
        ByteBuffer buffer1 = ByteBuffer.allocate(bitmap1.getHeight() * bitmap1.getRowBytes());
        bitmap1.copyPixelsToBuffer(buffer1);
        ByteBuffer buffer2 = ByteBuffer.allocate(bitmap2.getHeight() * bitmap2.getRowBytes());
        bitmap2.copyPixelsToBuffer(buffer2);
        boolean equals = Arrays.equals(buffer1.array(), buffer2.array());
        Log.d("ZHJ++", "zhj isSameBitmap: " + equals);
        return equals;
    }

相关文章

网友评论

      本文标题:安卓判断bitmap是否相等

      本文链接:https://www.haomeiwen.com/subject/eycdcjtx.html