프로젝트
GitHub에서 보기 

TakuSemba/CropMe
소개
매우 부드럽고 사용하기 쉬운 크롭 라이브러리입니다.
웹 및 앱 개발측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalCropMe

Gradle
dependencies {
implementation 'com.github.takusemba:cropme:x.x.x'
}
Usage

This is an Android library for cropping images. Move images smoothly, and crop images precisely.
Use CropView in your xml file.
<com.takusemba.cropme.CropLayout
android:id="@+id/crop_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cropme_background_alpha="80%"
app:cropme_frame_height_percent="80%"
app:cropme_frame_width_percent="80%"
app:cropme_max_scale="2.0"
app:cropme_overlay_shape="rectangle"
app:cropme_with_border="true"
>
Set your image
cropView.setUri(uri);
// or
cropView.setBitmap(bitmap)
Crop it!
cropLayout.addOnCropListener(object : OnCropListener {
override fun onSuccess(bitmap: Bitmap) {
// do somethhing with bitmap.
}
override fun onFailure(e: Exception) {
// do error handling.
}
})
cropView.isOffFrame() // optionally check if the image is off the frame.
cropView.crop() // crop image
Attributes
| attribute | description | default |
|---|---|---|
| cropme_frame_width_percent | width of croppling frame | 80% |
| cropme_frame_height_percent | height of croppling frame | 80% |
| cropme_max_scale | maximum scale while cropping | 2.0 |
| cropme_with_border | if borders are shown while cropping | true |
| cropme_background_alpha | background alpha out side of cropping area | 80% |
| cropme_overlay_shape | shape of croppling frame | rectangle / circle / custom |
| cropme_custom_shape_layout | custom layout for custom shape | @layout/custom_layout |
Custom Overlay
If you want to show a custom overlay, you can customize the Overlay by extending CropOverlay.
You can see more detail in app module.
class CustomCropOverlay @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0,
cropOverlayAttrs: AttributeSet? = attrs
) : CropOverlay(context, attrs, defStyleAttr, cropOverlayAttrs) {
override fun drawBackground(canvas: Canvas, paint: Paint) {
// draw background
}
override fun drawCrop(canvas: Canvas, paint: Paint) {
// draw croppling frame
}
override fun drawBorder(canvas: Canvas, paint: Paint) {
// draw borders
}
}
Sample
Clone this repo and check out the app module.
Author
- Taku Semba
- Github - (https://github.com/takusemba)
- Twitter - (https://twitter.com/takusemba)
- Facebook - (https://www.facebook.com/takusemba)
Licence
Copyright 2017 Taku Semba.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
관련 프로젝트 살펴보기
불러오는 중…