crop-image-layout - 圖片裁剪布局

jopen 8年前發布 | 12K 次閱讀 Android開發 移動開發 crop-image-layout

Image Cropping Layout

A light-weight image cropping layout, allowing UI customization and cropping box update listener. Image and the selected area (cropping box) is scale and fit into the predefined area.

Current Version: 1.0.5

image-crop

Import

dependencies {
    compile 'me.littlecheesecake:croplayout:1.0.5'
    ...
}

Usage

EditPhotoView imageView = (EditPhotoView) findViewById(R.id.editable_image);
EditableImage image = new EditableImage(this, R.drawable.photo2);
image.setBox(new ScalableBox(25,180,640,880));

imageView.initView(this, image);

imageView.setOnBoxChangedListener(new OnBoxChangedListener() {
    @Override
    public void onChanged(int x1, int y1, int x2, int y2) {
        //TODO: cropping box updated 
    }
});

UI Customization

<me.littlecheesecake.croplayout.EditPhotoView
    android:id="@+id/editable_image"
    android:layout_width="300dp"
    android:layout_height="200dp"
    android:layout_margin="20dp"
    android:background="#fff"
    crop:crop_corner_color="#45B4CA"
    crop:crop_line_color="#d7af55"
    crop:crop_shadow_color="#77ffffff"/>

image_attr

Known Issue

  • actual cropping of the image is not implemented, but only update the selected area (cropping box)
  • crop box will be reset to the full image after rotation
  • image zoom-in is not supported

Developed By

Yu Lu @littlecheesecake.me

項目地址: https://github.com/yulu/crop-image-layout

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!