最近在搞一个关于条形码扫描的软件,需求需要扫描时是竖屏。 最后在zxing官方wiki上面找到解决办法。基本思路如下。 There are 4 relative files: 1, manifest.xml, you need to make CaptureActivity portrait.
2, DecodeHandler.java, rotate data before buildLuminanceSource, it works becuase in YCbCr_420_SP and YCbCr_422_SP, the Y channel is planar and appears first
1
byte[] rotatedData = newbyte[data.length];
2
for(inty = 0; y < height; y++) {
3
for(intx = 0; x < width; x++)
4
rotatedData[x * height + height - y - 1] = data[x + y * width];
5
}
3, CameraManager.java, getFramingRectInPreview() need to be modified.