Painting in Java

Art is a subject that interested me from a young age. Growing up, I would always sketch out things I saw that I found interesting. With modern technology, art is no longer limited to the stroke of a paintbrush. Today, paint and graphic editing programs allow us to utilize our creativity to create unique artwork by using intangible sketches and brushes on a digital screen.

You may have heard of popular graphics editing software such as Photoshop and Microsoft Paint which have millions of users. These type of programs are known as raster graphics editing software and have been around for over twenty years. The original Microsoft Paint was released in 1985 and Adobe Photoshop followed soon after in 1988. With continuous updates adding new features and functionality every year, users have the ability to create more and more art and edit their photos in creative and revolutionary ways. Raster graphics editing software begun with the basic features of sketching and painting and cropping images and has evolved to contain features such as automatic color balancing and image filters.

There are an abundance of graphics editing software each with slightly different features and interfaces, however, the majority contain the same basic features such as drawing, erasing, and painting using different colors. We will be creating a simple version of a graphics editing software that is quite similar to the original Paint program with the basic features mentioned previously.

 

Pictured above is a comparison of the original Microsoft Paint and the modern day version of Paint and how graphics editing software has evolved over time.

The outline we will follow to create our program is to first load in icons with the tools our paint program contains such as pencils and paintbrushes as buttons. We will then check if a particular button or tool is selected and then implement different things to draw onto the background depending on the tool selected.

Our code above also accounts for choosing between different colors in a similar way. We check to see whether or not a different color is selected and we adjust our code to account for these colors.

Click here to run our example program !

Although this paint program is very simplistic, it provides a foundation for users to add more features and functionality. It also shows how we can piece together simple concepts such as detecting mouse inputs and Image objects to create something applicable and functional such as a paint program. With the fundamental software in place, implementing more advanced popular features contained in mainstream raster graphics editing software such as image filtering is very feasible.

Are KTBYTE computer science classes a good fit for your child? Speak to an instructor to find out! We'll give you a call within 24 hours.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *