Skip to content

Commit

Permalink
关闭自动识别
Browse files Browse the repository at this point in the history
  • Loading branch information
bingming.yu committed Aug 17, 2018
1 parent 0b461fd commit c534bf8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public class CropImageView extends ImageView {
boolean mShowGuideLine = true; // 是否显示辅助线
boolean mShowMagnifier = true;// 是否显示放大镜
boolean mShowEdgeMidPoint = true;//是否显示边中点
boolean mAutoScanEnable = false;//是否进行自动识别边框

boolean mDragLimit = true;// 是否限制锚点拖动范围为凸四边形

Expand Down Expand Up @@ -139,6 +140,7 @@ private void initAttrs(Context context, AttributeSet attrs) {
mGuideLineColor = ta.getColor(R.styleable.CropImageView_civGuideLineColor, DEFAULT_GUIDE_LINE_COLOR);
mPointFillColor = ta.getColor(R.styleable.CropImageView_civPointFillColor, DEFAULT_POINT_FILL_COLOR);
mShowEdgeMidPoint = ta.getBoolean(R.styleable.CropImageView_civShowEdgeMidPoint, true);
mAutoScanEnable = ta.getBoolean(R.styleable.CropImageView_civAutoScanEnable, false);
mPointFillAlpha = Math.min(Math.max(0, ta.getInt(R.styleable.CropImageView_civPointFillAlpha, DEFAULT_POINT_FILL_ALPHA)), 255);
ta.recycle();
}
Expand Down Expand Up @@ -201,7 +203,7 @@ public void setImageBitmap(Bitmap bm) {
*/
public void setImageToCrop(Bitmap bmp) {
setImageBitmap(bmp);
setCropPoints(SmartCropper.scan(bmp));
setCropPoints(mAutoScanEnable ? SmartCropper.scan(bmp) : null);
if (mShowEdgeMidPoint){
setEdgeMidPoints();
}
Expand Down
1 change: 1 addition & 0 deletions smartcropperlib/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<attr name="civPointColor" format="color"/>
<attr name="civPointWidth" format="dimension"/>
<attr name="civShowEdgeMidPoint" format="boolean"/>
<attr name="civAutoScanEnable" format="boolean"/>
</declare-styleable>

</resources>

0 comments on commit c534bf8

Please sign in to comment.