Using LEADTOOLS CDLL Functions in Android

Android NDK for C/C++

After a successful and productive exhibit at AnDevCon, we have had a rewarding time talking to our many customers using the LEADTOOLS Android SDK. It is growing rapidly in popularity, and developers are putting it to use in many exciting ways. Fairly soon, LEADTOOLS should literally be in the palms of millions of hands around the world.

While the LEADTOOLS Android Java class library provides powerful imaging technology, some customers require native only apps or are simply more skilled and comfortable with C/C++ development. Recently, we have had several customers ask if it was possible to use LEADTOOLS C/C++ to create native Android apps (using the Android NDK) instead of using the Java class library. Never backing down from a challenge, our Developer Support agents created a sample project that shows off this functionality. Here’s a snippet of the C++ code that exposes L_IntensityDetectBitmap through JNI:


JavaVM* g_vm;
extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
{
   g_vm = vm;
   return JNI_VERSION_1_2;
}

/******************************************************************************/
/* Exported Functions                                                         */
/******************************************************************************/

/******************************************************************************/
/* L_IntensityDetectBitmap                                                    */
/******************************************************************************/
extern "C" JNIEXPORT int JNICALL Java_cpp_leadtools_sample_ltimageclr_IntensityDetectBitmap(
   JNIEnv * env, jobject obj, int bitmap, int uLow, int uHigh, int crInColor, int crOutColor, int uChannel, int uFlags)
{
   return L_IntensityDetectBitmap((pBITMAPHANDLE)bitmap, uLow, uHigh, (COLORREF)crInColor, (COLORREF)crOutColor, uChannel, uFlags);
}

To download the full example, check out the original forum post.

All of our technical support agents are well trained programmers and love the opportunity to create new and challenging sample projects, so keep your requests and ideas coming. LEADTOOLS is the most robust and time-tested imaging SDK in the world and we will do everything possible to help you make it work with whatever ideas you come up with!

This entry was posted in General Imaging and tagged , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *