本文整理汇总了C++中GLFrame::WriteData方法的典型用法代码示例。如果您正苦于以下问题:C++ GLFrame::WriteData方法的具体用法?C++ GLFrame::WriteData怎么用?C++ GLFrame::WriteData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLFrame
的用法示例。
在下文中一共展示了GLFrame::WriteData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Java_android_filterfw_core_GLFrame_setNativeBitmap
jboolean Java_android_filterfw_core_GLFrame_setNativeBitmap(JNIEnv* env,
jobject thiz,
jobject bitmap,
jint size) {
GLFrame* frame = ConvertFromJava<GLFrame>(env, thiz);
if (frame && bitmap) {
uint8_t* pixels;
const int result = AndroidBitmap_lockPixels(env, bitmap, reinterpret_cast<void**>(&pixels));
if (result == ANDROID_BITMAP_RESUT_SUCCESS) {
const bool success = frame->WriteData(pixels, size);
return ToJBool(success &&
AndroidBitmap_unlockPixels(env, bitmap) == ANDROID_BITMAP_RESUT_SUCCESS);
}
}
return JNI_FALSE;
}
示例2: Java_android_filterfw_core_GLFrame_setNativeInts
jboolean Java_android_filterfw_core_GLFrame_setNativeInts(JNIEnv* env,
jobject thiz,
jintArray ints) {
GLFrame* frame = ConvertFromJava<GLFrame>(env, thiz);
if (frame && ints) {
jint* int_ptr = env->GetIntArrayElements(ints, NULL);
const int length = env->GetArrayLength(ints);
if (int_ptr) {
const bool success = frame->WriteData(reinterpret_cast<const uint8_t*>(int_ptr),
length * sizeof(jint));
env->ReleaseIntArrayElements(ints, int_ptr, JNI_ABORT);
return ToJBool(success);
}
}
return JNI_FALSE;
}
示例3: Java_android_filterfw_core_GLFrame_setNativeData
jboolean Java_android_filterfw_core_GLFrame_setNativeData(JNIEnv* env,
jobject thiz,
jbyteArray data,
jint offset,
jint length) {
GLFrame* frame = ConvertFromJava<GLFrame>(env, thiz);
if (frame && data) {
jbyte* bytes = env->GetByteArrayElements(data, NULL);
if (bytes) {
const bool success = frame->WriteData(reinterpret_cast<const uint8_t*>(bytes + offset), length);
env->ReleaseByteArrayElements(data, bytes, JNI_ABORT);
return ToJBool(success);
}
}
return JNI_FALSE;
}
示例4: Java_android_filterfw_core_GLFrame_setNativeFloats
jboolean Java_android_filterfw_core_GLFrame_setNativeFloats(JNIEnv* env,
jobject thiz,
jfloatArray floats) {
GLFrame* frame = ConvertFromJava<GLFrame>(env, thiz);
if (frame && floats) {
jfloat* float_ptr = env->GetFloatArrayElements(floats, NULL);
const int length = env->GetArrayLength(floats);
if (float_ptr) {
// Convert floats to RGBA buffer
uint8_t* rgba_buffer = new uint8_t[length];
ConvertFloatsToRGBA(float_ptr, length, rgba_buffer);
env->ReleaseFloatArrayElements(floats, float_ptr, JNI_ABORT);
// Write RGBA buffer to frame
const bool success = frame->WriteData(rgba_buffer, length);
// Clean-up
delete[] rgba_buffer;
return ToJBool(success);
}
}
return JNI_FALSE;
}