• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ KNI_IsNullHandle函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中KNI_IsNullHandle函数的典型用法代码示例。如果您正苦于以下问题:C++ KNI_IsNullHandle函数的具体用法?C++ KNI_IsNullHandle怎么用?C++ KNI_IsNullHandle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了KNI_IsNullHandle函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: KNIDECL

KNI_RETURNTYPE_BYTE
KNIDECL(com_sun_midp_security_Permissions_getMaxValue) {
    
    int str_len;
    jbyte value;
    jchar jbuff[64];
    char  domain_name[64], group_name[64];

    KNI_StartHandles(2);
    KNI_DeclareHandle(domain);
    KNI_DeclareHandle(group);

    value = 0;
    KNI_GetParameterAsObject(1, domain);
    KNI_GetParameterAsObject(2, group);
    if (!KNI_IsNullHandle(domain) && !KNI_IsNullHandle(group)) {
        str_len = KNI_GetStringLength(domain);
        KNI_GetStringRegion(domain, 0, str_len, jbuff);
        jchar_to_char(jbuff, domain_name, str_len);
        str_len = KNI_GetStringLength(group);
        KNI_GetStringRegion(group, 0, str_len, jbuff);
        jchar_to_char(jbuff, group_name, str_len);
        value = (jbyte)permissions_get_max_value(domain_name, group_name);
    }

    KNI_EndHandles();
    KNI_ReturnByte(value);
}
开发者ID:AllBinary,项目名称:phoneme-components-midp,代码行数:28,代码来源:LoadPolicy_kni.c


示例2: KNIDECL

/*
 * Retrieves service record from the service search result.
 *
 * @param recHandle native handle of the service record
 * @param array byte array which will receive the data,
 *         or null for size query
 * @return size of the data read/required
 */
KNIEXPORT KNI_RETURNTYPE_INT
KNIDECL(com_sun_jsr082_bluetooth_SDPTransaction_getServiceRecord0)
{
    jint           retval  = 0;
    javacall_handle id      = 0;
    javacall_uint8  *data    = NULL;
    javacall_uint16 size    = 0;

    KNI_StartHandles(1);
    KNI_DeclareHandle(dataHandle);
    KNI_GetParameterAsObject(2, dataHandle);

    id = (javacall_handle)KNI_GetParameterAsInt(1);
    if (!KNI_IsNullHandle(dataHandle))
        size = KNI_GetArrayLength(dataHandle);

    data = JAVAME_MALLOC(size);
    if (data == NULL) {
        KNI_ThrowNew(jsropOutOfMemoryError, "Out of memory inside SDDB.readRecord()");
    } else {

        if (javacall_bt_sdp_get_service(id, data, &size) == JAVACALL_OK) {
            retval = size;
            if (!KNI_IsNullHandle(dataHandle)) {
                KNI_SetRawArrayRegion(dataHandle, 0, size, data);
            }
        } else {
            retval = 0;
        }
        JAVAME_FREE(data);
    }
    KNI_EndHandles();
    KNI_ReturnInt(retval);
}
开发者ID:Sektor,项目名称:phoneme-qtopia,代码行数:42,代码来源:NativeSDPGlue_c.c


示例3: Java_com_sun_cldc_i18n_j2me_Conv_getHandler

/**
 * Gets a handle to specific character encoding conversion routine.
 * <p>
 * Java declaration:
 * <pre>
 *     getHandler(Ljava/lang/String;)I
 * </pre>
 *
 * @param encoding character encoding
 *
 * @return identifier for requested handler, or <tt>-1</tt> if
 *         the encoding was not supported.
 */
KNIEXPORT KNI_RETURNTYPE_INT
Java_com_sun_cldc_i18n_j2me_Conv_getHandler() {
    jint     result = 0;

    KNI_StartHandles(1);

    KNI_DeclareHandle(str);
    KNI_GetParameterAsObject(1, str);

    if (!KNI_IsNullHandle(str)) {
        int      strLen = KNI_GetStringLength(str);
	jchar* strBuf;

	/* Instead of always multiplying the length by sizeof(jchar),
	 * we shift left by 1. This can be done because jchar has a
	 * size of 2 bytes.
	 */
	strBuf = (jchar*)midpMalloc(strLen<<1);
	if (strBuf != NULL) { 
	    KNI_GetStringRegion(str, 0, strLen, strBuf);
	    result = getLcConvMethodsID(strBuf, strLen);
	    midpFree(strBuf);
	} else {
	    KNI_ThrowNew(midpOutOfMemoryError, NULL);
	}
    }

    KNI_EndHandles();
    KNI_ReturnInt(result);
}
开发者ID:Sektor,项目名称:phoneme-qtopia,代码行数:43,代码来源:conv.c


