Clay is an Android library project that provides image trimming which is originally an UI component of LINE Creators Studio

Overview

Clay

API build-status

Clay is an Android library project that provides image trimming. Fully written in Kotlin, Clay is originally a UI component of LINE Creators Studio, a LINE app for creating LINE stickers. You can use Clay with any Android application to trim the outline of an image and create your own custom shape.

  • Produce a trimmed image
  • Zoom in/out an image
  • Undo previous trimming actions

Click here to see how you can trim an image into a random shape.

How to build

Use Gradle to build the library. Download it from JCenter and add configurations in the build.gradle file as follows.

allprojects {
    repositories {
        jcenter()
    }
}

dependencies {
  implementation "com.linecorp:clayview:0.1.2"
}

Getting started

To get started with Clay, define its view in an XML layout file as follows.

  <com.linecorp.clay.view.ClayView
    android:id="@+id/clay"
    android:src="@drawable/test2"
    app:strokeWidth="6dp"
    app:endPointRadius="20dp"
    app:controlPointColor="@android:color/holo_red_dark"
    app:strokeColor="@color/orange_ffcc80" />

Then you can use ClayView as follows.

val clayView = findViewById(R.id.clay) as ClayView

clayView.undoSelect() // undo
clayView.getCroppedImage() // get the cropped image

You can find a more advanced way of using the library from the example.

How to contribute to Clay

See CONTRIBUTE.md

License

Copyright 2017 LINE Corporation

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.
You might also like...
kinstall is an easy way to install gradle-based command-line kotlin projects that use the application plugin.

kinstall kinstall is an easy way to install gradle-based command-line kotlin projects that use the application plugin. use First, install kinstall its

ViewModel e LiveData - Android Studio - Kotlin

Unscramble App Starter code for Android Basics codelab - Store the data in a ViewModel Unscramble is a single player game app that displays scrambled

A Tutorial Marks App developed in Android studio

Tutorials-Marking-App-Android This is a Tutorial Marks App developed in Android studio. The application has three sections: Classlist - mainly used fo

Anime quotes rest api app with mvvm, LiveData, Coroutines, Navigation Component etc

AnimeQuote Anime quotes image rest api app with mvvm, LiveData, Coroutines, Navigation Component, clean achitecture etc An app created during mentorin

Jetpack Compose, Kotlin, MVVM, Navigation Component, Hilt, Retrofit2

Jetpack-Compose-Blueprint Jetpack Compose, Kotlin, MVVM, Navigation Component, Hilt, Retrofit2 Apps Packages data : It contains all the data accessing

FaceTimeClone app that implements Coroutines , mvvm architecture , clean architecture , navigation component , hilt , etc.... using kotlin language
FaceTimeClone app that implements Coroutines , mvvm architecture , clean architecture , navigation component , hilt , etc.... using kotlin language

This repository contains a FaceTimeClone app that implements Coroutines , mvvm architecture , clean architecture , navigation component , hilt , etc.... using kotlin language

Educational App made with Retrofit, Coroutines, Navigation Component, Room, Dagger Hilt, Flow & Material Motion Animations.
Educational App made with Retrofit, Coroutines, Navigation Component, Room, Dagger Hilt, Flow & Material Motion Animations.

TechHub TechHub is a sample educational app that provides courses for people who want to learn new skills in mostly tech-related areas. The goal of th

A Clean Architecture App that uses clean Architecture (app, presentation, domain, data) packages to use coffee items API using MVVM Architecture, Coroutines, Retrofit2, Pagination, Live Data, Data Binding, Hilt , SOLID Principles , Navigation Component , RoomDb. Events Calendar is a user-friendly library that helps you achieve a cool Calendar UI with events mapping. You can customise every pixel of the calendar as per your wish and still achieve in implementing all the functionalities of the native android calendar in addition with adding dots to the calendar which represents the presence of an event on the respective dates. It can be done easily, you are just a few steps away from implementing your own badass looking Calendar for your very own project!
Comments
  • Migrate to AndroidX

    Migrate to AndroidX

    • upgrade gradle & gradle tool version
    • upgrade comipleSdkVersion(27->28), buildToolsVersion(27.0.3->28.0.3)
    • migrate to androidx
    • refactor gradle dependencies
    • README
    opened by rurimo 3
  • it throws IllegalStateException when loading image from Google photo app.

    it throws IllegalStateException when loading image from Google photo app.

    In case of Google Photo app, need to check image uri came from Google photo app. And download to bitmap to file and pass imageUri. (Downlodabe images.)

    LOG

    E/AndroidRuntime: FATAL EXCEPTION: main Process: com.linecorp.clay.example, PID: 17901 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.linecorp.clay.example/com.linecorp.clay.example.MainAnkoActivity}: java.lang.IllegalStateException: imagePath must not be null at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) at android.app.ActivityThread.-wrap11(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) Caused by: java.lang.IllegalStateException: imagePath must not be null at com.linecorp.clay.example.MainAnkoActivity.onCreate(MainAnkoActivity.kt:29) at android.app.Activity.performCreate(Activity.java:6251) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)  at android.app.ActivityThread.-wrap11(ActivityThread.java)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:148)  at android.app.ActivityThread.main(ActivityThread.java:5417)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 

    bug 
    opened by DanielWorld 0
  • Fixed a crash when the image is smaller than screen size

    Fixed a crash when the image is smaller than screen size

    The width or height of the rect of cropped path would become negative in case the bitmap is smaller than screen size. So it would cause a crash when creating the bitmap

    bug 
    opened by wangyung 0
Releases(v0.1.2)
Owner
LINE
LINE
Create kotlin android project with one line of command.

README This is an android application template project built with kotlin language and some useful libraries. It provides a creator script to quickly c

nekocode 1.6k Dec 20, 2022
Blinking-image-view - A variant of Android View that blinks only the source image (not the background)

Blinker View for Android What is this? Blinker View is an Android View that blinks a given drawable. Yes, it's that simple. Place it in your layout an

Milos Marinkovic 4 Jul 29, 2020
Improved project template for Android Studio

Improved project template for Android Studio Unfortunately the default Android Studio template has a lot of unnecessary stuff that has to be removed e

Dmitriy 2 Sep 27, 2022
Andorid app which provides a bunch of useful Linux commands.

Linux Command Library for Android The app currently has 3203 manual pages, 1351 one-line scripts and a bunch of general terminal tips. It works 100% o

Simon Schubert 276 Dec 31, 2022
Oratio Library for Android Studio helps you simplify your Android TTS codes

Oratio Oratio is a library for Android Studio. This library is useful to a number of developers who are currently making apps using android TTS(Text-T

Jacob Lim 1 Oct 28, 2021
A fast, lightweight, entity component system library written in Kotlin.

Fleks A fast, lightweight, entity component system library written in Kotlin. Motivation When developing my hobby games using LibGDX, I always used As

Simon 66 Dec 28, 2022
Run Minecraft on the command line

HeadlessForge While headless Minecraft Clients aren't anything new, they come with a drawback. The Minecraft API is missing and you need to add all fu

null 28 Oct 17, 2022
A declarative, Kotlin-idiomatic API for writing dynamic command line applications.

A declarative, Kotlin-idiomatic API for writing dynamic command line applications.

Varabyte 349 Jan 9, 2023
Utility - The cross-platform native Kotlin command line tool template

Utility The cross-platform native Kotlin command line tool template. Usage Make

null 0 Jan 3, 2022
A fast-prototyping command line system

Kotlin-er CLI A different take on making command line programs, emphasizing development speed over customization Status Auto-deployed to Maven Central

Lightning Kite 22 Jan 22, 2022