SVG Tiny Library for a LBS Imaging Server and Non-SVG Mobile Devices
Total Page:16
File Type:pdf, Size:1020Kb
1st Winner of GlobalLogic White Paper Contest 2008 – Shivendra Tiwari, Lead Engineering SVGTLib: SVG Tiny Library for a LBS Imaging Server and Non-SVG Mobile Devices Shivendra Tiwari [email protected] Lead Engineering, Mobile Business Unit GlobalLogic India Pvt Ltd, Noida, UP, India 201301 April 2008 1 1st Winner of GlobalLogic White Paper Contest 2008 – Shivendra Tiwari, Lead Engineering Table of Contents 1 ABSTRACT................................................................................................................................... 3 2 INTRODUCTION......................................................................................................................... 4 2.1 GENERAL ADVANTAGES OF THE VECTOR GRAPHICS INCLUDE: ................................................... 4 2.2 SVG CONVERTER APPLICATIONS ............................................................................................ 5 2.3 RECENT TREND OF SVG.......................................................................................................... 6 3 SVG TINY IN BRIEF ................................................................................................................... 6 3.1 MODULARIZATION .................................................................................................................. 8 3.2 ELEMENT AND ATTRIBUTE COLLECTIONS................................................................................. 8 3.3 PROFILING THE SVG SPECIFICATION ........................................................................................ 8 3.4 DEFINING AN SVG TINY 1.2 DOCUMENT .................................................................................. 8 4 PROBLEM DEFINITION ............................................................................................................ 9 4.1 SVG TINY IMAGE CREATION IN IMAGING SERVER ................................................................... 9 4.2 SVG IMAGE DRAWING IN NON-SVG MOBILE DEVICES ............................................................ 9 5 PROPOSED SOLUTION: SVGTSLIB & SVGTMLIB ............................................................... 9 5.1 SVG TINY SERVER LIBRARY: SVGTSLIB.............................................................................. 11 5.1.1 SVGT IMAGE STRUCTURES ................................................................................................... 12 5.1.2 APIS FOR BASIC GRAPHICAL SHAPES ...................................................................................... 13 5.1.3 TEXT APIS............................................................................................................................ 14 5.2 SVG TINY MOBILE RENDERING LIBRARY: SVGTMLIB.......................................................... 14 5.2.1 SVGT IMAGE STRUCTURES ................................................................................................... 15 5.2.2 APIS FOR BASIC GRAPHICAL SHAPES ...................................................................................... 17 5.2.3 TEXT APIS............................................................................................................................ 18 6 LIMITATIONS & SCOPE OF FURTHER IMPROVEMENTS ............................................... 18 7 CONCLUSION............................................................................................................................ 18 8 REFERENCES............................................................................................................................ 18 8.1 BASE REFERENCES:............................................................................................................... 18 8.2 REFERENCE FORUMS AND DISCUSSIONS................................................................................. 19 8.3 DEFINITIONS AND JARGONS ................................................................................................... 19 SVGTLib - April 2008 2 1st Winner of GlobalLogic White Paper Contest 2008 – Shivendra Tiwari, Lead Engineering 1 Abstract Imaging is an indispensable feature of any LBS engine. A quality image generation is a mandatory part of an imaging server whereas seamless zooming is an imperative requirement of a client application. Images can be described in two types i.e. Raster Graphics and Vector Graphics. Raster imaging has its own limitations and in other hand Vector graphics gives solutions of the Raster imaging problems. The imaging software and libraries have two aspects - Creating and Rendering. In case of SVGT the challenges are in both of the aspects. There is no perfect SVGT image creation library available in the market and most of the mobile devices don’t support SVG image rendering on the other hand. Only the latest devices have SVG support. The sole idea is to develop an effective SVGT image library which is reusable and highly capable of creating quality images in an LBS imaging server. The server technology can be C/C++ and Java/J2EE etc. To solve the image rendering issues on the non-SVG mobile devices, highly reusable vector graphics renderer can be developed on various platforms i.e. J2ME, Symbian C++ and Windows Mobile etc. The underlying content in this paper is not just a tutorial so that one can read and benefit from it; however this is an idea which can be made a complete project and implemented. Once the library has been implemented, it can be reused in the existing projects and can be shown as a technical competency to the prospective customers. This paper talks about SVG Tiny in terms of its strengths, applications, SVG library prototype and limitations. Section 1 through 3 can be skipped if the reader is pretty familiar with SVG and SVGT; however sections 4 and 5 are the essential part of this write-up. For further knowledge and study one can refer to the reference section appended at the end which includes various PDF tutorials and websites. Keywords: SVG (Scalable Vector Graphics), SVG Tiny, W3C, 2D&3D Graphics, LBS (Location Based Services), and Imaging Server etc. SVGTLib 3 1st Winner of GlobalLogic White Paper Contest 2008 – Shivendra Tiwari, Lead Engineering 2 Introduction Scalable Vector Graphics (SVG) is W3C's non-proprietary alternative to flash and bitmapped graphics. It is a language for describing two-dimensional graphics and graphical applications in XML. SVG enables 2-D resolution and media-independent graphics in a text-based format. This permits integration with XHTML, XSL and XSLT, XLink, SMIL, DOM and other W3 specifications including complete support for CSS, scripting, and animation. There are three object types in Vector Graphics i.e. Vector Graphic Shapes (paths consisting of straight lines and curves), Text, and Images. SVG Tiny 1.2 is the specification currently being developed as the core of the SVG 1.2 language. The SVG Mobile Profiles: SVG Basic and SVG Tiny are targeted to resource-limited devices and are part of the 3GPP platform for third generation mobile phones. SVG images can be generated on the fly from databases and applications. Text in SVG is fully searchable and selectable, as well as accessible. It can be integrates well with server-side technology (C/C++, Servlets, JSP, ASP, PHP, Perl, .NET etc.). Vector graphics objects can be grouped, styled, transformed, and reused. The major features of the SVG include clipping the paths, alpha masking, filter effects, template objects, and extensibility of the images. There are various vendors who support SVG and have implemented image creation/rendering libraries i.e. Adobe, BitFlash, Canon, Corel, CSIRO, Ericsson, Hewlett Packard, ILOG, KDDI, Nokia, Openwave, Schema Software, Sharp, Sun Microsystems, Texas Instruments, and Zoomon etc. 2.1 General advantages of the vector graphics include: 1. Smaller files so faster download times compared to bitmapped graphics (in certain cases) 2. Resolution and device independence 3. Suited for devices with low bandwidth and limited memory 4. Better printing capabilities 5. Permits panning around images 6. Enables zooming in on details not visible when image is initially displayed 7. Grouping, layers, hierarchies, reuse of components 8. Need not come from a static file; can be generated from a database 9. Leverage existing vector graphics investment 10. Various XML inherited capabilities: a. XML like validation (DTDs, XML Schema) is possible in SVG. b. XML parsers can be used for parsing, manipulating and making the data ready to render. c. It is compatible with XHTML and hence it can be well integrated into the Web pages d. Scriptable events based on the DOM (hierarchical model) are supported e. Text labels and desc (descriptions) are directly searchable (can be indexed by search engines) f. Each graphic element may contain a title g. Linking from any part of an image based on XLink and a element. h. It can reference JPEG or PNG bitmapped graphics via image i. It supports complex animations and transformations j. SMIL (Synchronized Multimedia Integration Language): conditionals, timing, animation are supported. SVGTLib 4 1st Winner of GlobalLogic White Paper Contest 2008 – Shivendra Tiwari, Lead Engineering k. CSS style information can be used to alter rendering l. Not limited to fonts available on the target device. Example SVG image: In the given example these images have been generated from a single SVG image file by just zooming in and zooming out. Figure - The SVG supports zooming without data loss 2.2 SVG Converter Applications There are a number of SVG applications available