我有一个逐帧的AnimationDrawable
缩放,我想在没有 Android 默认的模糊插值的情况下进行缩放。(这是像素艺术,最近邻看起来更好。)我可以设置一个标志吗?覆盖onDraw
?有什么可以告诉 GPU 不要使用纹理过滤吗?
我是否需要放大动画中的每个单独的位图?这似乎是对 CPU 和纹理内存的浪费。
代码示例:
// Use a view background to display the animation.
View animatedView = new View(this);
animatedView.setBackgroundResource(R.anim.pixel_animation);
AnimationDrawable animation = (AnimationDrawable)animatedView.getBackground();
animation.start();
// Use LayoutParams to scale the animation 4x.
final int SCALE_FACTOR = 4;
int width = animation.getIntrinsicWidth() * SCALE_FACTOR;
int height = animation.getIntrinsicHeight() * SCALE_FACTOR;
container.addView(animatedView, width, height);