Android NDK 和渲染到动态壁纸
我只是在寻找开始学习 NDK 的机会,心里有一个特定的项目:
我想不断地从 NDK 端渲染一张不断变化的位图,以便能够在动态壁纸中显示它。
(因此我在这里不是讨论渲染到 OpenGL 纹理,而是渲染到位图)
我用 google 搜索了一下,发现有一个选项可以直接操作位图像素。但我还发现文档说这个功能仅从 Android 2.2 开始可用。 我想在我的动态壁纸中支持 2.1。
另一方面,我发现了几个做类似事情的项目——从 ndk 渲染一些东西并在动态壁纸中显示它。他们正在开发 2.1。例子是:精彩的视频动态壁纸,我认为Shake Them All Live Wall 也能做同样的事情。
所以问题是 - 除了直接操作位图数据之外,我是否还缺少其他一些对 LW 进行连续渲染的方法? 还是我做错了什么? :)
I'm just looking around for starting learning NDK, with one particular project in mind:
I want to continually render a changing bitmap from NDK side to be able to show it in a live wallpaper.
(hence I'm not talking about rendering to OpenGL texture here, but about rendering to a Bitmap)
I googled a bit and found out that there's an option to directly manipulate a Bitmap pixels. But I also found that documentation says that this feature is avaiable only since Android 2.2.
And I'd like to support 2.1 in my live wallpaper.
On the other hand I found several projects that do similar stuff - render something from ndk and show it in live wallpaper. And they work on 2.1. Examples are: wonderful Video Live Wallpaper, and I think Shake Them All Live Wallpaper does the same kind of stuff.
So the question is - am I missing some other way to do continuous rendering to LW other than direct manipulation of Bitmap data?
Or some other thing I got wrong? :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知,使用 NDK 进行渲染并使用 2.2 之前的 jnigraphics 的其他项目实际上在项目中包含该库并将其作为第 3 方库加载。
有关如何执行此操作的更多信息,请参阅
android-ndk-r5b/docs/ANDROID-MK.html
中的PREBUILT_SHARED_LIBRARY
说明。你可以在以下位置找到 jnigraphics:
当然,我不知道是否真的允许重新分发 NDK 的一部分(也许其他人可以对此进行权衡),但显然是使用 jnigraphics 的唯一阻碍Android 2.2 之前的版本只是因为它不存在于早期版本中。
希望有帮助。
As far as I know, the other projects that do rendering with the NDK and use
jnigraphics
prior to 2.2 actually include that library in the project and load it as a 3-rd party library.See the description of
PREBUILT_SHARED_LIBRARY
inandroid-ndk-r5b/docs/ANDROID-MK.html
for more information on how to do that.You can find jnigraphics in:
Of course, I don't know if it's actually permissible to redistribute part of the NDK (maybe someone else can weigh in on this), but apparently the only holdup with using
jnigraphics
prior to Android 2.2 is simply the fact that it's not present in earlier releases.Hope that helps.