javagraphicscode-generationimage-editor

Java Image Editor which renders output as source code?


Alex explained what I'm looking for much better than I have:

You want an existing program that allows you to draw a picture, captures what you do as you draw, and writes each action as a Java command. When you click the "Drawl Oval" tool and click at 0,0 and then at 50,50, it would generate the line g.drawOval(0,0,50,50).

If anybody knows of a program such as this, let me know. Thanks.


Original question:

I've been working with Java and custom drawing using the java.awt.Graphics library lately, but find it is taking too much time to write manually. Is there any simple graphics editor (like mspaint) which generates source code?

Example:

Drawing this: alt text

Would generate:

public void update(Graphics g) {
    g.translate(0, 0);
    g.drawOval(0, 0, 50, 50);
}

Thanks.


Solution

  • If they are vectors, you could use an SVG Editor (eg, Inkscape) along with Kirill's SVG to Java2D Transcoder to simplify this. It isn't perfect, but Kirill is very responsive in responding to requests for enhancement.