naver / android-imagecropview

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

How to change crop rect size? #8

Closed belinwu closed 7 years ago

belinwu commented 8 years ago

Currently, crop frame will match parent, I wanna change crop rect size.

By the way, this project is awesome.

Thank you!

helloyako commented 8 years ago

@belinwu Hello :) Thank you for your interest of my project.

Answer of your question is I'm sorry. This project don't support to change crop rect size. Many other android image crop project change crop rect size but they can't move image. So I make this project. If you need to change crop rect size, I recommend aviary sdk. That project is not complete open source. but I think that help you.

Thank you :D

belinwu commented 8 years ago

@helloyako Thank you for your reply. :)

I don't mean that change crop rect size by fingers.

I know crop rect is fixed, but I wanna config this fixed area size in xml to implement the following screenshot:

screenshot_2015-10-11-10-23-40

The crop rect's right and left have some transparent spaces. It looks like than the crop rect has margins.

Thank you :D

helloyako commented 8 years ago

@belinwu Ah! I misunderstood your question. so sorry. Currently,That you want can't be now. I think it is not difficult work for your need. But I don't have time so I can't immediately do that. also you can fix that and pull request that It’s a good way.

belinwu commented 8 years ago

@helloyako Finally, you got me. :) Thank you! :D

helloyako commented 8 years ago

@belinwu Thank you :)

helloyako commented 7 years ago

@belinwu Long time no see :) Finally, I finished your request. (code change : cd174ba10c1798ec9280174060ac8cae5220c6d4) I'm sorry to keep you waiting for long time.

I will include this spec in v1.2.0. but it's not released.

You can use 1.2.0-snapshot or develop branch source code.

snapshot version from maven

repositories {
    maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
dependencies {
   compile 'com.naver.android.helloyako:imagecropview:1.2.0-SNAPSHOT'
}

To apply crop margin

<com.naver.android.helloyako.imagecrop.view.ImageCropView
            xmlns:imagecrop="http://schemas.android.com/apk/res-auto"
            android:id="@+id/image"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:visibility="visible"
            imagecrop:setInnerGridMode="on"
            imagecrop:gridInnerStroke="1dp"
            imagecrop:gridInnerColor="#66ffffff"
            imagecrop:setOuterGridMode="on"
            imagecrop:gridOuterStroke="1dp"
            imagecrop:gridOuterColor="#ffffff"
            imagecrop:gridLeftRightMargin="10dp"         
            imagecrop:gridTopBottomMargin="10dp"/> <!-- see gridLeftRightMargin or gridTopBottomMargin -->

I hope it helps

karimabdelhameed commented 7 years ago

@helloyako : Would u please tell me How to Change imagecrop:gridLeftRightMargin and imagecrop:gridTopBottomMargin in Java Code ??

helloyako commented 7 years ago

@karimabdelhameed I'm sorry I'm late answer java code doesn't provide setGridLeftRightMagin(gridTopBottomMargin)

I will provice java code in next version

helloyako commented 7 years ago

resolved v1.2.0

belinwu commented 7 years ago

@helloyako Good job! Thank you!