I am trying to write a Java application that will generate SVG image based on XML file. The application should also be able to show SVG file. My application should run on Android platform and desktop PCs. I read about Swing + Batik but afaik it will not work on Android. What is the best library to achieve this ?
This article in Code Project deals with the subject. Two approaches are presented:
android-libsvg library.
Anti Grain Geometry engine.
Both solutions have dependencies on native code library, so you would need JNI.
There is also svg4mobile project, which only uses Java.
per this thread: libsvg ported
libsvg has been ported to android..see thread for details. You need a crystax form of NDK, ie exceptions enabled..build/install doc here at:build-install-doc
Also try this open-source library, Apache 2.0 license:
SVG-Android
Performance is good as the actual drawing is handled natively by an android.graphics.Picture object.
Related
I want to be able to play video files that were downloaded from a web server, as .mkv files, in a Swing application. What is a good library for doing this? Also, although this isn't really necessary, I would prefer it if it was a jar file, so that it could download it via the application and the end user wouldn't have to install anything manually.
Thanks!
You can use vlcj - Java Framework for the vlc Media Player
Taken from the site:
The vlcj project provides Java bindings to allow an instance of a native vlc media player to be embedded in a Java AWT Window or Swing JFrame. You get more than just simple bindings, you also get a higher level API that hides a lot of the complexities of working with libvlc.
You can try using JMF: http://www.oracle.com/technetwork/java/javase/tech/index-jsp-140239.html
or FMJ (open source version with some ffmpeg hooks): http://fmj-sf.net/
I'm not sure how well those projects are maintained though.
I would like to render/open PDF file (stored in SDCard) in Android without using in-build application or viewer.
1) We have tried MuPDF open source library but rendering using this library is very slow.
2) Can we use iText library for rendering PDF files in Android (i.e. iText as a PDF Viewer).
Is there any other PDF library(open source) that can be used in Android Or suggest basic guideline for developing PDF viewer for Android.
1) MuPDF is good to render textbook pdf in android while it may be slow to render pdf with big images. A lot of customizations and improvements especially memory usage control need to do if you want the MuPDF to run fast and stable on android platform. You can check out two open source projects VuDroid and apv which are based on MuPDF.
2) It's up to your requirements. The iText may be enough to render simple text pdf, but I don't think it has better performance than MuPDF or other libraries that developed by using C/C++.
Another choice is to use Poppler. A successful story is the popular android app ezPDF Reader is based on Poppler, although it's violating GPL license. The out of box Poppler needs more work than MuPDF to do to run on android smoothly. You can refer to the open source project apdfviewer.
I've done some research in this field recently, I've tried more than 14 libraries on Android, I've done simple benchmarking on some high resolution print-ready PDF magazines and I'm currently considering to use MuPDF or Radaee in work as they went out as the best.
I've tried VuDroid and apv as well and they are very unstable, they are crashing very often on complex PDF documents and very slow in comparsion to MuPDF or Radaee.
Since MuPDF and Radaee (and some other libraries) are written in pure C and are used on Android through NDK, they are giving the best possible performance (and they both are paid for a commercial use).
Take a look at my PDF reader for Android here at anddev.
As I remember it uses modified PDFBox (without things related to editing), and features my own font converter (to feed fonts to Android and render them faster).
I don't develop PDF reader anymore and I can make all my changes opensource (though it will require some work, and time). You can try it out to find out how well it performs for you. Note: reader doesn't support encryption and copy-protection.
Is there any Java image processing library that is as easy to use as and provides the set of functionalities provided by RMagick? (I have seen JMagick and unfortunately that is not the kind of library I am looking for.)
EDIT: Please note that the speed does not concern us as such. What we are looking for is an easy-to-use library that provides many common operations built-in.
Check out this, especially JAI. i dont have experience with this libs, but its on my todo list. there are demos somewhere on the site. maybe it is what you are looking for?!
There's ImageJ, which boasts to be the
world's fastest pure Java image processing program
It can be used as a library in another application. It's architecture is not brilliant, but it does basic image processing tasks.
It's not a pure Java solution, but the IM4JAVA project works for many uses. Im4Java itself is a pure Java library that uses the commandline version of ImageMagick as its back-end. It's easy to use and exposes pretty much all the functionality of ImageMagick without the dangers of including native code in your app. That means you can safely use it in application servers etc. without worrying that a crash in the native code will bring down your whole server.
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.
Simple question: Can I mix in my desktop application Java and JavaFX Script code? If it is possible could you provide me with some link with examples?
Or could I pack my custom made javafx CustomNode-s in a jar and use them in my project side by side with standard SWING components?
This article gives an example of calling JavaFX from Java, using the Scripting API.
Yes, you can mix Java and JavaFX.
According to one of the FAQ entries:
In addition, developers can use any Java library in their JavaFX applications. This allows JavaFX applications to take advantage of the rich JavaFX UI libraries, as well as the amazing breadth of functionality offered by Java.
The official source of information, including tools downloads, FAQ, and tutorials is the JavaFX web site.
I suggest you to look at dotFX. It can be useful for you. It has a netbeans plugin,too.
Read first here for get more information.
You can use a JavaFX 2.0 with Swing
http://javafx.com/about-javafx/
If you install the JavaFX 2.0 runtime first, then you launch an example http://download.oracle.com/otndocs/products/javafx/samples/SwingInterop/index.html
Supposedly all you have to do is drag and drop the JavaFX application to your desktop in order to make it a desktop application. You can also use Java code in a JavaFX application. Not sure about the other way around.
Yes Javafx and java apis can be mixed and used in your application without any problems.