以下是我的代码,你能告诉我如何将文本的背景设置为透明,我的意思是删除文本的背景?
正在运行的结果:
if(lastDrawSecond!= second) {
lastDrawSecond = second;
if (textureId != 0){
gl.glDeleteTextures(1, textures, 0);
}
gl.glGenTextures(1, textures, 0);
textureId = textures[0];
gl.glBindTexture(GL10.GL_TEXTURE_2D, textureId);
//ビットマップ作成
Bitmap bitmap = Bitmap.createBitmap(bmpWidth, bmpHeight, Bitmap.Config.ARGB_8888);
bitmap.eraseColor(Color.TRANSPARENT);
Canvas canvas = new Canvas(bitmap);
//文字の描画
text.delete(0, text.length());
text.append("ただ今 " + calendar.getTime().toLocaleString());
paint.setColor(TEXT_COLOR);
canvas.drawText(text.toString(), 10, 100, paint);
//canvas.drawText(text.toString(), 100, 10, paint);
//System.out.println("draw:"+drawX);
GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);
bitmap.recycle();
}