示例4: getStringArray

/**
 * Fetch a KNI String array object into the string array.
 *
 * @param arrObj KNI Java String object handle
 * @param arrPtr the String array pointer for values storing
 * @return number of retrieved strings
 * <BR>KNI_ENOMEM - indicates memory allocation error
 */
static int getStringArray(jobjectArray arrObj, pcsl_string** arrPtr) {
    int i, n = 0;
    pcsl_string* arr;

    KNI_StartHandles(1);
    KNI_DeclareHandle(strObj);

    n = KNI_IsNullHandle(arrObj)? 0: (int)KNI_GetArrayLength(arrObj);
    while (n > 0) {
        arr = alloc_pcsl_string_list(n);
        if (arr == NULL) {
            n = KNI_ENOMEM;
            break;
        }

        *arrPtr = arr;
        for (i = 0; i < n; i++, arr++) {
            KNI_GetObjectArrayElement(arrObj, i, strObj);
            if (PCSL_STRING_OK != midp_jstring_to_pcsl_string(strObj, arr)) {
                free_pcsl_string_list(*arrPtr, n);
                *arrPtr = NULL;
                n = KNI_ENOMEM;
                break;
            }
        }
        break;
    }

    KNI_EndHandles();
    return n;
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:39,代码来源:regstore.c


示例5: Java_javax_microedition_lcdui_CustomItemLFImpl_setContentBuffer0

/**
 * Sets the content buffer. All paints are done to that buffer.
 * When paint is processed snapshot of the buffer is flushed to
 * the native resource content area.
 * Native implementation of Java function:
 * private static native int setContentBuffer0 ( int nativeId, Image img );
 * @param nativeId native resource is for this CustomItem
 * @param img mutable image that serves as an offscreen buffer
 */
KNIEXPORT KNI_RETURNTYPE_VOID
Java_javax_microedition_lcdui_CustomItemLFImpl_setContentBuffer0() {

  MidpError err = KNI_OK;
  unsigned char* imgPtr = NULL;
  MidpItem *ciPtr = (MidpItem *)KNI_GetParameterAsInt(1);

  KNI_StartHandles(1);
  KNI_DeclareHandle(image);

  KNI_GetParameterAsObject(2, image);
  
  if (KNI_IsNullHandle(image) != KNI_TRUE) {
    imgPtr = gxp_get_imagedata(image);
  }

  KNI_EndHandles();

  err = lfpport_customitem_set_content_buffer(ciPtr, imgPtr);
  
  if (err != KNI_OK) {
    KNI_ThrowNew(midpOutOfMemoryError, NULL);
  }
  
  KNI_ReturnVoid();
}
开发者ID:jiangxilong,项目名称:yari,代码行数:35,代码来源:lfp_customitem.c


示例6: Java_javax_microedition_khronos_egl_EGL10Impl__1eglInitialize

/*  private native int _eglInitialize ( int display , int [ ] major_minor ) ; */
KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_khronos_egl_EGL10Impl__1eglInitialize() {

    jint display = KNI_GetParameterAsInt(1);
    EGLint major, minor;

    jint returnValue;

    KNI_StartHandles(1);
    KNI_DeclareHandle(major_minorHandle);

    KNI_GetParameterAsObject(2, major_minorHandle);

    returnValue = (jint) eglInitialize((EGLDisplay)display, &major, &minor);
#ifdef DEBUG
    printf("eglInitialize(0x%x, major<-%d, minor<-%d) = %d\n",
	   display, major, minor, returnValue);
#endif
    if ((returnValue == EGL_TRUE) && !KNI_IsNullHandle(major_minorHandle)) {
        KNI_SetIntArrayElement(major_minorHandle, 0, major);
        KNI_SetIntArrayElement(major_minorHandle, 1, minor);
    }

    KNI_EndHandles();
    KNI_ReturnInt(returnValue);
}
开发者ID:Sektor,项目名称:phoneme-qtopia,代码行数:27,代码来源:JSR239-KNIEGL11Impl.c


示例7: Java_com_sun_j2me_global_CollationAbstractionLayerImpl_getCollationLocaleIndex

/**
 * Get index of supported locales for collation by its name.
 * <p>
 * Java declaration:
 * <pre>
 *     getDevLocaleIndex(Ljava/lang/String)I
 * </pre>
 *
 * @param locale name
 * @return internal index of locale or -1 if locale is not supported 
 */
KNIEXPORT KNI_RETURNTYPE_INT
Java_com_sun_j2me_global_CollationAbstractionLayerImpl_getCollationLocaleIndex() {
	jint result =-1, index = 0;
	jsize len = 0;
	int error = 0;
	jchar* locale_name;

	KNI_StartHandles(1);
	KNI_DeclareHandle(hstr1);
	KNI_GetParameterAsObject(1, hstr1);

	if (KNI_IsNullHandle(hstr1)) {
		locale_name = NULL;
	} else  {
		len = KNI_GetStringLength(hstr1);
		locale_name = (jchar *)midpMalloc((len + 1) * sizeof(jchar));
		if (NULL == locale_name) {
		   KNI_ThrowNew(midpOutOfMemoryError, 
			   "Out of memory");
		   error = 1;
		} else {
			KNI_GetStringRegion(hstr1, 0, len, locale_name);
			locale_name[len]=0;
		}
	}

	if (!error){
		result = jsr238_get_collation_locale_index(locale_name, &index);
		if (result < 0) index =-1;
		midpFree(locale_name);
	}

	KNI_EndHandles();
	KNI_ReturnInt(index);
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:46,代码来源:jsr238_collation_kni.c


示例8: KNIDECL

/**
 * Get index of supported locales for device resources by its name.
 * <p>
 * Java declaration:
 * <pre>
 *     getDevLocaleIndex(Ljava/lang/String)I
 * </pre>
 *
 * @param locale name
 * @return internal index of locale or -1 if locale is not supported 
 */
KNIEXPORT KNI_RETURNTYPE_INT
KNIDECL(com_sun_j2me_global_DevResourceManagerFactory_getDevLocaleIndex) {
	jint result =-1, index = 0;
	jsize len = 0;
	int error = 0;
	jchar* locale_name;

	KNI_StartHandles(1);
	KNI_DeclareHandle(hstr1);
	KNI_GetParameterAsObject(1, hstr1);

	if (KNI_IsNullHandle(hstr1)) {
		locale_name = NULL;
	} else  {
		len = KNI_GetStringLength(hstr1);
		locale_name = (jchar *)JAVAME_MALLOC((len + 1) * sizeof(jchar));
		if (NULL == locale_name) {
		   KNI_ThrowNew(jsropOutOfMemoryError, 
			   "Out of memory");
		   error = 1;
		} else {
			KNI_GetStringRegion(hstr1, 0, len, locale_name);
			locale_name[len]=0;
		}
	}

	if (!error){
		result = jsr238_get_resource_locale_index(locale_name, &index);
		if (result < 0) index =-1;
		JAVAME_FREE(locale_name);
	}

	KNI_EndHandles();
	KNI_ReturnInt(index);
}
开发者ID:Sektor,项目名称:phoneme-qtopia,代码行数:46,代码来源:jsr238_resources_kni.c


示例9: Java_javax_microedition_khronos_egl_EGL10Impl__1eglQueryContext

/*  private native int _eglQueryContext ( int display , int ctx , int attribute , int [ ] value ) ; */
KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_khronos_egl_EGL10Impl__1eglQueryContext() {

    jint display = KNI_GetParameterAsInt(1);
    jint ctx = KNI_GetParameterAsInt(2);
    jint attribute = KNI_GetParameterAsInt(3);
    EGLint value;

    jint returnValue = EGL_FALSE;

    KNI_StartHandles(1);
    KNI_DeclareHandle(valueHandle);

    KNI_GetParameterAsObject(4, valueHandle);

    returnValue = (jint)eglQueryContext((EGLDisplay)display,
					(EGLContext)ctx,
					attribute,
					&value);
#ifdef DEBUG
    printf("eglQueryContext(0x%x, 0x%x, %d, value<-%d) = %d\n",
	   display, ctx, attribute, value, returnValue);
#endif
    if ((returnValue == EGL_TRUE) && !KNI_IsNullHandle(valueHandle)) {
        KNI_SetIntArrayElement(valueHandle, 0, value);
    }

    KNI_EndHandles();
    KNI_ReturnInt(returnValue);
}
开发者ID:Sektor,项目名称:phoneme-qtopia,代码行数:31,代码来源:JSR239-KNIEGL11Impl.c


示例10: Java_com_sun_kvem_jsr082_bluetooth_SDDB_readRecord

/**
 * Retrieves service record from the SDDB.
 *
 * @param handle handle of the service record to be retrieved
 * @param data byte array which will receive the data,
 *         or null for size query
 * @return size of the data read/required
 */
KNIEXPORT KNI_RETURNTYPE_INT
Java_com_sun_kvem_jsr082_bluetooth_SDDB_readRecord(void)
{
    jint retval;
    bt_record_t record;
    KNI_StartHandles(1);
    KNI_DeclareHandle(dataHandle);
    KNI_GetParameterAsObject(2, dataHandle);
    record.id = (bt_sddbid_t)KNI_GetParameterAsInt(1);
    if (KNI_IsNullHandle(dataHandle)) {
        record.data = NULL;
        record.size = 0;
    } else {
        record.data = JavaByteArray(dataHandle);
        record.size = KNI_GetArrayLength(dataHandle);
    }
    if (javacall_bt_sddb_read_record(record.id, &record.classes,
            record.data, &record.size) == JAVACALL_OK) {
        retval = record.size;
    } else {
        retval = 0;
    }
    KNI_EndHandles();
    KNI_ReturnInt(retval);
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:33,代码来源:SDDBGlue.c


示例11: Java_javax_microedition_lcdui_ImageItemLFImpl_createNativeResource0

/**
 * KNI function that creates new native resource for the current ImageItem.
 *
 * Class: javax.microedition.lcdui.ImageItemLFImpl
 * Java prototype:
 * private native int createNativeResource0(int ownerId, String label,
 *                                          int layout,
 *                                          Image img, String altText,
 *                                          int appearanceMode)
 *
 * INTERFACE (operand stack manipulation):
 *   parameters:  ownerId            pointer to the owner's native resource
 *                label              ImageItem's label
 *                layout             ImageItem's layout
 *                img                ImageItem's image
 *                altText            ImageItem's attText
 *                appearanceMode     the appearanceMode of ImageItem
 *   return pointer to the created native resource
 */
KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_lcdui_ImageItemLFImpl_createNativeResource0() {
  MidpError err = KNI_OK;
  MidpDisplayable  *ownerPtr;
  MidpItem *itemPtr = NULL;
  pcsl_string label, altText;
  pcsl_string_status rc1,rc2;
  unsigned char* imgPtr = NULL;
  int appearanceMode, layout;

  KNI_StartHandles(3);
  
  KNI_DeclareHandle(labelJString);
  KNI_DeclareHandle(image);
  KNI_DeclareHandle(altTextJString);

  ownerPtr = (MidpDisplayable *)KNI_GetParameterAsInt(1);
  KNI_GetParameterAsObject(2, labelJString);
  layout = KNI_GetParameterAsInt(3);
  KNI_GetParameterAsObject(4, image);
  KNI_GetParameterAsObject(5, altTextJString);

  if (KNI_IsNullHandle(image) != KNI_TRUE) {
    imgPtr = gxp_get_imagedata(image);
  }

  appearanceMode = KNI_GetParameterAsInt(6);

  rc1 = midp_jstring_to_pcsl_string(labelJString, &label);
  rc2 = midp_jstring_to_pcsl_string(altTextJString, &altText);

  KNI_EndHandles();

  /* NULL and empty strings are acceptable. */
  if (PCSL_STRING_OK != rc1 || PCSL_STRING_OK != rc2 ) {
    err = KNI_ENOMEM;
    goto cleanup;
  }

  itemPtr = MidpNewItem(ownerPtr, MIDP_PLAIN_IMAGE_ITEM_TYPE+appearanceMode);
  if (itemPtr == NULL) {
    err = KNI_ENOMEM;
    goto cleanup;
  }

  err = lfpport_imageitem_create(itemPtr, ownerPtr, &label, layout,
				 imgPtr, &altText, appearanceMode);

cleanup:
  pcsl_string_free(&altText);
  pcsl_string_free(&label);

  if (err != KNI_OK) {
    MidpDeleteItem(itemPtr);
    KNI_ThrowNew(midpOutOfMemoryError, NULL);
  }

  KNI_ReturnInt(itemPtr);
}
开发者ID:AllBinary,项目名称:phoneme-components-midp,代码行数:78,代码来源:lfp_imageitem.c


示例12: gxp_get_imagedata

/**
 * Retrieves a pointer to the raw image data.
 *
 * @param imgData a handle to the <tt>ImageData</tt> Java object that contains
 *            the raw image data
 *
 * @return A pointer to the raw data associated with the given
 *         <tt>ImageData</tt> object. Otherwise NULL.
 */
gxpport_image_native_handle gxp_get_imagedata(jobject imgData) {

    if (KNI_IsNullHandle(imgData)) {
        return NULL;
    } else {
	return (gxpport_image_native_handle)IMGAPI_GET_IMAGEDATA_PTR(imgData)->nativeImageData;
    }
}
开发者ID:AllBinary,项目名称:phoneme-components-midp,代码行数:17,代码来源:imgp_imagedatafactory_kni.c


示例13: fillActionMap

/**
 * Fills <code>MidpString</code> arrays for locales and action_maps from 
 * <code>ActionMap</code> objects.
 * <BR>Length of <code>actionnames</code> array must be the same as in
 * <code>act_num</code> parameter for each element of <code>ActionMap</code>
 * array.
 *
 * @param o <code>ActionMap[]</code> object 
 * @param handler pointer on <code>JSR211_content_handler</code> structure
 * being filled up
 * @return KNI_OK - if successfully get all fields, 
 * KNI_ERR or KNI_ENOMEM - otherwise
 */
static int fillActionMap(jobject o, JSR211_content_handler* handler) {
    int ret = KNI_OK;   // returned result
    int len;            // number of locales

    len = KNI_IsNullHandle(o)? 0: (int)KNI_GetArrayLength(o);
    if (len > 0) {
        int i, j;
        int n = handler->act_num;   // number of actions
        pcsl_string *locs = NULL;   // fetched locales
        pcsl_string *nams = NULL;   // fetched action names

        KNI_StartHandles(3);
        KNI_DeclareHandle(map);   // current ANMap object
        KNI_DeclareHandle(str);   // the ANMap's locale|name String object
        KNI_DeclareHandle(arr);   // the ANMap's array of names object

        do {
            // allocate buffers
            handler->locales = alloc_pcsl_string_list(len);
            if (handler->locales == NULL) {
                ret = KNI_ENOMEM;
                break;
            }
            handler->locale_num = len;
            handler->action_map = alloc_pcsl_string_list(len * n);
            if (handler->action_map == NULL) {
                ret = KNI_ENOMEM;
                break;
            }

            // iterate array elements
            locs = handler->locales;
            nams = handler->action_map;
            for (i = 0; i < len && ret == KNI_OK; i++) {
                KNI_GetObjectArrayElement(o, i, map);
                KNI_GetObjectField(map, anMapLocale, str);
                if (PCSL_STRING_OK != midp_jstring_to_pcsl_string(str, locs++)) {
                    ret = KNI_ENOMEM;
                    break;
                }
                KNI_GetObjectField(map, anMapActionnames, arr);
                for (j = 0; j < n; j++) {
                    KNI_GetObjectArrayElement(arr, j, str);
                    if (PCSL_STRING_OK != midp_jstring_to_pcsl_string(str, nams++)) {
                        ret = KNI_ENOMEM;
                        break;
                    }
                }
            }
        } while (0);
        
        KNI_EndHandles();
    }
    
    return ret;
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:69,代码来源:regstore.c


示例14: KNIDECL

/**
 * Decodes the given byte array into the <tt>ImageData</tt>.
 * <p>
 * Java declaration:
 * <pre>
 *     loadJPG(Ljavax/microedition/lcdui/ImageData;[BII)V
 * </pre>
 *
 * @param imageData the ImageData to load to
 * @param imageBytes A byte array containing the encoded JPEG image data
 * @param imageOffset The start of the image data within the byte array
 * @param imageLength The length of the image data in the byte array
 */
KNIEXPORT KNI_RETURNTYPE_VOID
KNIDECL(javax_microedition_lcdui_ImageDataFactory_loadJPEG) {
    int            length = KNI_GetParameterAsInt(4);
    int            offset = KNI_GetParameterAsInt(3);
    unsigned char* srcBuffer = NULL;
    gxj_screen_buffer            image;
    java_imagedata * midpImageData = NULL;

    /* variable to hold error codes */
    gxutl_native_image_error_codes creationError = GXUTL_NATIVE_IMAGE_NO_ERROR;

    KNI_StartHandles(3);
    /* KNI_DeclareHandle(alphaData); */
    KNI_DeclareHandle(pixelData);
    KNI_DeclareHandle(jpegData);
    KNI_DeclareHandle(imageData);

    KNI_GetParameterAsObject(2, jpegData);
    KNI_GetParameterAsObject(1, imageData);

    midpImageData = GXAPI_GET_IMAGEDATA_PTR(imageData);

    /* assert
     * (KNI_IsNullHandle(jpegData))
     */

    srcBuffer = (unsigned char *)JavaByteArray(jpegData);
    /*
     * JAVA_TRACE("loadJPEG jpegData length=%d  %x\n",
     *            JavaByteArray(jpegData)->length, srcBuffer);
     */

    image.width = midpImageData->width;
    image.height = midpImageData->height;

    unhand(jbyte_array, pixelData) = midpImageData->pixelData;
    if (!KNI_IsNullHandle(pixelData)) {
        image.pixelData = (gxj_pixel_type *)JavaByteArray(pixelData);
        /*
         * JAVA_TRACE("loadJPEG pixelData length=%d\n",
         *            JavaByteArray(pixelData)->length);
         */
    }

    /* assert
     * (imagedata.pixelData != NULL)
     */
    decode_jpeg((srcBuffer + offset), length, &image, &creationError);

    if (GXUTL_NATIVE_IMAGE_NO_ERROR != creationError) {
        KNI_ThrowNew(midpIllegalArgumentException, NULL);
    }

    KNI_EndHandles();
    KNI_ReturnVoid();
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:69,代码来源:gxj_imagedatafactory_kni.c


示例15: fill_adressInfoField

/**
 * (Internal) Fill addressInfo Field.
 */
static jboolean fill_adressInfoField(jobject landmarkObj, jfieldID fieldID, 
                jobject stringObj,  javacall_location_addressinfo_fieldinfo *fieldInfo, 
                javacall_location_addressinfo_field addressInfoFieldId) {
    KNI_GetObjectField(landmarkObj, fieldID, stringObj);
    if (!KNI_IsNullHandle(stringObj)) {
        fieldInfo->fieldId = addressInfoFieldId;
        return jsr179_jstring_to_utf16(stringObj, fieldInfo->data, JAVACALL_LOCATION_MAX_ADDRESSINFO_FIELD);
    }
    return KNI_FALSE;
}
开发者ID:hbao,项目名称:phonemefeaturedevices,代码行数:13,代码来源:locationPersistentStorage_kni.c


示例16: KNIDECL

/**
 * Draws the specified image by using the anchor point.
 * The image can be drawn in different positions relative to
 * the anchor point by passing the appropriate position constants.
 * See <a href="#anchor">anchor points</a>.
 *
 * <p>If the source image contains transparent pixels, the corresponding
 * pixels in the destination image must be left untouched.  If the source
 * image contains partially transparent pixels, a compositing operation
 * must be performed with the destination pixels, leaving all pixels of
 * the destination image fully opaque.</p>
 *
 * <p>If <code>img</code> is the same as the destination of this Graphics
 * object, the result is undefined.  For copying areas within an
 * <code>Image</code>, {@link #copyArea copyArea} should be used instead.
 * </p>
 *
 * @param g the specified Graphics to be drawn
 * @param x the x coordinate of the anchor point
 * @param y the y coordinate of the anchor point
 * @param anchor the anchor point for positioning the image
 * @throws IllegalArgumentException if <code>anchor</code>
 * is not a legal value
 * @throws NullPointerException if <code>g</code> is <code>null</code>
 * @see Image
 */
KNIEXPORT KNI_RETURNTYPE_BOOLEAN
KNIDECL(javax_microedition_lcdui_Image_render) {
    jboolean success = KNI_TRUE;

    int anchor = KNI_GetParameterAsInt(4);
    int y      = KNI_GetParameterAsInt(3);
    int x      = KNI_GetParameterAsInt(2);

    KNI_StartHandles(3);
    KNI_DeclareHandle(img);
    KNI_DeclareHandle(g);
    KNI_DeclareHandle(gImg);

    KNI_GetParameterAsObject(1, g);
    KNI_GetThisPointer(img);

    if (GRAPHICS_OP_IS_ALLOWED(g)) {
        /* null checking is handled by the Java layer, but test just in case */
        if (KNI_IsNullHandle(img)) {
            success = KNI_FALSE; //KNI_ThrowNew(midpNullPointerException, NULL);
        } else {
  	    const java_imagedata * srcImageDataPtr =
	      GET_IMAGE_PTR(img)->imageData;

            GET_IMAGE_PTR(gImg) =
	      (struct Java_javax_microedition_lcdui_Image *)
	      (GXAPI_GET_GRAPHICS_PTR(g)->img);
            if (KNI_IsSameObject(gImg, img) || !gxutl_check_anchor(anchor,0)) {
                success = KNI_FALSE; //KNI_ThrowNew(midpIllegalArgumentException, NULL);
            } else if (!gxutl_normalize_anchor(&x, &y, srcImageDataPtr->width, 
					       srcImageDataPtr->height, 
					       anchor)) {
                success = KNI_FALSE;//KNI_ThrowNew(midpIllegalArgumentException, NULL);
            } else {
	        jshort clip[4]; /* Defined in Graphics.java as 4 shorts */
	        const java_imagedata * dstMutableImageDataPtr = 
		  GXAPI_GET_IMAGEDATA_PTR_FROM_GRAPHICS(g);

                GXAPI_TRANSLATE(g, x, y);
		GXAPI_GET_CLIP(g, clip);

		gx_render_image(srcImageDataPtr, dstMutableImageDataPtr,
				clip, x, y);

            }
        }
    }

    KNI_EndHandles();
    KNI_ReturnBoolean(success);
}
开发者ID:sfsy1989,项目名称:j2me,代码行数:77,代码来源:gxapi_image_kni.c


示例17: Java_javax_microedition_khronos_egl_EGL10Impl__1eglCreateContext

/*  private native int _eglCreateContext ( int display , int config , int share_context , int [ ] attrib_list ) ; */
KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_khronos_egl_EGL10Impl__1eglCreateContext() {

    jint display = KNI_GetParameterAsInt(1);
    jint config = KNI_GetParameterAsInt(2);
    jint share_context = KNI_GetParameterAsInt(3);
    EGLint *attrib_list = (EGLint *)0;

    jint returnValue = 0;

    KNI_StartHandles(1);
    KNI_DeclareHandle(attrib_listHandle);

    KNI_GetParameterAsObject(4, attrib_listHandle);

    /* Construct attrib_list as a copy of attrib_listHandle */
    if (!KNI_IsNullHandle(attrib_listHandle)) {
        jint attrib_list_length, attrib_list_size;

        attrib_list_length = KNI_GetArrayLength(attrib_listHandle);
        attrib_list_size = attrib_list_length*sizeof(jint);
        attrib_list = (EGLint *)JSR239_malloc(attrib_list_size);
        if (!attrib_list) {
            KNI_ThrowNew("java.lang.OutOfMemoryException", "eglCreateContext");
            goto exit;
        }
        KNI_GetRawArrayRegion(attrib_listHandle, 0, attrib_list_size,
                              (jbyte *)attrib_list);
    }

    returnValue = (jint)eglCreateContext((EGLDisplay) display,
					 (EGLConfig) config,
					 (EGLConfig) share_context,
					 attrib_list);
#ifdef DEBUG
    if (returnValue > 0) {
        ++contexts;
    }

    printf("eglCreateContext(0x%x, 0x%x, 0x%x, attrib_list) = %d, contexts = %d\n",
	   display, config, share_context, returnValue, contexts);
#endif

 exit:
    if (attrib_list) {
	JSR239_free(attrib_list);
    }
    KNI_EndHandles();
    KNI_ReturnInt(returnValue);
}
开发者ID:Sektor,项目名称:phoneme-qtopia,代码行数:51,代码来源:JSR239-KNIEGL11Impl.c


示例18: midp_readJarEntry

/*
* IMPL_NOTE: this function is the same as midpGetJarEntry() in midpJar.c,
* but it uses only CLDC stuff
*/
jboolean
midp_readJarEntry(const pcsl_string* jarName, const pcsl_string* entryName, jobject* entry) {
    JvmPathChar* platformJarName;
    int i;
    jboolean noerror = KNI_TRUE;

    GET_PCSL_STRING_DATA_AND_LENGTH(jarName)
    /* Entry names in JARs are UTF-8. */
    const jbyte * const platformEntryName = pcsl_string_get_utf8_data(entryName);

    do {
        if (platformEntryName == NULL) {
            noerror = KNI_FALSE;
            break;
        }
        /*
         * JvmPathChars can be either 16 bits or 8 bits so we can't
         * assume either.
         */

        /*
         * Conversion to JvmPathChars is only temporary, we should change the VM
         * should take a jchar array and a length and pass that to
         * PCSL which will then perform
         * a platform specific conversion (DBCS on Win32 or UTF8 on Linux)
         */
        platformJarName = midpMalloc((jarName_len + 1) * sizeof (JvmPathChar));
        if (platformJarName == NULL) {
            noerror = KNI_FALSE;
            break;
        }

        for (i = 0; i < jarName_len; i++) {
            platformJarName[i] = (JvmPathChar)jarName_data[i];
        }

        platformJarName[i] = 0;

        Jvm_read_jar_entry(platformJarName, (char*)platformEntryName, (jobject)*entry);
        midpFree(platformJarName);
    } while(0);
    pcsl_string_release_utf8_data(platformEntryName, entryName);
    RELEASE_PCSL_STRING_DATA_AND_LENGTH
    if (noerror) {
        return (KNI_IsNullHandle((jobject)*entry) == KNI_TRUE)
               ? KNI_FALSE : KNI_TRUE;
    } else {
        return KNI_FALSE;
    }
}
开发者ID:AllBinary,项目名称:phoneme-components-midp,代码行数:54,代码来源:midpServices.c


示例19: Java_javax_microedition_khronos_egl_EGL10Impl__1eglCreatePixmapSurface

/*  private native int _eglCreatePixmapSurface ( int display , int config , int pixmap , int [ ] attrib_list ) ; */
KNIEXPORT KNI_RETURNTYPE_INT
Java_javax_microedition_khronos_egl_EGL10Impl__1eglCreatePixmapSurface() {

    jint display = KNI_GetParameterAsInt(1);
    jint config = KNI_GetParameterAsInt(2);
    jint pixmap = KNI_GetParameterAsInt(3);
    EGLint *attrib_list = (EGLint *)0;

    jint returnValue = (jint)EGL_NO_SURFACE;

    KNI_StartHandles(1);
    KNI_DeclareHandle(attrib_listHandle);

    KNI_GetParameterAsObject(4, attrib_listHandle);

    /* Construct attrib_list as a copy of attrib_listHandle if non-null */
    if (!KNI_IsNullHandle(attrib_listHandle)) {
        jint attrib_list_length, attrib_list_size;

	attrib_list_length = KNI_GetArrayLength(attrib_listHandle);
	attrib_list_size = attrib_list_length*sizeof(jint);
	attrib_list = (EGLint *)JSR239_malloc(attrib_list_size);
	if (!attrib_list) {
            KNI_ThrowNew("java.lang.OutOfMemoryException",
			 "eglCreatePixmapSurface");
	    goto exit;
	}
	KNI_GetRawArrayRegion(attrib_listHandle, 0, attrib_list_size,
			      (jbyte *) attrib_list);
    }

    returnValue = (jint)eglCreatePixmapSurface((EGLDisplay)display,
					       (EGLConfig)config,
					       (NativePixmapType)pixmap,
					       (EGLint const *) attrib_list);
#ifdef DEBUG
    printf("eglCreatePixmapSurface(%d, %d, 0x%x, attrib_list) = %d\n",
	   display, config, pixmap, returnValue);
#endif

 exit:
    if (attrib_list) {
	JSR239_free(attrib_list);
    }

    KNI_EndHandles();
    KNI_ReturnInt(returnValue);
}
开发者ID:Sektor,项目名称:phoneme-qtopia,代码行数:49,代码来源:JSR239-KNIEGL11Impl.c


示例20: jsr179_jstring_to_utf16

static jboolean jsr179_jstring_to_utf16(jobject stringObj, javacall_utf16 *string, jint len) {
    if (!KNI_IsNullHandle(stringObj)) {
        if (KNI_GetStringLength(stringObj) > 0) {
            if (JAVACALL_OK != jsrop_jstring_to_utf16(stringObj, string, len)) {
                return KNI_FALSE;
            }
        } else {
            string[0] = (javacall_utf16)0x0000;
            string[1] = (javacall_utf16)0x0000;
        }
    } else {
        string[0] = (javacall_utf16)0x0000;
        string[1] = (javacall_utf16)0xFFFF;
    }
    return KNI_TRUE;
}
开发者ID:hbao,项目名称:phonemefeaturedevices,代码行数:16,代码来源:locationPersistentStorage_kni.c



注:本文中的KNI_IsNullHandle函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ KNI_ReturnVoid函数代码示例发布时间:2022-05-30
下一篇:
C++ KNI_GetParameterAsInt函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap