Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overlay drawing is lacking when selecting certain photos #57

Closed
avsector opened this issue Apr 26, 2016 · 4 comments
Closed

Overlay drawing is lacking when selecting certain photos #57

avsector opened this issue Apr 26, 2016 · 4 comments

Comments

@avsector
Copy link

When I select certain photos overlay drawing is lacking a line in top and/or bottom. Here's a screenshot of what is happening:

_20160426_155608

As you can see in the screenshot above, the top line of overlay is not getting drawn.
Here is how I am using CropImageView

<com.isseiaoki.simplecropview.CropImageView
        android:id="@+id/cropImageView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:padding="16dp"
        custom:scv_crop_mode="free"
        custom:scv_guide_color="@color/accentColor"
        custom:scv_handle_color="@color/accentColor"
        custom:scv_frame_color="@color/accentColor"
        custom:scv_background_color="@color/solidBlack"
        custom:scv_handle_size="8dp"
        custom:scv_touch_padding="10dp" />

Let me know if you need more info.
I can also email you the original photo which caused this.

@igreenwood
Copy link
Owner

Hi,

I fixed the bug. Please use the version 1.1.3.

@avsector
Copy link
Author

Thank you for taking the time to look at this issue. Will test the new version ASAP.

@avsector
Copy link
Author

avsector commented May 1, 2016

The problem is solved. I took a look at the commit and I was wondering if the same logic should be applied to circle mode. Maybe something like this:

RectF overlayRect = new RectF((float) Math.floor(mImageRect.left),
        (float) Math.floor(mImageRect.top),
        (float) Math.ceil(mImageRect.right),
        (float) Math.ceil(mImageRect.bottom));
if (!mIsAnimating
        && (mCropMode == CropMode.CIRCLE || mCropMode == CropMode.CIRCLE_SQUARE)) {
    path.addRect(overlayRect, Path.Direction.CW);
    PointF circleCenter = new PointF((mFrameRect.left + mFrameRect.right) / 2,
            (mFrameRect.top + mFrameRect.bottom) / 2);
    float circleRadius = (mFrameRect.right - mFrameRect.left) / 2;
    path.addCircle(circleCenter.x, circleCenter.y, circleRadius, Path.Direction.CCW);
    canvas.drawPath(path, mPaintTranslucent);
} else {
    path.addRect(overlayRect, Path.Direction.CW);
    path.addRect(mFrameRect, Path.Direction.CCW);
    canvas.drawPath(path, mPaintTranslucent);
}

What do you think @IsseiAoki?

@igreenwood
Copy link
Owner

Hi, @mblcdr

Thank you for pointing out my mistake.
I fixed it as you say, and released new version 1.1.4 : )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants