问题描述
我有一个透明的PNG文件,我使用如OpenGL纹理。我在位图
与 BitmapFactory.de codeResource
加载它,然后把它上传到GPU。
I have a PNG file with transparency that I'm using as OpenGL texture. I load it in Bitmap
with BitmapFactory.decodeResource
, then upload it to GPU.
的PNG文件是相当大的,为了减少APK的大小,我试图用两个JPG文件,而不是 - 之一,RGB数据,和其他与alpha通道(灰度)
The PNG file is quite big and in order to cut down on APK size, I'm trying to use two JPGs instead--one with RGB data, and the other with alpha channel (grayscale).
如何将二者结合起来JPG文件放在一个位图
的alpha通道对象?我尝试加载Alpha通道 Bitmap.Config.ALPHA_8
,然后把他们拉对方使用画布
,但至今没有运气。
How do I combine the two JPGs together in one Bitmap
object with alpha channel? I tried loading alpha channel as Bitmap.Config.ALPHA_8
, then drawing them on top of each other using Canvas
but no luck so far.
推荐答案
看一看的以此相关的问题。他解释如何将4个独立的图像(R,G,B和A通道),但你应该能够适应它有两个图像的工作。
Have a look at Kevin Dion's answer to this related question. He explains how to combine 4 separate images (R, G, B and A channels) but you should be able to adapt it to work with two images.
这篇关于如何两个不透明的位图组合成一个alpha通道?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!