-
- All Implemented Interfaces:
-
android.graphics.drawable.Drawable.Callback,android.view.KeyEvent.Callback,android.view.accessibility.AccessibilityEventSource,androidx.core.view.TintableBackgroundView,androidx.core.widget.TintableImageSourceView,com.bumptech.glide.request.RequestListener
public final class CropWindowView extends AppCompatImageView implements RequestListener<Drawable>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classCropWindowView.Companion
-
Constructor Summary
Constructors Constructor Description CropWindowView(Context context, AttributeSet attrs, Integer defStyleAttr)CropWindowView(Context context, AttributeSet attrs)CropWindowView(Context context)
-
Method Summary
Modifier and Type Method Description final FloatgetMScaleX()final UnitsetMScaleX(Float mScaleX)final FloatgetMScaleY()final UnitsetMScaleY(Float mScaleY)final RectFgetCropEdge()final RectFgetFullImageEdge()final UnitsetCropEdge(Float left, Float top, Float right, Float bottom, Integer edgeMargin)final RectFgetCropRatio()获取裁剪比例 final UnitloadImageResource(Object imageResource, Boolean skipMemoryCache)BooleanonLoadFailed(GlideException e, Object model, Target<Drawable> target, Boolean isFirstResource)BooleanonResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, Boolean isFirstResource)UnitsetImageBitmap(Bitmap bm)final Array<PointF>getCropWindow()获取选区 final Array<PointF>getFullImageWindow()获取全图裁剪点,即图片的四个角作为裁剪点。 final UnitsetAnchorPointColor(Integer pointFillColor)设置锚点填充颜色 final UnitsetMaskAlpha(Integer maskAlpha)蒙版透明度 final UnitsetShowGuideLine(Boolean showGuideLine)是否显示辅助线 final UnitsetGuideLineColor(Integer guideLineColor)设置辅助线颜色 final UnitsetGuideLineWidth(Float guideLineWidth)设置辅助线宽度 final UnitsetCropWindowColor(Integer lineColor)设置选区线的颜色 final UnitsetMagnifierCrossColor(Integer magnifierCrossColor)设置放大镜准心颜色 final UnitsetCropWindowLineWidth(Integer lineWidth)设置选区线宽度 final UnitsetAnchorPointBorderColor(Integer pointColor, Boolean invalidate)设置锚点的颜色。 final UnitsetAnchorPointBorderWidth(Float pointWidth, Boolean invalidate)设置锚点的宽度。 final UnitsetShowMagnifier(Boolean showMagnifier)设置是否显示放大镜 final UnitsetDragLimit(Boolean dragLimit)设置是否限制拖动为凸四边形 final BooleancanRightCrop()检查裁剪区域是否为凸四边形,即裁剪区域是否正确。 此方法通过检查四边形的边是否正确交叉来确定裁剪区域是否有效。 BooleanonTouchEvent(MotionEvent event)处理触摸事件 final Array<PointF>useDefaultPoint(Array<PointF> points)使用默认点或根据提供的点进行裁剪 final UnitsetCropWindowChangeLister(ICropWindowChangeLister service)-
Methods inherited from class android.widget.ImageView
addChildrenForAccessibility, addExtraDataToAccessibilityNodeInfo, addFocusables, addFocusables, addKeyboardNavigationClusters, addOnAttachStateChangeListener, addOnLayoutChangeListener, addOnUnhandledKeyEventListener, addTouchables, animate, announceForAccessibility, autofill, autofill, awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, buildLayer, callOnClick, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, cancelDragAndDrop, cancelLongPress, cancelPendingInputEvents, checkInputConnectionProxy, clearAnimation, clearFocus, clearViewTranslationCallback, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeScroll, computeSystemWindowInsets, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchApplyWindowInsets, dispatchCapturedPointerEvent, dispatchConfigurationChanged, dispatchCreateViewTranslationRequest, dispatchDisplayHint, dispatchDragEvent, dispatchDraw, dispatchDrawableHotspotChanged, dispatchFinishTemporaryDetach, dispatchGenericFocusedEvent, dispatchGenericMotionEvent, dispatchGenericPointerEvent, dispatchHoverEvent, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchNestedFling, dispatchNestedPreFling, dispatchNestedPrePerformAccessibilityAction, dispatchNestedPreScroll, dispatchNestedScroll, dispatchPointerCaptureChanged, dispatchPopulateAccessibilityEvent, dispatchProvideAutofillStructure, dispatchProvideStructure, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchScrollCaptureSearch, dispatchSetActivated, dispatchSetPressed, dispatchSetSelected, dispatchStartTemporaryDetach, dispatchSystemUiVisibilityChanged, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowInsetsAnimationEnd, dispatchWindowInsetsAnimationPrepare, dispatchWindowInsetsAnimationProgress, dispatchWindowInsetsAnimationStart, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, draw, findFocus, findOnBackInvokedDispatcher, findViewById, findViewWithTag, findViewsWithText, fitSystemWindows, focusSearch, forceHasOverlappingRendering, forceLayout, gatherTransparentRegion, generateDisplayHash, getAccessibilityDelegate, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAccessibilityPaneTitle, getAccessibilityTraversalAfter, getAccessibilityTraversalBefore, getAlpha, getAnimation, getAnimationMatrix, getApplicationWindowToken, getAttributeResolutionStack, getAttributeSourceResourceMap, getAutofillHints, getAutofillId, getAutofillType, getAutofillValue, getBackground, getBackgroundTintBlendMode, getBackgroundTintList, getBackgroundTintMode, getBottom, getBottomFadingEdgeStrength, getBottomPaddingOffset, getCameraDistance, getClipBounds, getClipBounds, getClipToOutline, getContentCaptureSession, getContentDescription, getContext, getContextMenuInfo, getDefaultFocusHighlightEnabled, getDisplay, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getElevation, getExplicitStyle, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusable, getFocusables, getFocusedRect, getForeground, getForegroundGravity, getForegroundTintBlendMode, getForegroundTintList, getForegroundTintMode, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHasOverlappingRendering, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getHorizontalScrollbarThumbDrawable, getHorizontalScrollbarTrackDrawable, getId, getImportantForAccessibility, getImportantForAutofill, getImportantForContentCapture, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInSurface, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextClusterForwardId, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOutlineAmbientShadowColor, getOutlineProvider, getOutlineSpotShadowColor, getOverScrollMode, getOverlay, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPivotX, getPivotY, getPointerIcon, getPreferKeepClearRects, getReceiveContentMimeTypes, getResources, getRevealOnFocusHint, getRight, getRightFadingEdgeStrength, getRightPaddingOffset, getRootSurfaceControl, getRootView, getRootWindowInsets, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollCaptureHint, getScrollIndicators, getScrollX, getScrollY, getSolidColor, getSourceLayoutResId, getStateDescription, getStateListAnimator, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getSystemGestureExclusionRects, getSystemUiVisibility, getTag, getTag, getTextAlignment, getTextDirection, getTooltipText, getTop, getTopFadingEdgeStrength, getTopPaddingOffset, getTouchDelegate, getTouchables, getTransitionAlpha, getTransitionName, getTranslationX, getTranslationY, getTranslationZ, getUniqueDrawingId, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarThumbDrawable, getVerticalScrollbarTrackDrawable, getVerticalScrollbarWidth, getViewTranslationResponse, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowId, getWindowInsetsController, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, getZ, hasExplicitFocusable, hasFocus, hasFocusable, hasNestedScrollingParent, hasOnClickListeners, hasOnLongClickListeners, hasPointerCapture, hasTransientState, hasWindowFocus, invalidate, invalidate, invalidate, invalidateOutline, isAccessibilityFocused, isAccessibilityHeading, isActivated, isAttachedToWindow, isAutoHandwritingEnabled, isClickable, isContextClickable, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isFocusedByDefault, isForceDarkAllowed, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isImportantForAccessibility, isImportantForAutofill, isImportantForContentCapture, isInEditMode, isInLayout, isInTouchMode, isKeyboardNavigationCluster, isLaidOut, isLayoutDirectionResolved, isLayoutRequested, isLongClickable, isNestedScrollingEnabled, isPaddingOffsetRequired, isPaddingRelative, isPivotSet, isPreferKeepClear, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScreenReaderFocusable, isScrollContainer, isScrollbarFadingEnabled, isSelected, isShowingLayoutBounds, isShown, isSoundEffectsEnabled, isTemporarilyDetached, isTextAlignmentResolved, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, isVisibleToUserForAutofill, keyboardNavigationClusterSearch, layout, measure, offsetLeftAndRight, offsetTopAndBottom, onAnimationEnd, onAnimationStart, onApplyWindowInsets, onCancelPendingInputEvents, onCapturedPointerEvent, onCheckIsTextEditor, onConfigurationChanged, onCreateContextMenu, onCreateInputConnection, onCreateViewTranslationRequest, onCreateVirtualViewTranslationRequests, onDisplayHint, onDragEvent, onDrawForeground, onDrawScrollBars, onFilterTouchEventForSecurity, onFinishInflate, onFinishTemporaryDetach, onFocusChanged, onGenericMotionEvent, onHoverChanged, onHoverEvent, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onLayout, onOverScrolled, onPointerCaptureChange, onPopulateAccessibilityEvent, onProvideAutofillStructure, onProvideAutofillVirtualStructure, onProvideContentCaptureStructure, onProvideStructure, onProvideVirtualStructure, onReceiveContent, onResolvePointerIcon, onRestoreInstanceState, onSaveInstanceState, onScreenStateChanged, onScrollCaptureSearch, onScrollChanged, onSetAlpha, onSizeChanged, onStartTemporaryDetach, onTrackballEvent, onViewTranslationResponse, onVirtualViewTranslationResponses, onVisibilityChanged, onWindowFocusChanged, onWindowSystemUiVisibilityChanged, onWindowVisibilityChanged, overScrollBy, performAccessibilityAction, performClick, performContextClick, performContextClick, performHapticFeedback, performHapticFeedback, performLongClick, performLongClick, performReceiveContent, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, postInvalidateOnAnimation, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, releasePointerCapture, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, removeOnUnhandledKeyEventListener, requestApplyInsets, requestFitSystemWindows, requestFocus, requestFocus, requestFocus, requestFocusFromTouch, requestLayout, requestPointerCapture, requestRectangleOnScreen, requestRectangleOnScreen, requestUnbufferedDispatch, requestUnbufferedDispatch, requireViewById, resetPivot, restoreDefaultFocus, restoreHierarchyState, saveAttributeDataForStyleable, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityDelegate, setAccessibilityHeading, setAccessibilityLiveRegion, setAccessibilityPaneTitle, setAccessibilityTraversalAfter, setAccessibilityTraversalBefore, setActivated, setAllowClickWhenDisabled, setAlpha, setAnimation, setAnimationMatrix, setAutoHandwritingEnabled, setAutofillHints, setAutofillId, setBackground, setBackgroundColor, setBackgroundTintBlendMode, setBackgroundTintList, setBackgroundTintMode, setBottom, setCameraDistance, setClickable, setClipBounds, setClipToOutline, setContentCaptureSession, setContentDescription, setContextClickable, setDefaultFocusHighlightEnabled, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setElevation, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusable, setFocusableInTouchMode, setFocusedByDefault, setForceDarkAllowed, setForeground, setForegroundGravity, setForegroundTintBlendMode, setForegroundTintList, setForegroundTintMode, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHorizontalScrollbarThumbDrawable, setHorizontalScrollbarTrackDrawable, setHovered, setId, setImportantForAccessibility, setImportantForAutofill, setImportantForContentCapture, setKeepScreenOn, setKeyboardNavigationCluster, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLayoutParams, setLeft, setLeftTopRightBottom, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNestedScrollingEnabled, setNextClusterForwardId, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnApplyWindowInsetsListener, setOnCapturedPointerListener, setOnClickListener, setOnContextClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnReceiveContentListener, setOnScrollChangeListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOutlineAmbientShadowColor, setOutlineProvider, setOutlineSpotShadowColor, setOverScrollMode, setPadding, setPaddingRelative, setPivotX, setPivotY, setPointerIcon, setPreferKeepClear, setPreferKeepClearRects, setPressed, setRenderEffect, setRevealOnFocusHint, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScreenReaderFocusable, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollBarSize, setScrollBarStyle, setScrollCaptureCallback, setScrollCaptureHint, setScrollContainer, setScrollIndicators, setScrollIndicators, setScrollX, setScrollY, setScrollbarFadingEnabled, setSoundEffectsEnabled, setStateDescription, setStateListAnimator, setSystemGestureExclusionRects, setSystemUiVisibility, setTag, setTag, setTextAlignment, setTextDirection, setTooltipText, setTop, setTouchDelegate, setTransitionAlpha, setTransitionName, setTransitionVisibility, setTranslationX, setTranslationY, setTranslationZ, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setVerticalScrollbarThumbDrawable, setVerticalScrollbarTrackDrawable, setViewTranslationCallback, setWillNotCacheDrawing, setWillNotDraw, setWindowInsetsAnimationCallback, setX, setY, setZ, showContextMenu, showContextMenu, startActionMode, startActionMode, startAnimation, startDrag, startDragAndDrop, startNestedScroll, stopNestedScroll, toString, transformMatrixToGlobal, transformMatrixToLocal, unscheduleDrawable, unscheduleDrawable, updateDragShadow, willNotCacheDrawing, willNotDraw -
Methods inherited from class androidx.appcompat.widget.AppCompatImageView
animateTransform, clearColorFilter, drawableHotspotChanged, getAccessibilityClassName, getAdjustViewBounds, getBaseline, getBaselineAlignBottom, getColorFilter, getCropToPadding, getDrawable, getImageAlpha, getImageMatrix, getImageTintBlendMode, getImageTintList, getImageTintMode, getMaxHeight, getMaxWidth, getScaleType, invalidateDrawable, isOpaque, jumpDrawablesToCurrentState, onAttachedToWindow, onCreateDrawableState, onDetachedFromWindow, onMeasure, onRtlPropertiesChanged, onVisibilityAggregated, setAdjustViewBounds, setAlpha, setBaseline, setBaselineAlignBottom, setColorFilter, setColorFilter, setColorFilter, setCropToPadding, setFrame, setImageAlpha, setImageIcon, setImageMatrix, setImageState, setImageTintBlendMode, setImageTintList, setImageTintMode, setMaxHeight, setMaxWidth, setScaleType, setSelected, setVisibility, verifyDrawable -
Methods inherited from class com.liecoder.framework.crop.CropWindowView
drawableStateChanged, getSupportBackgroundTintList, getSupportBackgroundTintMode, getSupportImageTintList, getSupportImageTintMode, hasOverlappingRendering, setBackgroundDrawable, setBackgroundResource, setImageDrawable, setImageLevel, setImageResource, setImageURI, setSupportBackgroundTintList, setSupportBackgroundTintMode, setSupportImageTintList, setSupportImageTintMode -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
CropWindowView
CropWindowView(Context context, AttributeSet attrs, Integer defStyleAttr)
-
CropWindowView
CropWindowView(Context context, AttributeSet attrs)
-
CropWindowView
CropWindowView(Context context)
-
-
Method Detail
-
getMScaleX
final Float getMScaleX()
-
setMScaleX
final Unit setMScaleX(Float mScaleX)
-
getMScaleY
final Float getMScaleY()
-
setMScaleY
final Unit setMScaleY(Float mScaleY)
-
getCropEdge
final RectF getCropEdge()
-
getFullImageEdge
final RectF getFullImageEdge()
-
setCropEdge
final Unit setCropEdge(Float left, Float top, Float right, Float bottom, Integer edgeMargin)
-
getCropRatio
final RectF getCropRatio()
获取裁剪比例
-
loadImageResource
final Unit loadImageResource(Object imageResource, Boolean skipMemoryCache)
-
onLoadFailed
Boolean onLoadFailed(GlideException e, Object model, Target<Drawable> target, Boolean isFirstResource)
-
onResourceReady
Boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, Boolean isFirstResource)
-
setImageBitmap
Unit setImageBitmap(Bitmap bm)
-
getCropWindow
final Array<PointF> getCropWindow()
获取选区
-
getFullImageWindow
final Array<PointF> getFullImageWindow()
获取全图裁剪点,即图片的四个角作为裁剪点。
-
setAnchorPointColor
final Unit setAnchorPointColor(Integer pointFillColor)
设置锚点填充颜色
- Parameters:
pointFillColor- 颜色
-
setMaskAlpha
final Unit setMaskAlpha(Integer maskAlpha)
蒙版透明度
- Parameters:
maskAlpha- 透明度
-
setShowGuideLine
final Unit setShowGuideLine(Boolean showGuideLine)
是否显示辅助线
- Parameters:
showGuideLine- 是否
-
setGuideLineColor
final Unit setGuideLineColor(Integer guideLineColor)
设置辅助线颜色
- Parameters:
guideLineColor- 颜色
-
setGuideLineWidth
final Unit setGuideLineWidth(Float guideLineWidth)
设置辅助线宽度
- Parameters:
guideLineWidth- 宽度 px
-
setCropWindowColor
final Unit setCropWindowColor(Integer lineColor)
设置选区线的颜色
- Parameters:
lineColor- 颜色
-
setMagnifierCrossColor
final Unit setMagnifierCrossColor(Integer magnifierCrossColor)
设置放大镜准心颜色
- Parameters:
magnifierCrossColor- 准心颜色
-
setCropWindowLineWidth
final Unit setCropWindowLineWidth(Integer lineWidth)
设置选区线宽度
- Parameters:
lineWidth- 线宽度,px
-
setAnchorPointBorderColor
final Unit setAnchorPointBorderColor(Integer pointColor, Boolean invalidate)
设置锚点的颜色。
- Parameters:
pointColor- 新的锚点颜色。
-
setAnchorPointBorderWidth
final Unit setAnchorPointBorderWidth(Float pointWidth, Boolean invalidate)
设置锚点的宽度。
- Parameters:
pointWidth- 新的锚点宽度。
-
setShowMagnifier
final Unit setShowMagnifier(Boolean showMagnifier)
设置是否显示放大镜
- Parameters:
showMagnifier- 是否
-
setDragLimit
final Unit setDragLimit(Boolean dragLimit)
设置是否限制拖动为凸四边形
- Parameters:
dragLimit- 是否
-
canRightCrop
final Boolean canRightCrop()
检查裁剪区域是否为凸四边形,即裁剪区域是否正确。 此方法通过检查四边形的边是否正确交叉来确定裁剪区域是否有效。
-
onTouchEvent
Boolean onTouchEvent(MotionEvent event)
处理触摸事件
- Parameters:
event- 触摸事件对象
-
useDefaultPoint
final Array<PointF> useDefaultPoint(Array<PointF> points)
使用默认点或根据提供的点进行裁剪
- Parameters:
points- 提供的点数组
-
setCropWindowChangeLister
final Unit setCropWindowChangeLister(ICropWindowChangeLister service)
-
-
-
-