【问题标题】:Kivy canvas - fast drawing - polylinesKivy 画布 - 快速绘图 - 折线
【发布时间】:2016-09-05 09:28:25
【问题描述】:

请告诉我,如果在 Kivy Canvas 快速绘图,我会变得非常敏锐, 折线图,但如果画得很慢,那么我会得到平滑的线条。

    ...

    def on_touch_down(self, touch):
        if Widget.on_touch_down(self, touch):
            return True
        print(touch.x, touch.y)
        with self.canvas.before:
            Color(*get_color_from_hex('#0080FF80'))
            Line(circle=(touch.x, touch.y, 2), width=2)
            touch.ud['current_line'] = Line(points=(touch.x, touch.y), width=2)

    def on_touch_move(self, touch):                               
        if 'current_line' in touch.ud:
            touch.ud['current_line'].points += (touch.x, touch.y)
    ...

这是我的例子:

谁知道我该如何解决? 我可以在 Kivy 中快速流畅地绘制吗?

【问题讨论】:

    标签: android python canvas drawing kivy


    【解决方案1】:

    我不知道为什么你在 kivy 中快速绘制时线条看起来不流畅,请你在不同的设备上测试一下。

    【讨论】:

    • 当然我在很多不同的设备上测试过,也许我有点夸大其词,但实际图片并没有更好 - another pic link
    【解决方案2】:

    实际上,我测试了您的代码,但无法产生您遇到的问题。我的意思是,我在 Kivy 中画得快还是慢都没有关系。这些'e的一半我画得快一半慢,但输出没有区别。我建议你试试https://kivy.org/docs/tutorials/firstwidget.html。如果此示例的绘图输出在快速绘图时很尖锐,那么您的环境可能有问题,因为它在我的环境中运行良好。 el如果它在快速绘图中很流畅,那么你手头的项目肯定有问题。

    【讨论】:

    • 在PC上一切都很好,但让我们尝试在Android平台上测试它。您可以在我的应用程序中查看 - SpringPaint
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-19
    • 1970-01-01
    • 1970-01-01
    • 2017-08-10
    • 1970-01-01
    • 2013-01-07
    • 2020-04-20
    相关资源
    最近更新 更多