Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Pixeleditor in Java  (Read 965 times)

neverknown

  • Bay Watcher
    • View Profile
Pixeleditor in Java
« on: May 20, 2010, 02:13:56 pm »

Hi all..

I want to code a Pixeleditor in Java(have some expierence with it too)
but I dont know which libraries I need / the documentation is painful to read.
Does somebody have expirience working with creating graphics in java
and can give a little overview what I need to do to have simple white canvas to paint on with a pen like tool?

Thanks!
Logged

SolarShado

  • Bay Watcher
  • Psi-Blade => Your Back
    • View Profile
Re: Pixeleditor in Java
« Reply #1 on: May 21, 2010, 11:40:44 pm »

Pixel-editor... I guess you mean something vaguely kin to MSpaint?

You can make a simple painting canvas with java.awt.Canvas and java.awt.event.MouseListener, never tried it myself, but I recall that there's a demo applet with the SDK that does this.

How familiar are you with Java and the standard libraries? You can do quite a bit with the standard libraries.

There're classes under java.awt.image that allow programmatic image manipulation (array-of-pixels access). Never used it myself, but you might want to give it a look.

There's java.io for file I/O and some java.io.File allows some file operations (creating, deleting, renaming, etc.). Haven't made heavy use of the File class, but the basics are to use a FIleInputStream or FileOutputStream with a Reader or Writer. Look at the API doc, or I can give you a quick code sample.

java.net has sockets an so on for network programs, nothing you'd need for your project, unless you're making an applet, then you might need java.net.URL

java.util has a bunch of odds and ends, including the Collections classes (List, HashTable, etc., etc.) and an RNG implementation.

java.awt contains the basic GUI framework, there's also javax.swing, which I haven't used much myself, but it provides similar functionality.

:o lookit all that rambling... hope it helps :)
Logged
Avid (rabid?) Linux user. Preferred flavor: Arch