Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVG processing under Java on Android and desktop

Tags:

java

android

svg

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 ?

like image 797
tommyk Avatar asked Dec 23 '10 09:12

tommyk


People also ask

Can we use SVG in Android?

Android Studio includes a tool called Vector Asset Studio that helps you add material icons and import Scalable Vector Graphic (SVG) and Adobe Photoshop Document (PSD) files into your project as vector drawable resources.

How do I open an SVG file on Android?

SVG Viewer - SVG Reader SVG Viewer – SVG Reader is a free Android app to view SVG files. This is another simple app with a single focus on viewing the SVG files. While opening the SVG file, it gives users an option to pick the background color. Users can select a background color of their choice and view the SVG file.

How do I edit SVG files on Android?

To edit an SVG image in Office for Android, tap to select the SVG you want to edit and the Graphics tab should appear on the ribbon. Styles - These are a set of predefined styles you can add to quickly change the look of your SVG file.

Are SVG vector files?

EPS and SVG are both vector-based formats. While vector files are excellent for producing crisp graphics, drawings, and designs at any scale, they struggle to reproduce photographs. Raster-based files like JPEG, GIF, TIFF and PNG are better suited to photography.


2 Answers

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.

like image 56
kgiannakakis Avatar answered Sep 24 '22 10:09

kgiannakakis


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

like image 44
Fred Grott Avatar answered Sep 25 '22 10:09

Fred Grott