8

Is there any library out there to create graphics without using AWT?
What I need is simple drawing functions (like to draw a line) and text drawing functions to create graphics in memory for a Google app engine application. App engine does not support AWT.

Thanks!

Damian
  • 5,471
  • 11
  • 56
  • 89
  • Does the client support SVG? If so, you could look at http://java.sun.com/javame/technology/msa/jsr226.jsp – rleir Feb 01 '10 at 14:49
  • In the same spirit as rleir comment, could batik be an option ? http://xmlgraphics.apache.org/batik/ – Hubert Feb 02 '10 at 20:43
  • It's website that anyone can use, so the client may not support SVG. AlBlue: that's not true. – Damian Feb 03 '10 at 11:55
  • @AlBlue: That's true (and problematic), but a lot of the answers are unhelpful or actually require AWT, and are such that a quick google would confirm that. I think it's fair to rate down answers that a quick fact check indicates are incorrect. – BobMcGee Feb 03 '10 at 15:20
  • I agree with you, BobMcGee. Just to clarify: I voted some answers down because they were *TOTALLY* wrong and some of them had been voted up before my vote, thing I just can't understand. But I also voted up other answers that -although not giving a solution to my question- were good answers. I think that's what the voting system is for. – Damian Feb 03 '10 at 23:41
  • Did you ever find a good answer to this? I've researched everything in the list, appengine-awt is dead and doesn't work, SenseLan doesn't do what's needed, Batik for GAE project is dead, TinyLine hasn't been updated in a year, is buggy and unusable and the author takes a week to respond to a simple email and python has the same problems. – Frodo Baggins Oct 07 '11 at 15:24
  • @David No, I've implemented a simple class to do some drawings and then I used a java library to compress it as png. This project of mine is dead now, so I can't tell you the name of the png lib. As for drawing text: I've found no solution. – Damian Oct 08 '11 at 14:10

9 Answers9

4

Not unless you want to implement your own image class (say, a bitmap) and rendering algorithms for lines, shapes, images.

If you have experience with computer graphics and rasterization, this may not be very hard, but otherwise it will be more than you want to bite off.

Gareth Davis
  • 27,701
  • 12
  • 73
  • 106
BobMcGee
  • 19,824
  • 10
  • 45
  • 57
  • That's what I've done and it works great, but the problem is rendering text. That's something I think I cant solve writing my own code. At least not as easily as drawing lines or circles. – Damian Feb 03 '10 at 11:53
  • @Damian: Text rendering is complex, and I'm not sure you'll find an easy solution. You *might* try using the non-native parts of AWT as a standard package -- I recall seeing a fully software (no GPU) implementation of a lot of the drawing functionality somewhere. They were using it for benchmarking and demonstrating a parallel approach. – BobMcGee Feb 03 '10 at 15:24
  • Well I found this: http://fonteditor.org/ ... I will try it out as soon as I can. – Damian Feb 03 '10 at 23:47
2

You might also try the appengine-awt project, though it's a bit experimental.

Ken Bloom
  • 57,498
  • 14
  • 111
  • 168
1

You might try using SenseLan. In the requirements section, it says they don't use awt or ImageIO. Of course, there is the Images api but it seems fairly limited in what it offers.

Edit:

It looks like there are a couple of Python possibilities that could offer you some limited drawing capabilities. You could probably write appropriate image functionality as python web services, and keep the rest of the app in Java:

  1. Replacing Functionality of PIL (ImageDraw) in Google App Engine (GAE)
  2. http://denislaprise.com/2008/08/21/drawing-images-on-google-app-engine/
Community
  • 1
  • 1
Jay Askren
  • 10,282
  • 14
  • 53
  • 75
  • Well, senselan is great but it only converts images from format to format. What I need is simple graphic functions (like to draw lines) and to draw text. – Damian Jan 30 '10 at 20:55
  • As the title says, it must be a Java library. My app is already developed in java. – Damian Jan 30 '10 at 21:34
  • @Damian: Jhython -- run Python code in Java, and would let you bridge the gap. – BobMcGee Feb 03 '10 at 15:20
1

Use Batik for GAE which is available as a dependency of FOP on GAE.

You can also track the issue further on the Google app engine bug tracker where others have shared other ideas in the comments.

Ken Bloom
  • 57,498
  • 14
  • 111
  • 168
0

'The Java 2D API is a set of classes for advanced 2D graphics and imaging, encompassing line art, text, and images' http://java.sun.com/products/java-media/2D/index.jsp

Here's another possibility: org.eclipse.draw2d It probably relies on eclipse SWT.

rleir
  • 791
  • 1
  • 7
  • 19
  • Look at the javadoc: http://java.sun.com/j2se/1.4.2/docs/guide/2d/spec.html I can't use AWT. – Damian Jan 31 '10 at 13:09
0

TinyLine provides vector graphics support on the Google App Engine server side, and also provides SVG rendering support. See the SVG Thumbnail images demo.

Ken Bloom
  • 57,498
  • 14
  • 111
  • 168
-1

Google Web Toolkit contains a nice graphics library designed for interfacing with the Google app engine.

edit to clarify: Google App Engine is designed for hosting applications on the web. You need to design graphics that can run in the browser. To do this, you need to write code in a web language, Javascript, for example. Google Web Toolkit contains a Java graphics library which compiles down to Javascript, saving you the effort of writing the Javascript yourself.

Pace
  • 41,875
  • 13
  • 113
  • 156
-1

I hesitate to mention PJA, which appears to work if the AWT classes are present, but the security manager prevents you from using them.

Ken Bloom
  • 57,498
  • 14
  • 111
  • 168
-1

If you can use Python on GAE instead of Java, then there's pybmp.

Ken Bloom
  • 57,498
  • 14
  • 111
  • 168