首页 > 解决方案 > Pythin kivy如何关闭纹理抗锯齿

问题描述

我有一个平均大小为 120 x 80 的纹理,每帧都会发生变化。它是从一个数字数组中创建的

    def draw(self, t):
        self.buf = t
        self.texture_array = array('B', self.buf)
        self.size = Window.size
        self.padding_x = Window.size[0] * 0.25
        self.padding_y = Window.size[1] * 0.25
        self.pix_size_x = Window.size[0] * 0.75
        self.pix_size_y = Window.size[1] * 0.75
        self.tex.blit_buffer(self.texture_array, colorfmt='rgb', bufferfmt='ubyte')
        with self.canvas:
            Rectangle(texture = self.tex, pos = (self.padding_x, self.padding_y), size = (self.pix_size_x, self.pix_size_y))

它应该看起来像像素艺术,但纹理平滑破坏了整个画面。是否可以以某种方式禁用抗锯齿或以其他方式渲染数组?

标签: pythonkivyrenderingtexturesantialiasing

解决方案


纹理具有mag_filtermin_filter属性,将它们都设置为"nearest"


推荐阅读