Java: create graphics without awt?

2019-04-06 09:43发布

问题:

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!

回答1:

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.



回答2:

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



回答3:

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/


回答4:

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.



回答5:

'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.



回答6:

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



回答7:

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.



回答8:

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



回答9:

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