naver / android-imagecropview

android image crop library
Apache License 2.0
254 stars 55 forks source link

Can I only show the crop rectangle? #37

Closed gordon-lim closed 5 years ago

gordon-lim commented 5 years ago

I want to hide off the parts of the image that is outside of the crop window. Is that possible. I want the imagecropview to be just the final image.

helloyako commented 5 years ago

Hello, @bongbonglemon

First, Thank you for contact me.

As far as I understand your question, you don't want to see transparent layer. Is that right?

If that's right, it's not possible now.

But if we will edit code little bit, it will be possible.

as-is to-be
as-is to-be
gordon-lim commented 5 years ago

Thanks for the reply. I actually also want to be able to change the colour of the area in the view that is not the cropped image to say white. I think if these changes were made it would be closer to that of Instagram's. Thanks again for the reply.

P.S After making that post, I actually went into the library's code and narrowed it down to the drawTransparentLayer() method. I went on to learn a bunch about Android Canvas haha :) I'm rather new to Android.

helloyako commented 5 years ago

Good. to-be image only changed color of layer to black.(removed alpha) so I think it's enough this library provide setTransparentLayerColor() method to solve your question.

gordon-lim commented 5 years ago

Yep sounds good. Look forward to the change. Thanks!

helloyako commented 5 years ago

I have made PR #38 for this request.

However, I didn't add setTransparentLayerColor() method.

I added attribute for outsideLayer color.

You can check this attribute in 1.2.2-SNAPSHOT

snapshot version from maven

repositories {
    maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
dependencies {
   implementation 'com.naver.android.helloyako:imagecropview:1.2.2-SNAPSHOT'
}
gordon-lim commented 5 years ago

Failed to resolve the dependency :/

helloyako commented 5 years ago

Did you add snapshots repository?

repositories {
    maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
helloyako commented 5 years ago

I released v1.2.2

gordon-lim commented 5 years ago

woops sorry for no reply. it wasn't really exactly what i wanted even after the last update so i decided to try and work on implementing the custom image view myself. tot it will be a fun project that i can learn much from. but thanks for the release yo. i hope it helps other developrs.