当前位置:网站首页>An example of using JNI to directly access surface data
An example of using JNI to directly access surface data
2022-04-23 19:14:00 【cjzcjl】
For example, this can give Surface Fill in blue :
///* Pass in surface Examples of direct drawing , The incoming color covers the whole surface */
JNIEXPORT void JNICALL
Java_com_opengldecoder_jnibridge_JniBridge_drawToSurface(JNIEnv *env, jobject activity,
jobject surface, jint color) {
ANativeWindow_Buffer nwBuffer;
LOGI("ANativeWindow_fromSurface ");
ANativeWindow *mANativeWindow = ANativeWindow_fromSurface(env, surface);
if (mANativeWindow == NULL) {
LOGE("ANativeWindow_fromSurface error");
return;
}
LOGI("ANativeWindow_lock ");
if (0 != ANativeWindow_lock(mANativeWindow, &nwBuffer, 0)) {
LOGE("ANativeWindow_lock error");
return;
}
LOGI("ANativeWindow_lock nwBuffer->format ");
if (nwBuffer.format == WINDOW_FORMAT_RGB_565) {
int y, x;
LOGI("nwBuffer->format == WINDOW_FORMAT_RGB_565");
memset(nwBuffer.bits, color << 8, sizeof(__uint16_t) * nwBuffer.height * nwBuffer.width);
} else if (nwBuffer.format == WINDOW_FORMAT_RGBA_8888) {
LOGI("nwBuffer->format == WINDOW_FORMAT_RGBA_8888 ");
memset(nwBuffer.bits, color, sizeof(__uint32_t) * nwBuffer.height * nwBuffer.width);
}
LOGI("ANativeWindow_unlockAndPost ");
if (0 != ANativeWindow_unlockAndPost(mANativeWindow)) {
LOGE("ANativeWindow_unlockAndPost error");
return;
}
ANativeWindow_release(mANativeWindow);
LOGI("ANativeWindow_release ");
}
版权声明
本文为[cjzcjl]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210600587547.html
边栏推荐
- After opening the original normal project, the dependency package displays red and does not exist.
- JVM的类加载过程
- Tencent cloud GPU best practices - remote development training using jupyter pycharm
- Some records used by VS2010
- openlayers 5.0 加载arcgis server 切片服务
- Codeforces Round #783 (Div. 2) D题解
- Simplified path (force buckle 71)
- 剑指 Offer II 116. 省份数量-空间复杂度O(n),时间复杂度O(n)
- Redis optimization series (III) solve common problems after master-slave configuration
- SSDB Foundation
猜你喜欢
Oracle配置st_geometry
MySQL Téléchargement et installation de la version Linux
Use of fluent custom fonts and pictures
C: generic reflection
MySQL restores or rolls back data through binlog
[报告] Microsoft :Application of deep learning methods in speech enhancement
Sword finger offer II 116 Number of provinces - spatial complexity O (n), time complexity O (n)
Partage de la conception de l'alimentation électrique de commutation et illustration des compétences en conception de l'alimentation électrique
mysql通过binlog恢复或回滚数据
Why is PostgreSQL about to surpass SQL Server?
随机推荐
Some speculation about the decline of adults' language learning ability
Using Visual Studio code to develop Arduino
mysql通过binlog恢复或回滚数据
Quick start to static class variables
Recyclerview control list item layout match_ Fundamental principle of parent attribute invalidation
Class loading process of JVM
Introduction to micro build low code zero Foundation (lesson 3)
Coolweather is revised and connected to the wind weather interface to realize the broken line diagram of temperature
Xlslib use
SSDB基础2
arcgis js api dojoConfig配置
開關電源設計分享及電源設計技巧圖解
js上传文件时控制文件类型和大小
Raspberry pie 18b20 temperature
[记录]TypeError: this.getOptions is not a function
Reflection on the performance of some OpenGL operations in the past
WebView saves the last browsing location
Some records used by VS2010
All table queries and comment description queries of SQL Server
Switching power supply design sharing and power supply design skills diagram