【发布时间】:2011-04-22 13:45:58
【问题描述】:
我正在制作一个 android 2d 游戏,但遇到了问题。我在paint.net 中制作了一个透明的.bmp 文件并将其导出到eclipse。十字野兔的中心应该是透明的,这样你才能看到你的角色要去哪里。除非我错误地导出它,否则我无法让我的游戏在正确的区域中具有一定的透明度。
这是我添加的代码
...
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
...
BitmapFactory.Options options = new BitmapFactory.Options();
options.inPreferredConfig = Bitmap.Config.ALPHA_8;
Resources res = context.getResources();
crosshair = BitmapFactory.decodeResource(res, R.drawable.crosshare,options);
....
c.drawBitmap(crosshair, x, y, paint);
c 是画布,前 5 行代码在我的交叉共享类的构造函数中。
谢谢
【问题讨论】:
标签: android bitmap transparency