[英]Renderscript transparency / alpha
I'm using ICS and trying to show a transparent Renderscript layer over a regular view. 我正在使用ICS,并试图在常规视图上显示透明的Renderscript层。 I would like to use RS to draw text on the app.
我想使用RS在应用程序上绘制文本。
I'm using the setAlpha(8, 8); 我正在使用setAlpha(8,8); and I can see that the layer generated it's BGRA (dumpsys SurfaceFlinger).
我可以看到生成该层的是BGRA(dumpsys SurfaceFlinger)。
My RS script is simply doing this: 我的RS脚本只是这样做:
rsgClearColor(0.0f, 0.0f, 0.0f, 0.0f);
rsgDrawText("Hello!", 50,50);
I would like to be able to show this Renderscript layer drawing text, over my regular view. 我希望能够在我的常规视图上显示此Renderscript层的绘图文本。
My main activity uses setContentView two times, one for my main view, and second one for the RS. 我的主要活动使用setContentView两次,一次用于主视图,第二次用于RS。 Even if this approach might be wrong, I should at least be able to see the background of the app, while I only see black and the "Hello!"
即使这种方法可能是错误的,我也至少应该能够看到应用程序的背景,而我只会看到黑色和“ Hello!”。 text in white covering everything.
白色覆盖所有内容。 I also tried using two different activities, but I've never been able to make the RenderScript layer transparent.
我也尝试使用两种不同的活动,但是我从未能够使RenderScript层透明。
Any ideas? 有任何想法吗?
You also need to set the PixelFormat and ZOrder of your Renderscript view. 您还需要设置Renderscript视图的PixelFormat和ZOrder。 Try adding this when you create your Renderscript view:
创建Renderscript视图时,尝试添加以下内容:
view.getHolder().setFormat(PixelFormat.TRANSLUCENT);
view.setZOrderOnTop(true);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.