Paint applications are become famous thanks to Microsoft Paint, well known as simply Paint or Paintbrush. It was a simple computer graphics application included with all versions of Microsoft Windows. In this tutorial, you are going to discover how to create a Paint Application for Android which will let users to draw on the screen with their fingers.
Our Paint Application for Android will offer the following features to users :
- Draw paths with fingers on the screen
- Normal mode
- Emboss mode
- Blur mode
- Clear option to remove all paths on the screen
Download this app from Microsoft Store for Windows 10, Windows 10 Team (Surface Hub). See screenshots, read the latest customer reviews, and compare ratings for Paint 3D. Download the latest version of MediBang Paint for whatever device you're using.
Note that you can discover this tutorial in video directly on YouTube :
Even better, you can enjoy the demo of this Paint Application directly on your Android smartphones and tablets by downloading Tiny Paint on the Google Play Store :
Finger Path Object
The first step is to create a FingerPath Object to represent a path drawn with the finger on the screen. Our FingerPath class will have several fields letting us to define :
- Color of the path
- Emboss mode or no
- Blur mode or no
- Stroke width of the path
- Path object from the standard SDK representing the path drawn
Our object will be just like that :
Create the Paint View
With the possibility to represent a path drawn with the finger of the user on the screen, we need now to define a custom view to draw these paths on the screen. For that, we are going to create a PaintView class.
Obviously, our PaintView class will extend the View object from the standard SDK. The PaintView class will have some constants like the size the stroke width for the path also known as brush size or still the color of the path drawn.
The PaintView will store several FingerPath objects inside an ArrayList field. Besides, the PaintView object has a field for the Canvas used to draw the paths represented on the screen to the user.
In the constructor of the PaintView, we initialize the Paint Object used to draw the paths on the Canvas. We need to define the style of the Paint Object as STROKE. Then, we set the stroke join and stroke cap to ROUND. Finally, we create an EmbossMaskFilter Object for the emboss mode and an BlurMaskFilter for the blur mode.
This gives us the following code for the PaintView at this stage of the tutorial :
Now, we add an init method on the PaintView class. This method will take a DisplayMetrics Object in parameter and will be responsible to define the height and width of the PaintView. Furthermore, we initialize the Canvas and its underlying Bitmap used to draw paths on the screen.
The PaintView will expose three methods to switch between the three modes of drawing : normal, emboss and blur. The clear method will let us to clear the PaintView by clearing the list of Finger Paths. To let the users to visualize the changes on the screen, we don't forget to call the invalidate method to redraw the PaintView. https://pacificsoft.mystrikingly.com/blog/wifi-dumpper-for-windows-10.
Then, we override the onDraw method of the View class. First we save the current state of the Canvas instance before to draw the background color of the PaintView. We iterate on the list of Finger Paths and we draw the Path Object contained in the current FingerPath Object on the Canvas.
To apply the specific effect defined by the user, like emboss or blur, we set the corresponding mask filter on the Paint Object used to draw the FingerPath if needed. Finally, we draw all these elements on the Canvas of the PaintView and we restore the current Canvas.
At this stage, we have the following code for our PaintView :
Manage the users' touches on the screen
Now, we need to manager the users' touches on the screen to save the paths drawn on the screen with their fingers. We override the onTouchEvent method and we define three methods to manage the three following actions : Tele popup software crack download.
- ACTION_DOWN with a touchStart method
- ACTION_MOVE with a touchMove method
- ACTION_UP with a touchUp method
In the touchStart method, we start by creating a new Path and a new FingerPath Objects. We save the current coordinates (x,y) of the finger of the user and we call the moveTo method of the Path object.
In the touchMove method, we check if the move on the screen if greater than the touch tolerance defined as a constant previously. If yes, we call the quadTo method of the Path Object starting from the last point touched and going to the average position between the first position and the current position.
In the touchUp method, we end the line by calling the lineTo method of the Path object with the last position touched on the screen.
With these methods implemented, you can access to the complete code of the PaintView below :
User Interface of the Paint Application
With the PaintView Object created, we can define the User Interface of our Paint Application for Android. This UI will just display a PaintView matching its parent for width and height :
Implement the Main Activity
Last step is to implement the Main Activity and writing its Java code. In this activity, we just need to make the link between menu displayed to user with options (normal, emboss, blur or clear) offered by the PaintView.
Lights out 3 1 3. Besides, we need to load a DisplayMetrics object for the Main Activity and the initialize the PaintView Object with it in parameter.
It gives us the following code :
Enjoy Paint Application on Android
Now, you can run your Paint Application and enjoy painting on Android.
By using the base of our Pain Application, you can add a lot of new features like a color picker or the possibility to save your creations. It's your turn to play !
To discover more tutorials on Android development, don't hesitate to visit the SSaurel's Channel : https://www.youtube.com/user/sylsau
Tux Paint is completely free software, released as 'Open Source' software, under the provisions of the GNU General Public License (GPL), version 2. This means you may download it and install it on as many machines as you wish, copy it for friends and family, and give it to your local schools. In fact, we encourage this!
Tux Paint runs on most systems, but check the Requirements if you're unsure whether your system can support it.
Earlier versions of Tux Paint are available for other platforms and OSes not listed here. Visit the 'Download Older Versions' page to access them.
August 15, 2021 -The Stamps collection is now available for Android. Get them from the Android download page!
Current Version (0.9.26):
Microsoft Paint For Android
Microsoft Windows
- Windows 11, 10, 8, 7, Vista
- Users of Microsoft Windows 11, Windows 10, Windows 8, Windows 7, Windows Vista can download and run this simple installer application to get the full version of Tux Paint.
(A stand-alone ZIP-file version, also known as a 'Portable' version, is available, as well.) - Windows 2000, & XP
- Users of Microsoft Windows 2000 and Windows XP can download and run this simple installer application to get a Tux Paint.
(A stand-alone ZIP-file version, also known as a 'Portable' version, is available, as well.)
Apple macOS
- macOS
- Apple Macintosh owners running macOS can download Tux Paint here.
Linux
- RPM Linux Packages
- Users of RedHat and Fedora Linux distributions can download Tux Paint for Intel x86 architecture (i386) or source-code in RPM format.
- Flatpak Packages for Linux
- Users of a variety of Linux distributions can install Tux Paint via Flatpak, a framework for distributing desktop applications.
Linux Distribution Packages
Distribution-agnostic Packages
Android
- Android
- Android phone and tablet users can download 'Tux Paint', or install it from the F-Droid software repository.
Previous Version (0.9.25):
Linux
Microsoft Paint For Android Tablet
- Fedora Linux and EPEL Packages
- Users of Fedora and various Enterprise Linux platforms can download pre-compiled Tux Paint packages for their release and architecture from Fedora Package Sources
- Slackware Linux Packages
- Slackware users can download Tux Paint packages via SlackBuild.org.
Linux Distribution Packages
Haiku
- Haiku
- Haiku users can download Tux Paint directly, or via Haiku Depot.
Other Downloads:
- Source-code
- Other Linux and Unix users can download the source-code to compile and install Tux Paint.(Developers can get the latest from the Git source-code repository.)
- Fonts
- Tux Paint users who use languages requiring their own fonts can download pre-packaged TrueType Fonts for Tux Paint.
- Icons
- Alternative icons for Tux Paint.
Did you know?Penguins live almost exclusively in the southern hemisphere.