Mobile J2me中SVG图形的自动缩放

Mobile J2me中SVG图形的自动缩放,mobile,java-me,svg,Mobile,Java Me,Svg,我正在使用SVG图形开发我的第一个应用程序,如何自动缩放SVG背景图像以匹配设备屏幕的宽度和高度?这是可能的还是应该为不同的显示分辨率设置多个文件?我不确定J2ME的具体情况,但这通常是通过在根SVG元素上设置viewBox属性,并将宽度和高度设置为100%来实现的。有关示例,请参见此处: <?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://ww

我正在使用SVG图形开发我的第一个应用程序,如何自动缩放SVG背景图像以匹配设备屏幕的宽度和高度?这是可能的还是应该为不同的显示分辨率设置多个文件?我不确定J2ME的具体情况,但这通常是通过在根SVG元素上设置viewBox属性,并将宽度和高度设置为100%来实现的。有关示例,请参见此处:

<?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 the viewBox
        attribute to automatically create an initial user coordinate
        system which causes the graphic to scale to fit into the
        viewport no matter what size the viewport is.</desc>
        <!-- This rectangle goes from (0,0) to (1500,1000) in user space.
        Because of the viewBox attribute above,
        the rectangle will end up filling the entire area
        reserved for the SVG content. -->
        <rect x="0" y="0" width="1500" height="1000"
        fill="yellow" stroke="blue" stroke-width="12"  />
        <!-- A large, red triangle -->
        <path fill="red"  d="M 750,100 L 250,900 L 1250,900 z"/>
        <!-- A text string that spans most of the viewport -->
        <text x="100" y="600" font-size="200" font-family="Verdana" >
        Stretch to fit
        </text>
</svg>

示例ViewBox-使用ViewBox
属性自动创建初始用户坐标
使图形缩放以适合图形的系统
视口,无论视口大小如何。
舒展
现场演示:

有关保留图像纵横比的信息,请参见此处的说明: