颤振/飞镖和抗锯齿

问题描述

我目前正在Flutter中编写一个室内导航应用程序,而在Flutter和Dart中还很新。为此,我使用并希望基于Android的mapsforge扩展库mapsforge_Flutter。使用mapsforge_Flutter,我可以下载OpenStreetMap地图,然后在手机上渲染这些地图。问题在于,地图上的线条看起来像这样像素化:

enter image description here

AntiAliasing尚未在mapsforge_Flutter中实现,因此我认为问题可能出在这里。在原始的mapsforge库中,地图看起来没有像素化。

AA是通过以下方式在原始库中实现的:

# Build the program,which needs a full C toolchain.
FROM ubuntu:18.04 AS builder
RUN apt-get update \
 && DEBIAN_FRONTEND=noninteractive \
    apt-get install --no-install-recommends --assume-yes \
      build-essential
workdir /app
copY hello.c .
RUN gcc -static -o hello hello.c

# Then create an image that _only_ contains the static binary.
FROM scratch
copY --from=builder /app/hello /hello
ENTRYPOINT ["/hello"]

在mapsforge_Flutter中有两个类:Mapcanvas和Fluttercanvas具有以下方法,必须实现:

// in Parameters.java: 

     //If true will use anti-aliasing in rendering.
     public static boolean ANTI_ALIASING = true;

// in AndroidPaint.java:

     AndroidPaint() {
        paint = new android.graphics.Paint();
        this.paint.setAntiAlias(Parameters.ANTI_ALIASING);
        this.paint.setstrokeCap(getAndroidCap(Cap.ROUND));
        this.paint.setstrokeJoin(android.graphics.Paint.Join.ROUND);
        this.paint.setStyle(getAndroidStyle(Style.FILL));
     }

// in AwtCanvas.java:

     AwtCanvas(Graphics2D graphics2D) {
        this.graphics2D = graphics2D;
        setAntiAlias(Parameters.ANTI_ALIASING);
        createFilters();
     }

     public void setBitmap(Bitmap bitmap) {
        if (bitmap == null) {
           this.bufferedImage = null;
           this.graphics2D = null;
        } else {
           this.bufferedImage = AwtGraphicFactory.getBitmap(bitmap);
           this.graphics2D = this.bufferedImage.createGraphics();
           setAntiAlias(Parameters.ANTI_ALIASING);
           this.graphics2D.setRenderingHint(RenderingHints.KEY_RENDERING,RenderingHints.VALUE_RENDER_QUALITY);
           this.graphics2D.setRenderingHint(RenderingHints.KEY_stroke_CONTROL,RenderingHints.VALUE_stroke_PURE);
       }
     }

有人知道吗,如何在Flutter / Dart中实现呢?文档(https://api.flutter.dev/flutter/dart-ui/Paint/isAntiAlias.html)中的方法似乎不适用于我。

谢谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...