gpt4 book ai didi

android - Air StageWebView Leaflet map 图像在 Android 上呈锯齿状

转载 作者:可可西里 更新时间:2023-11-01 04:56:48 26 4
gpt4 key购买 nike

我想使用 StageWebView 类将 Leaflet Map 合并到 ios 和 android air 移动应用程序中。不幸的是, map 图像的质量参差不齐,很难辨认出街道名称。似乎有一些小的缩放正在进行。出于测试目的,我在 http://leafletjs.com/examples/quick-start-example.html 使用了 Leaflet 教程 mal

在 Android 浏览器 ( chrome ) 中查看时,图像看起来不错。下面是一些简单的代码来说明问题:

package  {
import flash.display.MovieClip;
import flash.display.StageScaleMode;
import flash.display.StageAlign;
import flash.media.StageWebView;
import flash.geom.Rectangle;
import flash.desktop.NativeApplication;
import flash.utils.setTimeout;
public class Main extends MovieClip{

private var _stageWebView:StageWebView
public function Main()
{

stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
setTimeout( init, 100 );

}
private function init():void {
_stageWebView = new StageWebView();
_stageWebView.stage = this.stage;
_stageWebView.viewPort = new Rectangle( 0, 0, stage.stageHeight, stage.stageWidth );
_stageWebView.loadURL( "http://leafletjs.com/examples/quick-start-example.html" );
}
}

有什么想法吗?可能与分辨率问题有关吗?

谢谢

最佳答案

您遇到的问题是渲染问题,可以通过启用 hardware acceleration 来避免。 (强制 GPU 渲染)当然是在支持的情况下。

Beginning in Android 3.0 (API level 11), the Android 2D rendering pipeline supports hardware acceleration, meaning that all drawing operations that are performed on a View's canvas use the GPU.

所以要强制 GPU 渲染,你可以:

1 - Enable hardware acceleration in your application's manifest file , 你应该在哪里设置 android:hardwareAccelerated应用程序元素的属性为真:

<android>
<manifestAdditions>
<![CDATA[
<manifest>
<application android:hardwareAccelerated="true"/>
</manifest>
]]>
</manifestAdditions>
</android>

这是完整 list 文件的示例(我的测试 browser-app.xml):

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<application xmlns="http://ns.adobe.com/air/application/19.0">
<id>browser</id>
<versionNumber>1.0.0</versionNumber>
<versionLabel/>
<filename>browser</filename>
<description/>
<name>browser</name>
<copyright/>
<initialWindow>
<content>browser.swf</content>
<systemChrome>standard</systemChrome>
<transparent>false</transparent>
<visible>true</visible>
<fullScreen>false</fullScreen>
<renderMode>auto</renderMode>
<autoOrients>true</autoOrients>
</initialWindow>
<icon/>
<customUpdateUI>false</customUpdateUI>
<allowBrowserInvocation>false</allowBrowserInvocation>
<android>
<manifestAdditions>
<![CDATA[
<manifest>
<uses-permission android:name="android.permission.INTERNET"/>
<application android:hardwareAccelerated="true"/>
</manifest>
]]>
</manifestAdditions>
</android>
</application>

然后您只需发布您的 AIR 应用程序,您将获得如下内容:

当我评论<application android:hardwareAccelerated="true"/>时你可以看到结果:

2 - 您还可以通过 Android 设备的开发人员选项强制进行 GPU 渲染:

即使在 <application android:hardwareAccelerated="true"/> 时,您也可以获得相同的结果。评论:

enter image description here

就是这样!

希望对您有所帮助。

关于android - Air StageWebView Leaflet map 图像在 Android 上呈锯齿状,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32140500/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com