python - 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))
它应该看起来像像素艺术,但纹理平滑破坏了整个画面。是否可以以某种方式禁用抗锯齿或以其他方式渲染数组?
解决方案
纹理具有mag_filter
和min_filter
属性,将它们都设置为"nearest"
。
推荐阅读
- mysql - 如何在 MySQL 中使用 avg() 函数求前 3 行的平均值
- python - Scipy-optimize.root_scalar 不一致地给出 f(a) 和 f(b) 必须有不同的符号
- python - 使用 Flask-Sqlalchemy 使用过滤器进行分页
- android - 颤振:无法构建android apk
- ember.js - FullCalendar Ember 支持
- c# - 如何通过将两个或多个字段与 mongoDb c# 驱动程序组合的某些表达式进行过滤/排序
- javascript - 如何在谷歌网站中使用具有多个页面的谷歌脚本网络应用程序?
- c++ - 如何将类成员注册为队列的回调函数?
- javascript - Jquery函数:获取img宽度和高度然后addClass不起作用
- java - java.lang.SecurityException:用户 11029 和当前进程都没有 android.permission.SET_TIME_ZONE