优化细节
This commit is contained in:
Binary file not shown.
@@ -64,11 +64,13 @@ public class CustomCaptureActivity extends CaptureActivity {
|
||||
super.initCameraScan();
|
||||
//初始化解码配置
|
||||
DecodeConfig decodeConfig = new DecodeConfig();
|
||||
decodeConfig.setHints(DecodeFormatManager.DEFAULT_HINTS)////设置解码
|
||||
decodeConfig.setHints(DecodeFormatManager.ALL_HINTS)////设置解码
|
||||
.setSupportVerticalCode(true)//设置是否支持扫垂直的条码
|
||||
.setSupportLuminanceInvert(true)//设置是否支持识别反色码,黑白颜色反转
|
||||
// .setAreaRectRatio(0.9f)//设置识别区域比例,默认0.9,设置的比例最终会在预览区域裁剪基于此比例的一个矩形进行扫码识别
|
||||
// .setAreaRectVerticalOffset(0)//设置识别区域垂直方向偏移量,默认为0,为0表示居中,可以为负数
|
||||
// .setAreaRectHorizontalOffset(0)//设置识别区域水平方向偏移量,默认为0,为0表示居中,可以为负数
|
||||
.setFullAreaScan(true);//设置是否全区域识别,默认true
|
||||
.setFullAreaScan(false);//设置是否全区域识别,默认true
|
||||
|
||||
//获取CameraScan,里面有扫码相关的配置设置。CameraScan里面包含部分支持链式调用的方法,即调用返回是CameraScan本身的一些配置建议在startCamera之前调用。
|
||||
getCameraScan().setPlayBeep(true)//设置是否播放音效,默认为false
|
||||
|
||||
@@ -108,12 +108,6 @@ public class DefaultCameraScan extends CameraScan {
|
||||
});
|
||||
|
||||
ScaleGestureDetector scaleGestureDetector = new ScaleGestureDetector(mContext, mOnScaleGestureListener);
|
||||
mPreviewView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
LogUtils.d("click");
|
||||
}
|
||||
});
|
||||
mPreviewView.setOnTouchListener((v, event) -> {
|
||||
if(isNeedTouchZoom()){
|
||||
return scaleGestureDetector.onTouchEvent(event);
|
||||
|
||||
@@ -53,9 +53,9 @@ public class MultiFormatAnalyzer extends AreaRectAnalyzer {
|
||||
if(rawResult == null && mDecodeConfig != null){
|
||||
if(rawResult == null && mDecodeConfig.isSupportVerticalCode()){
|
||||
byte[] rotatedData = new byte[data.length];
|
||||
for (int y = 0; y < height; y++) {
|
||||
for (int x = 0; x < width; x++)
|
||||
rotatedData[x * height + height - y - 1] = data[x + y * width];
|
||||
for (int y = 0; y < dataHeight; y++) {
|
||||
for (int x = 0; x < dataWidth; x++)
|
||||
rotatedData[x * dataHeight + dataHeight - y - 1] = data[x + y * dataWidth];
|
||||
}
|
||||
rawResult = decodeInternal(new PlanarYUVLuminanceSource(rotatedData,dataHeight,dataWidth,top,left,height,width,false),mDecodeConfig.isSupportVerticalCodeMultiDecode());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user