Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Cleveroad/DroidArt
Android library that allows perform manipulations with text and easily combine it with images.
https://github.com/Cleveroad/DroidArt
Last synced: about 1 month ago
JSON representation
Android library that allows perform manipulations with text and easily combine it with images.
- Host: GitHub
- URL: https://github.com/Cleveroad/DroidArt
- Owner: Cleveroad
- License: mit
- Created: 2018-07-13T11:01:08.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-11-19T09:12:11.000Z (about 6 years ago)
- Last Synced: 2024-08-02T05:15:37.191Z (4 months ago)
- Language: Kotlin
- Homepage: https://www.cleveroad.com/
- Size: 3.69 MB
- Stars: 209
- Watchers: 8
- Forks: 27
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-kotlin-android - DroidArt - 在图像上键入任意形状的文本🔥🔥 (开源库 / UI)
README
# DroidArt [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome)
![Header image](/images/header.jpg)## Meet DroidArt by Cleveroad
We are happy to share our latest Android library with you - DroidArt. The Android app component shows the example of DroidArt library usage. It allows perform manipulations with text and easily combine it with images. If your app is about image editing, take a closer look at this customizable component.
![Demo image](/images/demo.gif)
Here is how the DroidArt app component works. The first step is to select a background. Users can choose an image from the device’s gallery or take a photo right away. The next step is to type text over the image. Users can customize text by choosing font, changing size and color, adding shadow and blurring it.
However, the main feature of the library is the possibility to bend text along the Bézier curve. Therefore, it can fit any shape of your background image. After all the manipulations, user can save the result in the device’s gallery.
Try this simple and intuitive library for Android apps and bring new experience to your app users. If you need more details on how you can use the component and what benefits it provides, get in touch with us.
[![Awesome](/images/logo-footer.png)](https://www.cleveroad.com/?utm_source=github&utm_medium=label&utm_campaign=contacts)
## Setup and usage
### Installation
by gradle :
```groovy
dependencies {
implementation 'com.cleveroad.droidart:droidart:1.0.1'
}
```
### Usage ###
#### DroidArt ####
```XML
```
| attribute name | description |
|---|---|
| text | Text value for displaying. |
| text_color | Value of color for displaying text. |
| text_size | Value for size of displaying text. |
| text_elevation_percent | Elevation in percent. Shadow will be shown only if [textShadowColor] will be set. |
| text_shadow_color | Color of the shadow of the text. |
| text_shadow_blur_radius | Radius for shadow blur. |
| selector_color | Value of color for the selector rectangle. |
| button_color | Value of color for the control buttons. |
| font_id | Id to the custom font for text. Note than if id will be incorrect, you will receive [RuntimeException]. |
| icon_reset_button | drag and drop mode. If enable, column or row will change its position with dragging after long press on row or column header. |
| icon_scale_button | drag and drop mode. If enable, column or row will change its position with dragging after long press on row or column header. |
| icon_change_view_button | drag and drop mode. If enable, column or row will change its position with dragging after long press on row or column header. |```groovy
/**
* Text value for displaying
*/
var text: String/**
* Value of color for displaying text
*/
var textColor: Int/**
* Value for size of displaying text
*/
var textSize: Float/**
* Id to the custom font for text
*
* Note than if id will be incorrect, you will receive [RuntimeException]
*/
var fontId: Int/**
* Elevation in percent
*
* Shadow will be shown only if [textShadowColor] will be set
*/
var textElevationPercent: Int/**
* Color of the shadow of the text
*/
var textShadowColor: Int/**
* Radius for shadow blur
*/
var textShadowBlurRadius: Float/**
* Use the method to subscribe to receive a callback when a touch event occurs
*
* @param touchEventCallback The interface for listener to the touch event
*/
fun subscribeTouchEventCallback(touchEventCallback: TouchEventCallback)/**
* Use the method to subscribe to receive a callback when a touch event occurs
*
* @param changeViewTextCallback The interface for listener to the change view text mode
*/
fun subscribeChangeViewTextCallback(changeViewTextCallback: ChangeViewTextCallback)/**
* Use the method to cancel the subscription of receiving a callback
* when a touch event occurs
*
* @param touchEventCallback The interface for listener to the touch event
*/
fun unsubscribeTouchEventCallback(touchEventCallback: TouchEventCallback)/**
* Use the method to cancel the subscription of receiving a callback
* when a change view text mode occurs
*
* @param changeViewTextCallback The interface for listener to the change view text mode
*/
fun unsubscribeChangeViewTextCallback(changeViewTextCallback: ChangeViewTextCallback)/**
* Use the method to set [PathEffect] to the selector paint
* @see PathEffect
*/
fun setPathEffectForSelector(effect: PathEffect)/**
* Use the method to set [Color] to the selector rectangle
* @see Color
*/
fun setColorForSelector(@ColorInt intColor: Int)/**
* Use the method to set [Color] to the dash paint
* @see Color
*/
fun setColorForDashLine(@ColorInt intColor: Int)/**
* Use the method to set [Color] to control buttons
* @see Color
*/
fun setColorForSelectorButton(@ColorInt intColor: Int)/**
* Use the method to set [Color] to shadow
* @see Color
*/
fun setColorForTextShadow(@ColorInt intColor: Int)/**
* Use the method to set the width for stroking
*
* @param width set the paint's stroke width, used whenever the paint's
* style is Stroke or StrokeAndFill.
*/
fun setStrokeWidthForSelector(width: Float)/**
* Use the method to set the width for stroking
*
* @param width set the paint's stroke width, used whenever the paint's
* style is Stroke or StrokeAndFill.
*/
fun setStrokeWidthForDashLine(width: Float)/**
* Use the method to set the icon for the change view button
*
* @param resId The resource id for the button icon
*/
fun setBitmapChangeViewTextButton(@DrawableRes resId: Int)/**
* Use the method to set the icon for the scale button
*
* @param resId The resource id for the button icon
*/
fun setBitmapScaleButton(@DrawableRes resId: Int)/**
* Use the method to set the icon for the reset button
*
* @param resId The resource id for the button icon
*/
fun setBitmapResetChangeViewTextButton(@DrawableRes resId: Int)/**
* Use the method to obtain current [ChangeText] mod
*/
fun getChangeViewTextMode()/**
* Use the method for set the [ShowButtonOnSelector] mode for the button
*
* @param showButtonOnSelector The enum for show a button on the selector
*/
fun showScaleRotateButton(showButtonOnSelector: ShowButtonOnSelector)/**
* Use the method for set the [ShowButtonOnSelector] mode for the button
*
* @param showButtonOnSelector The enum for show a button on the selector
*/
fun showChangeViewTextButton(showButtonOnSelector: ShowButtonOnSelector)/**
* Use the method for set the [ShowButtonOnSelector] mode for the button
*
* @param showButtonOnSelector The enum for show a button on the selector
*/
fun showResetViewTextButton(showButtonOnSelector: ShowButtonOnSelector)/**
* Use the method for set the [ChangeText] mode for text
*
* @param changeText The enum with different types of actions for interacting with text
*/
fun changeViewTextMode(changeText: ChangeText)/**
* Use the method for set the initial value for the Bezier curve
*/
fun resetViewText()/**
* Use the method to draw the text in the bitmap
*@see Bitmap
*
* @param bitmap The bitmap that will be drawn below the text
*/
fun saveResult(bitmap: Bitmap): Bitmap/**
* Use the method to move text to the center of the screen
*/
fun moveTextToCenter()```
#### Fragment/Activity usage ####
```groovy
private const val DASH_PATH_ON_DISTANCE = 30F
private const val DASH_PATH_OFF_DISTANCE = 10F
private const val DASH_PATH_PHASE = 0F
private const val STROKE_WIDTH_FOR_DASH_LINE = 4F
...
evDroidArt = (EditorView) view.findViewById(R.id.evDroidArt)evDroidArt?.apply {
setPathEffectForSelector(
DashPathEffect(floatArrayOf(DASH_PATH_ON_DISTANCE, DASH_PATH_OFF_DISTANCE),
DASH_PATH_PHASE))
setStrokeWidthForDashLine(STROKE_WIDTH_FOR_DASH_LINE)
setColorForTextShadow(Color.GRAY)
setColorForSelectorButton(Color.WHITE)
setColorForDashLine(Color.WHITE)
showScaleRotateButton(ShowButtonOnSelector.HIDE_BUTTON)
showResetViewTextButton(ShowButtonOnSelector.HIDE_BUTTON)
subscribeTouchEventCallback(touchEventCallback)
}
```
#### XML usage ####
```groovy
```## Changelog
See [changelog history].### Support ###
If you have any questions, issues or propositions, please create a new issue in this repository.If you want to hire us, send an email to [email protected] or fill the form on contact page
Follow us:
[![Awesome](/images/social/facebook.png)](https://www.facebook.com/cleveroadinc/) [![Awesome](/images/social/twitter.png)](https://twitter.com/cleveroadinc) [![Awesome](/images/social/google.png)](https://plus.google.com/+CleveroadInc) [![Awesome](/images/social/linkedin.png)](https://www.linkedin.com/company/cleveroad-inc-) [![Awesome](/images/social/youtube.png)](https://www.youtube.com/channel/UCFNHnq1sEtLiy0YCRHG2Vaw)
### License ###
* * *
The MIT License (MIT)
Copyright (c) 2016 Cleveroad Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.[changelog history]: /CHANGELOG.md