当前位置:网站首页>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
边栏推荐
- 坐标转换WGS-84 转 GCJ-02 和 GCJ-02转WGS-84
- Coolweather is revised and connected to the wind weather interface to realize the broken line diagram of temperature
- 【C语言进阶11——字符和字符串函数及其模拟实现(2))】
- Raspberry pie uses root operation, and the graphical interface uses its own file manager
- c1000k TCP 连接上限测试
- The platinum library cannot search the debug process records of some projection devices
- Coordinate conversion WGS-84 to gcj-02 and gcj-02 to WGS-84
- Matlab 2019 installation of deep learning toolbox model for googlenet network
- Strange problems in FrameLayout view hierarchy
- Openharmony open source developer growth plan, looking for new open source forces that change the world!
猜你喜欢

Solutions such as unknown or garbled code or certificate problem prompt in Charles's mobile phone packet capture, actual measurement.

ArcMap publishing slicing service

该买什么设备,Keysight 给你挑好了

Some records used by VS2010
![[记录]TypeError: this.getOptions is not a function](/img/c9/0d92891b6beec3d6085bd3da516f00.png)
[记录]TypeError: this.getOptions is not a function

From technical system to business insight, the closing chapter of the practice of small and medium-sized R & D team structure

mysql_linux版本的下載及安裝詳解

Network protocol: SCTP flow control transmission protocol

Raspberry pie 18b20 temperature

MySQL学习第五弹——事务及其操作特性详解
随机推荐
openlayers 5.0 当地图容器大小改变时,重新加载地图
Tencent cloud GPU best practices - remote development training using jupyter pycharm
优先使用组合而不使用继承
: app: transformclasseswithrobustfordevrease meituan hot repair compilation error record
Openlayers draw rectangle
ArcMap publishing slicing service
How about CICC wealth? Is it safe to open an account up there
An 8266 crash
Use of fluent custom fonts and pictures
openlayers draw矩形
Some records used by VS2010
One stop service platform for high-level talents and development of comprehensive service platform system for talents
Coolweather is revised and connected to the wind weather interface to realize the broken line diagram of temperature
Esp01s with Arduino development environment
Wechat video extraction and receiving file path
Openharmony open source developer growth plan, looking for new open source forces that change the world!
Regular expressions for judging positive integers
Keysight has chosen what equipment to buy for you
MySQL Téléchargement et installation de la version Linux
[today in history] April 23: the first video uploaded on YouTube; Netease cloud music officially launched; The inventor of digital audio player was born