我有一张图片。我想在表面 View 上渲染相同大小的图像。
但是在表面 View 上渲染时图像大小会发生变化。
我在 rajawali 中初始化飞机如下:
Plane back;
SimpleMaterial background = new SimpleMaterial();
back = new Plane(1,1,1,1);
back.setMaterial(background);
back.addTexture(mTextureManager.addTexture(bg)); // bg is the bitmap image
addChild(back);
我阅读了下面的链接,但我不太明白。
Relation between plane size and image dimensions
任何人都可以指定这个平面的参数应该是什么,以便图像的大小与原始图像的大小保持一致。
最佳答案
从您发布的问题链接中得到了线索。 我已经更改了 RajawaliRenderer.java 类,而不是 Camera 类型对象的 mCamera,只是将其替换为 Camera2D 类。
用法:
Bitmap texture = BitmapFactory.decodeResource(this.mContext.getResources(), ResourceId);
planeMat.addTexture(this.mTextureManager.addTexture(texture));
Plane plane = new Plane(1.0f, 1.0f, 1, 1);
plane.setRotZ(-90.0f);
//plane.setScale(2.8f);
plane.setMaterial(planeMat);
addChild(plane);
关于android - 在 rajawali android 的表面 View 上渲染与原始图像大小相同的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35916946/