Skip to content

Commit

Permalink
修改拍照直接返回原图,在使用者界面进行裁剪
Browse files Browse the repository at this point in the history
  • Loading branch information
wzgl5533 committed Jun 13, 2020
1 parent c90377e commit 3436b19
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions myview/src/main/java/com/qlh/sdk/myview/base/CameraBaseActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import kotlin.math.abs

/**
*作者:QLH on 2020-06-06
*描述:
*描述:针对一般的矩形裁剪框:xml包含id为surface_view的SurfaceView控件以及
* id为fix_cut_view的一般View控件
*/
abstract class CameraBaseActivity : AppCompatActivity(), SurfaceHolder.Callback {

Expand Down Expand Up @@ -314,19 +315,18 @@ abstract class CameraBaseActivity : AppCompatActivity(), SurfaceHolder.Callback
Log.e(TAG,
originalBitmap.width
.toString() + "----" + originalBitmap.height)
val frameRect = Rect()
val fixCutView = root?.findViewById<View>(R.id.fix_cut_view)
fixCutView?.getGlobalVisibleRect(frameRect)
val cropBitmap = BitmapUtils.getCropPicture(originalBitmap,
ScreenUtils.getScreenWidth(),
ScreenUtils.getScreenHeight(), frameRect)
//将原图回调回去,自由定制裁剪框,不用受到裁剪框的类型制约
// val frameRect = Rect()
// val fixCutView = root?.findViewById<View>(R.id.fix_cut_view)
// fixCutView?.getGlobalVisibleRect(frameRect)
// val cropBitmap = BitmapUtils.getCropPicture(originalBitmap,
// ScreenUtils.getScreenWidth(),
// ScreenUtils.getScreenHeight(), frameRect)
//BitmapUtils.saveBitmap(this, originalBitmap)
callBack?.success(cropBitmap)
originalBitmap.recycle()
callBack?.success(originalBitmap)
//originalBitmap.recycle()

Log.e(TAG,
cropBitmap!!.width.toString() + "--crop--" + cropBitmap!!.height
)
//Log.e(TAG, cropBitmap!!.width.toString() + "--crop--" + cropBitmap!!.height)
mCamera?.startPreview()
})
}
Expand Down

0 comments on commit 3436b19

Please sign in to comment.