CropViewLayout

class CropViewLayout @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = R.attr.Default_CropViewLayout_Style, defStyleRes: Int = R.style.BaseCropViewLayout) : ConstraintLayout

Crop View Layout.

Since

0.5.0

Constructors

Link copied to clipboard
constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = R.attr.Default_CropViewLayout_Style, defStyleRes: Int = R.style.BaseCropViewLayout)

Properties

Link copied to clipboard
private val mBinding: <Error class: unknown class>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
private val mCropView: <Error class: unknown class>

The crop view.

Link copied to clipboard

The currently scale value of original image.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
private val mHeightPixels: Int
Link copied to clipboard
private val mImageView: <Error class: unknown class>

The imageview is used to show original image.

Link copied to clipboard
private val mMatrix: Matrix

The matrix that is used to record state of the original image.

Link copied to clipboard

The value of mMatrix.

Link copied to clipboard
private val mMaxScale: Float = 4.0f

The maximum allowable scale value.

Link copied to clipboard
private val mMid: PointF

The coordinate of the middle point of the two fingers when zooming.

Link copied to clipboard
private var mMinScale: Float

The minimum allowable scale value.

Link copied to clipboard

Currently gesture.

Link copied to clipboard
private var mOldDist: Float

The distance of the two fingers last time.

Link copied to clipboard
private val mSavedMatrix: Matrix

The matrix that is used to record last time state of the original image.

Link copied to clipboard
private val mStart: PointF
Link copied to clipboard
private val mWidthPixels: Int

Functions

Link copied to clipboard
private fun calculateRequireSize(options: BitmapFactory.Options, reqWidth: Int, reqHeight: Int): Int

Calculate require size

Link copied to clipboard
private fun checkBorder()

Check border

Link copied to clipboard
private fun getBitmapWithRequireSize(path: String, reqWidth: Int, reqHeight: Int): Bitmap?

Get bitmap with require size.

Link copied to clipboard
@RequiresApi(value = 28)
fun getCroppedImageAboveApi28(requireWidth: Int, requireHeight: Int): Bitmap?

Get cropped image above api28

Link copied to clipboard
fun getCroppedImageUnderApi28(requireWidth: Int, requireHeight: Int): Bitmap?

Get cropped image under api28

Link copied to clipboard
private fun getExifOrientation(path: String): Int

Get image orientation by ExifInterface.

Link copied to clipboard
private fun getMatrixRectF(matrix: Matrix): RectF

Get the range of the image according to the ImageView.getDrawable.

Link copied to clipboard
private fun getMidPoint(point: PointF, event: MotionEvent)

When multi-touch, calculate the center coordinates of the first two fingers put down.

Link copied to clipboard
private fun getSpacing(event: MotionEvent): Float

When multi-touch, calculate the distance between the first two fingers put down.

Link copied to clipboard
private fun initSrcPic(file: File)

Initialize the image file that needs to be cropped.

Link copied to clipboard
protected open override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int)
Link copied to clipboard
open override fun onTouchEvent(event: MotionEvent): Boolean
Link copied to clipboard
fun setCropFrameSize(width: Float, height: Float)
Link copied to clipboard
fun setImageSrc(file: File)

Set image src