Java: create graphics without awt? - java

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!

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.

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

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:
Replacing Functionality of PIL (ImageDraw) in Google App Engine (GAE)
http://denislaprise.com/2008/08/21/drawing-images-on-google-app-engine/

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.

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

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

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.

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

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

Related

Mobile Apps Java and HTML

Does anyone know a framework to develop a mobile application for Android with Java and HTML?
I mean develop UI with HTML (to reuse it with an other OS) and native functions with Java.
For the moment I am trying to develop multiplatform apps with Qt but it's quite complex to use native functions from Java, that's why I'm looking for an easier way to do it.
I don't think you can find this kind of framework.
If you meet some problems to use native functions with Qt I recommend you to watch BogDan Vatra videos and pdf
https://www.qtdeveloperdays.com/sites/default/files/BogdanVatra_Extending_Qt_Android_Apps_with_JNI.pdf
Besides, you should look at the QtAndroidNamespace class and runOnAndroidThread function.
Edit : You can find the videos in the Tutorials part of QtCreator
I am not sure about the Java but using javascript,we have alot of Frameworks like Titanium, Sencha Touch and PhoneGap etc.In this you can simply use the html,js,and css3 bundle to creates the IOS Android and as well as web.
I would strongly advise against reusing the UI on different mobile operating systems - it will always look as if it doesn't belong on one of those systems. Creating an Android UI isn't that complicated, you should try it.
That said, you could have just one big WebView on your native UI, displaying your HTML UI. You might need a web server in your app, serving the UI, though - I'm not sure.

Developing for HTML5 canvas using Box2D engine but NOT in Javascript

Basically I have the following constraints for an upcoming project/game:
Drawing should be done in the HTML5 canvas element
Use the Box2D physic engine (or equivalent physics engine)
Game logic (and as much code as possible) should be in Java, as I'm profficient in Java and it would be nice to be able to port the project to Android.
It can be summed up in this: I want to develop games/projects in the HTML5 canvas element, using some kind of physics engine while avoiding the mess of javascript. (preferably but not necessarily through Java)
Is this possible? Would it be viable?
I've looked at GWT but I'm unsure how efficient it would be for animation, and how I would go about to incorporate Box2D. (or another physics engine in Java for example, but would the translation to javascript be fast enough?)
I know that GWT compiles Java to JavaScript, but it does so in the boundaries of its framework, so I don't know how easy it would be to use GWT in your project.
If you find JavaScript too frustrating, check out CoffeeScript. It slim and sharp, can interoperate with JavaScript (in your case Box2D JS port) seamlessly.
Google's PlayN (formerly ForPlay) was used for the web version of Angry Birds, using Box2D. It's mainly intended to use WebGL for the rendering, but can use the canvas element when WebGL is not available (Angry Birds requires Flash, for the audio).
http://code.google.com/p/playn/
http://www.youtube.com/watch?v=F_sbusEUz5w

java.awt.* is not supported by GAE? how to resolve this?

BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
in app engine , i found it doesn't work, it said that java.awt.image.bufferedImage is not supported by GAE.and java.awt.*, javax.imageio.ImageWriter also are not suppoted by GAE. so can someone tell me how to implement those functions in GAE?
so can someone tell me how to implement those functions in GAE?
The simple answer is that it is not possible in GAE.
The Google App Engine has a great built-in Images API for image processing tasks.
For filesystem emulation on the Google App Engine, have a look at GAE VFS
In short, the way you are trying to accomplish your goal is inconsistent with the design of the App Engine.
If the usual built-in packages aren't available, you could try Jimi, which is a pure Java image processing library. It hasn't been updated in the best part of a decade, but it should do the job. No school like the old school.
GAE does not support java.awt images. You have to use GAE Image API to work with images.
Reference: https://developers.google.com/appengine/docs/java/images/
This API operates with bytes. The source/destination of your image data can be: post from form, URL connection, DataStore BLOB or BlobStorage.
For some seasons, when you are using external libs already using BufferedImage behind the scenes the GAE's ImageService is useless. I have googled out https://github.com/witwall/appengine-awt but haven't tryed it yet. i believe it is enough to just add the dependency of this lib to the project to make it working.

Library to embed 3D view in a swing app?

I'm currently searching for a 3d library that I could embed in a Swing application. This library doesn't necessarily have to be a huge thing as I mainly intend to give a 3D representation of some shapes, and certainly rotate around them.
My main concern is to get something as easy to set up and to deploy as possible.
Do you have any clue ?
Why not just embed Java3D in your application.
http://java3d.j3d.org/tutorials/quick_fix/swing.html
You can also embed Jogl (Java OpenGL) with Swing.
http://cld.blog-city.com/mixing_java_2d_and_3d_jogl_in_a_swing_application.htm
Java3D would be higher level so it may be a better choice.

What's the best 3D graphics library for Java web apps?

I'm looking for a 3D graphics library for a Java web app. Could use some recommendations - only open source, though.
Edit: I don't really care how the graphics are output - Javascript/applets/canvas/flash but I want to write the graphics logic in Java.
JMonkeyEngine is very good.
Have a look at the The Lightweight Java Game Library. It provided developers access to crossplatform libraries such as openGl. And can run in the browser.
http://lwjgl.org
Here are a few demos:
http://lwjgl.org/applet/
http://fabiensanglard.net/Prototyp/index.php
http://www.cokeandcode.com/info/tut2d-4.html
People are doing awesome projects with this library:
http://lwjgl.org/projects.php
Here's an article that describes how to use jmonkeyengine in an applet.
http://www.streamhead.com/tutorial-jmonkeyengine-applet-hardware-3d-in-the-browser/
(JMonkeyEngine is a rather nice 3d-engine)

Categories