<分区>
ZXing 图书馆的Writer.encode()
函数返回一个 BitMatrix
对象。如何将其转换为标准的 java Bitmap
对象,以便它可以用作 Android 中 ImageView
的来源?
<分区>
ZXing 图书馆的Writer.encode()
函数返回一个 BitMatrix
对象。如何将其转换为标准的 java Bitmap
对象,以便它可以用作 Android 中 ImageView
的来源?
最佳答案
writeToFile(BitMatrix matrix, String format, File file)
这个方法会将BitMatrix写入一个文件,现在你可以使用
解码这个文件BitmapFactory.decodeFile(newly created file name with path)
这将返回一个位图
有关详细信息,请参阅 this link
关于java - 如何将位矩阵转换为位图?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10090797/