Skip to content
This repository has been archived by the owner on Mar 26, 2022. It is now read-only.

DrawingView is a simple view that lets you draw on screen using your fingers and lets you save the drawings as images.

License

Notifications You must be signed in to change notification settings

mukeshsolanki/DrawingView-Android

Repository files navigation

DrawingView-Android - deprecated



This library has been deprecated in favor of https://github.com/akshay2211/DrawBox DrawingView is a simple view that lets you draw on screen using your fingers and lets you save the drawings as images.

Demo

Getting started

Its really simple to integrate DrawingView in android. All you need to do make the following change to you build gradle.

Step 1. Add the JitPack repository to your build file. Add it in your root build.gradle at the end of repositories:

allprojects {
  repositories {
    ...
    maven { url "https://jitpack.io" }
  }
}

Step 2. Add the dependency

dependencies {
    implementation 'com.github.mukeshsolanki:DrawingView-Android:<latest-version>'
}

How to use DrawingView

Its fairly simple and straight forward to use DrawingView in you application. Just add the following in your layout where you want to display the DrawingView.

<com.mukesh.DrawingView
  android:id="@+id/scratch_pad"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:layout_above="@+id/buttons"
  />

and reference it in your activity/fragment and assign the DrawingView like wise.

DrawingView drawingView = (DrawingView) findViewById(R.id.scratch_pad);
drawingView.initializePen(); //To use the pen mode to draw on the screen
drawingView.initializeEraser(); //To use the eraser mode to clear the screen
drawingView.setBackgroundColor(@ColorInt int color); //To set the background color of the drawing view
drawingView.setEraserSize(float size); //To set the size of the eraser
drawingView.setPenSize(float size); //To set the size of the pen
drawingView.setPenColor(@ColorInt int color); //To set the color of the pen
drawingView.saveImage(String filePath, String filename, Bitmap.CompressFormat format, int quality); //To save the image after your done drawing
drawingView.loadImage(Bitmap bitmap); //Load image (your saved drawing)
drawingView.clear(); //clear image

Author

Maintained by Mukesh Solanki

Contribution

GitHub contributors

License

MIT License

Copyright (c) 2018 Mukesh Solanki

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.

About

DrawingView is a simple view that lets you draw on screen using your fingers and lets you save the drawings as images.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages