Android 10 : Reason for dotted lines drawn along with crop selection frame when images selected from Gallery for setting wallpaper?

20 views Asked by At

The below is the source code of Android 10 Gallery application,

packages/apps/Gallery2/src/com/android/gallery3d/app/Wallpaper.java

Point size = getDefaultDisplaySize(new Point());
float spotlightX = (float) size.x / width;
float spotlightY = (float) size.y / height;

packages/apps/Gallery2/src/com/android/gallery3d/filtershow/crop/CropView.java

 public void setWallpaperSpotlight(float spotlightX, float spotlightY) {
    mSpotX = spotlightX;
    mSpotY = spotlightY;
    if (mSpotX > 0 && mSpotY > 0) {

` mDoSpot = true; } }

The dotted lines are drawn in CropView onDraw() method as below,

@Override
public void onDraw(Canvas canvas) {

....
// Draw crop rect and markers
        CropDrawingUtils.drawCropRect(canvas, mScreenCropBounds);
        if (!mDoSpot) {
            CropDrawingUtils.drawRuleOfThird(canvas, mScreenCropBounds);
        }else {
            Paint wpPaint = new Paint();
            wpPaint.setColor(mWPMarkerColor);
            wpPaint.setStrokeWidth(3);
            wpPaint.setStyle(Paint.Style.STROKE);
            wpPaint.setPathEffect(new DashPathEffect(new float[]
                    {mDashOnLength, mDashOnLength + mDashOffLength}, 0));
            p.setColor(mOverlayWPShadowColor);
            CropDrawingUtils.drawWallpaperSelectionFrame(canvas, mScreenCropBounds,
                    mSpotX, mSpotY, wpPaint, p);
        }
       
        CropDrawingUtils.drawIndicators(canvas, mCropIndicator, mIndicatorSize,
                mScreenCropBounds, mCropObj.isFixedAspect(), decode(mCropObj.getSelectState(), mRotation));
  }

Need to understand what is the need of dotted lines along with crop selection frame as below, crop view`

0

There are 0 answers