Android中绘图半透明drawable,但是黑边
我有下面的图像(图像中的白色气泡)可以在画布上绘制。当我使用代码绘制图像时......,图像的边缘变得黑色圆圈和圆形......边缘的alpha是0x00。
image.setBounds(左、上、右、下);
图像.draw(画布);
预期 当我绘制
我怎样才能去掉黑圈???是不是图错了??或者有人知道线索,请给我线索..提前致谢..
^^
I have the below image (the white bubble in the image) to draw in a canvas. When I draw the image using the code.., the image 's edge is getting black circle and rounded .. the edge's alpha is 0x00.
image.setBounds(left, top, right, bottom);
image.draw(canvas);
Expected When I draw
How could I remove the black circle??? Is the image wrong?? or Anyone know the clue, Please give me a clue.. Thanks in advance..
^^
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的预期输出是从图像编辑器(Photoshop)获取的吗?如果是,这将是 32 位混合的结果,而 Android 上的 alpha 混合看起来是以 16 位执行的,因此会出现条带在背景中,以及图像周围的光环。
假设您使用的是
Bitmap
对象,您可以通过调用bitmap.getConfig()
来查找其颜色深度(从Bitmap.配置枚举)。
编辑:还有一件事可能会导致光晕 - 你说精灵的边缘的 alpha 为 0,但是 RGB 值又如何呢?确保 ARGB 设置为全白 (ARGB 0x00ffffff) 而不是黑色 (ARGB 0x00000000)。
Is your expected output taken from an image editor (Photoshop?) If so, that'll be the result of a 32-bit blend, whereas it looks like the alpha-blend on Android is being performed in 16-bits, hence the banding in the background, and halo around your image.
Presuming you're using
Bitmap
objects, you can check whether this is the case by callingbitmap.getConfig()
to find their colour depth (from theBitmap.Config
enum).Edit: One more thing that may be causing the halo - you say the edges of your sprite have an alpha of 0, but what about the RGB values? Make sure the ARGB is set to full-white (ARGB 0x00ffffff) rather than black (ARGB 0x00000000).