MCPcopy Create free account
hub / github.com/defold/defold / Java_TexcLibraryJni_CreateImage

Function Java_TexcLibraryJni_CreateImage

engine/texc/src/texclibrary_jni.cpp:26–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24#include <texc.h>
25
26JNIEXPORT jlong JNICALL Java_TexcLibraryJni_CreateImage(JNIEnv* env, jclass cls, jstring _path, jint width, jint height, jint pixelFormat, jint colorSpace, jbyteArray array)
27{
28 dmLogDebug("%s: env = %p\n", __FUNCTION__, env);
29 //DM_SCOPED_SIGNAL_CONTEXT(env, return 0;);
30
31 if (!array)
32 {
33 dmLogError("%s: Image data array was null!", __FUNCTION__);
34 return 0;
35 }
36
37 jlong obj = 0;
38 DM_JNI_GUARD_SCOPE_BEGIN();
39 dmTexc::jni::ScopedContext jni_scope(env);
40 //dmTexc::jni::TypeInfos* types = &jni_scope.m_TypeInfos;
41
42 dmJNI::ScopedString j_path(env, _path);
43 const char* path = strdup(j_path.m_String ? j_path.m_String : "null");
44
45 dmJNI::ScopedByteArrayCritical j_array(env, array);
46
47 dmTexc::Image* image = dmTexc::CreateImage(path, width, height, (dmTexc::PixelFormat)pixelFormat, (dmTexc::ColorSpace)colorSpace, j_array.m_ArraySize, (uint8_t*)j_array.m_Array);
48 obj = (jlong)image;
49
50 DM_JNI_GUARD_SCOPE_END(return 0;);
51 return obj;
52}
53
54JNIEXPORT jint JNICALL Java_TexcLibraryJni_CreatePreviewImage(JNIEnv* env, jclass cls, jint width, jint height, jbyteArray inputArray, jbyteArray outputArray)
55{

Callers

nothing calls this directly

Calls 1

CreateImageFunction · 0.70

Tested by

no test coverage detected