Example #1
0
    SWIGEXPORT jint JNICALL Java_org_scilab_modules_graphic_1objects_DataLoaderJNI_fillTextureData(JNIEnv *jenv, jclass jcls, jstring jarg1, jobject jarg2, jint jarg3)
    {
        jint jresult = 0 ;
        char *arg1 = (char *) 0 ;
        unsigned char *arg2 = (unsigned char *) 0 ;
        int arg3 ;
        int result;

        (void)jenv;
        (void)jcls;
        arg1 = 0;
        if (jarg1)
        {
            arg1 = (char *)(*jenv)->GetStringUTFChars(jenv, jarg1, 0);
            if (!arg1)
            {
                return 0;
            }
        }
        {
            arg2 = (*jenv)->GetDirectBufferAddress(jenv, jarg2);
            if (arg2 == NULL)
            {
                SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "Unable to get address of direct buffer. Buffer must be allocated direct.");
            }
        }
        arg3 = (int)jarg3;
        result = (int)fillTextureData(arg1, arg2, arg3);
        jresult = (jint)result;
        if (arg1)
        {
            (*jenv)->ReleaseStringUTFChars(jenv, jarg1, (const char *)arg1);
        }
        return jresult;
    }
Example #2
0
int MatPlotDecomposer::getTextureData(char * id, void ** address, unsigned int * size)
{
    int type = getTextureImageType(id);
    if (type == MATPLOT_INDEX)
    {
        // Indexed colors
        const int h = getTextureHeight(id);
        const int w = getTextureWidth(id);
        const int bsize = w * h * sizeof(int);
        unsigned char * buffer = new unsigned char[bsize];
        fillTextureData(id, buffer, bsize);

        *address = buffer;
        *size = bsize;

        return 1;
    }

    getGraphicObjectProperty(id, __GO_DATA_MODEL_MATPLOT_IMAGE_DATA__, jni_double_vector, address);
    getGraphicObjectProperty(id, __GO_DATA_MODEL_MATPLOT_IMAGE_DATASIZE__, jni_int, (void **)&size);

    return 1;
}