mobile - SVG graphics auto scaling in J2me -


i developing first application using svg graphics , auto scaling of svg background image match device screen width , height ? possible or shall have multiple files different display resolutions

i'm not sure j2me specifically, typically accomplished setting viewbox attribute on root svg element, , setting width , height 100%. see here example:

<?xml version="1.0" standalone="no"?> <!doctype svg public "-//w3c//dtd svg 1.1//en" "http://www.w3.org/graphics/svg/1.1/dtd/svg11.dtd"> <svg version="1.1"         viewbox="0 0 1500 1000" preserveaspectratio="none"         xmlns="http://www.w3.org/2000/svg"         width="100%" height="100%">         <desc>example viewbox - uses viewbox         attribute automatically create initial user coordinate         system causes graphic scale fit         viewport no matter size viewport is.</desc>         <!-- rectangle goes (0,0) (1500,1000) in user space.         because of viewbox attribute above,         rectangle end filling entire area         reserved svg content. -->         <rect x="0" y="0" width="1500" height="1000"         fill="yellow" stroke="blue" stroke-width="12"  />         <!-- large, red triangle -->         <path fill="red"  d="m 750,100 l 250,900 l 1250,900 z"/>         <!-- text string spans of viewport -->         <text x="100" y="600" font-size="200" font-family="verdana" >         stretch fit         </text> </svg> 

live demo here: http://stuff.echo-flow.com/stackoverflow/viewbox.svg

for information on preserving aspect ratio of image, see specification here: http://www.w3.org/tr/svg/coords.html#preserveaspectratioattribute


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -