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

C++ AndroidBitmap_getInfo函数代码示例

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

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



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

示例1: Java_com_jiangpeng_android_antrace_Utils_unsharpMask

JNIEXPORT void JNICALL Java_com_jiangpeng_android_antrace_Utils_unsharpMask(JNIEnv* env, jobject thiz, jobject input, jobject output)
{
	AndroidBitmapInfo inputInfo;
	AndroidBitmapInfo outputInfo;
	void* src_pixels = 0;
	void* dst_pixels = 0;
	int ret = 0;

	if ((ret = AndroidBitmap_getInfo(env, input, &inputInfo)) < 0) {
		return;
	}

	if (inputInfo.format != ANDROID_BITMAP_FORMAT_RGBA_8888) {
		return;
	}
	if ((ret = AndroidBitmap_lockPixels(env, input, &src_pixels)) < 0) {
		return;
	}

	if ((ret = AndroidBitmap_getInfo(env, output, &outputInfo)) < 0) {
		return;
	}

	if (outputInfo.format != ANDROID_BITMAP_FORMAT_RGBA_8888) {
		return;
	}
	if ((ret = AndroidBitmap_lockPixels(env, output, &dst_pixels)) < 0) {
		return;
	}

	unsharpMask(src_pixels, dst_pixels, outputInfo.width, outputInfo.height, inputInfo.stride, 5);
	AndroidBitmap_unlockPixels(env, input);
	AndroidBitmap_unlockPixels(env, output);
}
开发者ID:larscwallin,项目名称:antrace,代码行数:34,代码来源:antrace.cpp


示例2: LOGI

JNIEXPORT void JNICALL Java_com_leth_convertimage_MainActivity_convertImage
	(JNIEnv *env, jobject  obj, jobject origbm,jobject graybm)
{

		AndroidBitmapInfo  infocolor;
	    void				*pixelscolor;
	    AndroidBitmapInfo  infogray;
	    void 				*pixelsgray;
	    int 			    y;
	    int          	    x;

	    LOGI("Before convert");

	    AndroidBitmap_getInfo(env, origbm, &infocolor);
	    LOGI("infocolor :: width-%d height-%d format-%d stride-%ld"
	    				   ,infocolor.width
						   ,infocolor.height
						   ,infocolor.stride);
	    AndroidBitmap_getInfo(env, graybm, &infogray);
	    AndroidBitmap_lockPixels(env, origbm, &pixelscolor);
	    AndroidBitmap_lockPixels(env, graybm, &pixelsgray);

	    LOGI("Start convert");
	    uint8_t tmp;
	    for ( y=0; y<infocolor.height; y++) {
	    	rgba * line = (rgba *) pixelscolor;
	    	uint32_t * grayline = (uint32_t *) pixelsgray;
	    	for ( x=0; x < infocolor.width; x++){
	    		tmp =
	    				line[x].red * 0.33
	    				+ line[x].green  * 0.33
						+ line[x].blue * 0.33
						;
	    		grayline[x] =
	    					  (line[x].alpha & 0xff) << 24
							| (tmp & 0xff) << 16
							| (tmp & 0xff) << 8
							| (tmp & 0xff)
							//| line[x].red << 16
							//| line[x].green << 8
	    					//| line[x].blue
							;
	    	}
	    	pixelscolor = (int8_t *)pixelscolor + infocolor.stride;
	    	pixelsgray = (int8_t *) pixelsgray + infogray.stride;
	    }

	    LOGI("Finish convert");
	    AndroidBitmap_unlockPixels(env, origbm);
	    AndroidBitmap_unlockPixels(env, graybm);
}
开发者ID:frzleaf,项目名称:imageprocessing,代码行数:51,代码来源:convertimage.c


示例3: bitmap_to_mat

void bitmap_to_mat(JNIEnv *env, jobject &srcBitmap, Mat &srcMat) {
    void *srcPixels = 0;
    AndroidBitmapInfo srcBitmapInfo;
    try {
        AndroidBitmap_getInfo(env, srcBitmap, &srcBitmapInfo);
        AndroidBitmap_lockPixels(env, srcBitmap, &srcPixels);
        uint32_t srcHeight = srcBitmapInfo.height;
        uint32_t srcWidth = srcBitmapInfo.width;
        srcMat.create(srcHeight, srcWidth, CV_8UC4);
        if (srcBitmapInfo.format == ANDROID_BITMAP_FORMAT_RGBA_8888) {
            Mat tmp(srcHeight, srcWidth, CV_8UC4, srcPixels);
            tmp.copyTo(srcMat);
        } else {
            Mat tmp = Mat(srcHeight, srcWidth, CV_8UC2, srcPixels);
            cvtColor(tmp, srcMat, COLOR_BGR5652RGBA);
        }
        AndroidBitmap_unlockPixels(env, srcBitmap);
        return;
    } catch (cv::Exception &e) {
        AndroidBitmap_unlockPixels(env, srcBitmap);
        jclass je = env->FindClass("java/lang/Exception");
        env -> ThrowNew(je, e.what());
        return;
    } catch (...) {
        AndroidBitmap_unlockPixels(env, srcBitmap);
        jclass je = env->FindClass("java/lang/Exception");
        env -> ThrowNew(je, "unknown");
        return;
    }
}
开发者ID:Fuge2008,项目名称:SmartCropper,代码行数:30,代码来源:android_utils.cpp


示例4: Java_makemachine_android_examples_Nati_greyscale

JNIEXPORT void JNICALL Java_makemachine_android_examples_Nati_greyscale(JNIEnv * env, jclass klass, jobject bitmap,jint wind){
      void * raw;
      uint32_t * pixels;
      int ret,j;
      int grey;
      AndroidBitmapInfo  info;
      if ((ret = AndroidBitmap_getInfo(env, bitmap, &info)) < 0) return;
      if ((ret = AndroidBitmap_lockPixels(env, bitmap, &raw)) < 0) return;
      pixels=(uint32_t*) raw;
#define USE_CONTRAST STRETCH
#ifdef USE_CONTRAST_STRETCH
      determine_contrast(&pixels,info.height,info.width);
#else
      Qwe::mingrey=0;
      Qwe::maxgrey=255;
#endif
      greyscale(&pixels,info.height,info.width);
      make_mean(info.height,info.width,wind);
#ifdef USE_DEVIATION
      make_dev(info.height,info.width,wind);
#endif
      imtoin(info.height,info.width);
      thresh(info.height,info.width);
      close(info.height,info.width,2);
      open(info.height,info.width,2);

      AndroidBitmap_unlockPixels(env, bitmap);

}
开发者ID:arpheno,项目名称:receiptKeeper,代码行数:29,代码来源:test.cpp


示例5: StackBlur

JNIEXPORT void JNICALL Java_com_daemon_aroundcircleviewdemo_ImageBlur_blurBitMap
(JNIEnv *env, jclass obj, jobject bitmapIn, jint r)
{
AndroidBitmapInfo infoIn;
void* pixelsIn;
int ret;

// Get image info
if ((ret = AndroidBitmap_getInfo(env, bitmapIn, &infoIn)) < 0)
return;
// Check image
if (infoIn.format != ANDROID_BITMAP_FORMAT_RGBA_8888)
return;
// Lock all images
if ((ret = AndroidBitmap_lockPixels(env, bitmapIn, &pixelsIn)) < 0) {
//AndroidBitmap_lockPixels failed!
}
//height width
int h = infoIn.height;
int w = infoIn.width;

//Start
pixelsIn = StackBlur((int*)pixelsIn, w, h, r);
//End

// Unlocks everything
AndroidBitmap_unlockPixels(env, bitmapIn);
}
开发者ID:dalong982242260,项目名称:AroundCircleView,代码行数:28,代码来源:com_daemon_aroundcircleviewdemo_ImageBlur.cpp


示例6: RAW_Setup

GF_Err RAW_Setup(GF_VideoOutput *dr, void *os_handle, void *os_display, u32 init_flags)
{
	AndroidBitmapInfo  info;
	RAWCTX;
	void * pixels;
	int ret;

	GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("Android vout RAW_Setup\n"));

	if (!rc->width)
	{
		rc->env = (JNIEnv *)os_handle;
		rc->bitmap = (jobject *)os_display;

		AndroidBitmap_getInfo(rc->env, *(rc->bitmap), &info);
		rc->width = info.width;
		rc->height = info.height;
		rc->locked_data = NULL;
	}
	else
	{
		rc->env = (JNIEnv *)os_handle;
		rc->bitmap = (jobject *)os_display;
	}

	GF_LOG(GF_LOG_DEBUG, GF_LOG_CORE, ("Android vout rc dims: %d:%d\n", rc->height, rc->width));

	return GF_OK;
}
开发者ID:jnorthrup,项目名称:gpac,代码行数:29,代码来源:droid_vout-bitmap.c


示例7: Java_si_majcn_frameoffame_MainActivity_applyEffect

JNIEXPORT void JNICALL
Java_si_majcn_frameoffame_MainActivity_applyEffect(JNIEnv  *env,
                                                   jobject  obj,
                                                   jobject  bitmap,
                                                   jint     effectNumber)
{
    AndroidBitmapInfo  info;
    int ret;
    void *pixels;

    if ((ret = AndroidBitmap_getInfo(env, bitmap, &info)) < 0)
    {
        LOGE("AndroidBitmap_getInfo() failed ! error=%d", ret);
        return;
    }
    if (info.format != ANDROID_BITMAP_FORMAT_RGB_565)
    {
        LOGE("Bitmap format is not RGBA_565 !");
        return;
    }

    if ((ret = AndroidBitmap_lockPixels(env, bitmap, &pixels)) < 0)
    {
        LOGE("AndroidBitmap_lockPixels() failed ! error=%d", ret);
    }

    applyEffect(&info, pixels, effectNumber);

    AndroidBitmap_unlockPixels(env, bitmap);
}
开发者ID:HairyFotr,项目名称:FrameOfFame,代码行数:30,代码来源:imageprocessing.c


示例8: lockPixels

int lockPixels(JNIEnv *env, jobject jbitmap, GifInfo *info, void **pixels) {
    AndroidBitmapInfo bitmapInfo;
    if (AndroidBitmap_getInfo(env, jbitmap, &bitmapInfo) == ANDROID_BITMAP_RESULT_SUCCESS)
        info->stride = bitmapInfo.width;
    else {
        throwException(env, ILLEGAL_STATE_EXCEPTION_BARE, "Could not get bitmap info");
        return -2;
    }

    const int lockPixelsResult = AndroidBitmap_lockPixels(env, jbitmap, pixels);
    if (lockPixelsResult == ANDROID_BITMAP_RESULT_SUCCESS)
        return 0;

    char *message;
    switch (lockPixelsResult) {
        case ANDROID_BITMAP_RESULT_ALLOCATION_FAILED:
#ifdef DEBUG
            LOGE("bitmap lock allocation failed");
#endif
            return -1; //#122 workaround
        case ANDROID_BITMAP_RESULT_BAD_PARAMETER:
            message = "Lock pixels error, bad parameter";
            break;
        case ANDROID_BITMAP_RESULT_JNI_EXCEPTION:
            message = "Lock pixels error, JNI exception";
            break;
        default:
            message = "Lock pixels error";
    }
    throwException(env, ILLEGAL_STATE_EXCEPTION_BARE, message);
    return -2;
}
开发者ID:551780457,项目名称:android-gif-drawable,代码行数:32,代码来源:bitmap.c


示例9: nativeGetFrame

static jlong JNICALL nativeGetFrame(
        JNIEnv* env, jobject clazz, jlong frameSequenceStateLong, jint frameNr,
        jobject bitmap, jint previousFrameNr) {
    FrameSequenceState* frameSequenceState =
            reinterpret_cast<FrameSequenceState*>(frameSequenceStateLong);
    int ret;
    AndroidBitmapInfo info;
    void* pixels;
    if ((ret = AndroidBitmap_getInfo(env, bitmap, &info)) < 0) {

        jniThrowException(env, ILLEGAL_STATE_EXEPTION,
                "Couldn't get info from Bitmap ");
        return 0;
    }

    if ((ret = AndroidBitmap_lockPixels(env, bitmap, &pixels)) < 0) {
        jniThrowException(env, ILLEGAL_STATE_EXEPTION,
                "Bitmap pixels couldn't be locked");
        return 0;
    }

    int pixelStride = info.stride >> 2;
    jlong delayMs = frameSequenceState->drawFrame(frameNr,
            (Color8888*) pixels, pixelStride, previousFrameNr);

    AndroidBitmap_unlockPixels(env, bitmap);
    return delayMs;
}
开发者ID:DARKPOP,项目名称:frameworks_ex,代码行数:28,代码来源:FrameSequenceJNI.cpp


示例10: Java_feipeng_andzop_render_RenderView_naRenderAFrame

/*fill in data for a bitmap*/
JNIEXPORT jint JNICALL Java_feipeng_andzop_render_RenderView_naRenderAFrame(JNIEnv * pEnv, jobject pObj, jobject pBitmap, int _width, int _height, float _roiSh, float _roiSw, float _roiEh, float _roiEw) {
    AndroidBitmapInfo lInfo;
    //void* lPixels;
    int lRet;
    int li, lj, lk;
    int lPos;
    unsigned char* ltmp;
    LOGI(3, "start of render_a_frame");    
    //1. retrieve information about the bitmap
    if ((lRet = AndroidBitmap_getInfo(pEnv, pBitmap, &lInfo)) < 0) {
        LOGE(1, "AndroidBitmap_getInfo failed! error = %d", lRet);
        return;
    }
    if (lInfo.format != ANDROID_BITMAP_FORMAT_RGBA_8888) {
        LOGE(1, "Bitmap format is not RGBA_8888!");
        return;
    }
    //2. lock the pixel buffer and retrieve a pointer to it
    if ((lRet = AndroidBitmap_lockPixels(pEnv, pBitmap, &gBitmap)) < 0) {
        LOGE(1, "AndroidBitmap_lockPixels() failed! error = %d", lRet);
    }
    //3. modify the pixel buffer
    //decode a video frame: the pBitmap will be filled with decoded pixels
    lRet = decode_a_frame(_width, _height, _roiSh, _roiSw, _roiEh, _roiEw);
    AndroidBitmap_unlockPixels(pEnv, pBitmap);
    LOGI(3, "~~~~~~~~~~end of rendering a frame~~~~~~~~~~~~~~~~~`");
    return lRet;
}
开发者ID:AbdunNurTomal,项目名称:AndZop,代码行数:29,代码来源:android_specific.c


示例11:

jobject Java_com_packpublishing_asynchronousandroid_chapter9_GrayImageLoader_convertImageToGray
        (JNIEnv *env, jobject obj, jobject bitmap) {

    AndroidBitmapInfo info;
    void *pixels;
    int ret;

    if ((ret = AndroidBitmap_getInfo(env, bitmap, &info)) < 0) {
        jclass clazz = env->FindClass("java/lang/RuntimeException");
        env->ThrowNew(clazz, "Failed to get Information from the Bitmap!");
        return 0;
    }

    if ((ret = AndroidBitmap_lockPixels(env, bitmap, (void **) &pixels)) < 0) {
        jclass clazz = env->FindClass("java/lang/RuntimeException");
        env->ThrowNew(clazz, "Failed to lock Bitmap pixels !");
        return 0;
    }

    rgba *rgba_pixels = (rgba *) pixels;

    for (int i = 0; i < (info.width * info.height); i++) {
        uint8_t red = rgba_pixels[i].red;
        uint8_t green = rgba_pixels[i].green;
        uint8_t blue = rgba_pixels[i].blue;
        uint8_t gray = red * 0.3 + green * 0.59 + blue * 0.11;
        rgba_pixels[i].red = gray;
        rgba_pixels[i].green = gray;
        rgba_pixels[i].blue = gray;
    }

    AndroidBitmap_unlockPixels(env, bitmap);

    return bitmap;
}
开发者ID:PacktPublishing,项目名称:Asynchronous-Android-Programming,代码行数:35,代码来源:image.cpp


示例12: stackBlur

JNIEXPORT void JNICALL Java_net_qiujuer_genius_app_BlurNative_fastBlurBitmap
(JNIEnv *env, jclass obj, jobject bitmapIn, jint r)
{
	AndroidBitmapInfo infoIn;
	void* pixelsIn;
	int ret;

	// Get image info
	if ((ret = AndroidBitmap_getInfo(env, bitmapIn, &infoIn)) < 0)
		return;
	// Check image
	if (infoIn.format != ANDROID_BITMAP_FORMAT_RGBA_8888)
		return;
	// Lock all images
	if ((ret = AndroidBitmap_lockPixels(env, bitmapIn, &pixelsIn)) < 0) {
		//AndroidBitmap_lockPixels failed!
	}
	// height width
	int h = infoIn.height;
	int w = infoIn.width;

	// Start
	pixelsIn = stackBlur((int*)pixelsIn, w, h, r);
	// End

	// Unlocks everything
	AndroidBitmap_unlockPixels(env, bitmapIn);
}
开发者ID:343829084,项目名称:Genius-Android,代码行数:28,代码来源:BlurNative.c


示例13: jni_freerdp_update_graphics

JNIEXPORT jboolean JNICALL jni_freerdp_update_graphics(
	JNIEnv *env, jclass cls, jint instance, jobject bitmap, jint x, jint y, jint width, jint height)
{

	int ret;
	void* pixels;
	AndroidBitmapInfo info;
	freerdp* inst = (freerdp*)instance;
	rdpGdi *gdi = inst->context->gdi;

	if ((ret = AndroidBitmap_getInfo(env, bitmap, &info)) < 0)
	{
		DEBUG_ANDROID("AndroidBitmap_getInfo() failed ! error=%d", ret);
		return JNI_FALSE;
	}

	if ((ret = AndroidBitmap_lockPixels(env, bitmap, &pixels)) < 0)
	{
		DEBUG_ANDROID("AndroidBitmap_lockPixels() failed ! error=%d", ret);
		return JNI_FALSE;
	}

	copy_pixel_buffer(pixels, gdi->primary_buffer, x, y, width, height, gdi->width, gdi->height, gdi->bytesPerPixel);

	AndroidBitmap_unlockPixels(env, bitmap);

	return JNI_TRUE;
}
开发者ID:bceverly,项目名称:FreeRDP,代码行数:28,代码来源:android_freerdp.c


示例14: Java_org_yabause_android_YabauseRunnable_stateSlotScreenshot

void
Java_org_yabause_android_YabauseRunnable_stateSlotScreenshot( JNIEnv* env, jobject obj, jobject dirpath, jobject itemnum, int slot, jobject bitmap )
{
    int outputwidth, outputheight;
    u32 * buffer, * cur;
    AndroidBitmapInfo info;
    void * pixels;
    int x, y;
    jboolean dummy;
    const char * dp = (*env)->GetStringUTFChars(env, dirpath, &dummy);
    const char * in = (*env)->GetStringUTFChars(env, itemnum, &dummy);

    if (0 != LoadStateSlotScreenshot(dp, in, slot, &outputwidth, &outputheight, &buffer)) return;

    AndroidBitmap_getInfo(env, bitmap, &info);

    AndroidBitmap_lockPixels(env, bitmap, &pixels);

    cur = buffer;
    for(y = 0;y < info.height;y++) {
        for(x = 0;x < info.width;x++) {
            *((uint32_t *) pixels + x) = *(cur + x);
        }
        pixels += info.stride;
        cur += outputwidth;
    }

    free(buffer);

    AndroidBitmap_unlockPixels(env, bitmap);
}
开发者ID:Amon-X,项目名称:yabause,代码行数:31,代码来源:yui.c


示例15: Java_jp_dego_sample_ipcv_MainActivity_getHairArea

JNIEXPORT void JNICALL Java_jp_dego_sample_ipcv_MainActivity_getHairArea(JNIEnv *env, jobject obj, jobject bmp,
        jint eyes_cp, jint eyes_w)
{
    AndroidBitmapInfo info;
    void* pixels;

    // Bitmapの情報を取得
    if (AndroidBitmap_getInfo(env, bmp, &info) < 0)
        return;
    // Bitmapのフォーマットをチェック
    if (info.format != ANDROID_BITMAP_FORMAT_RGBA_8888)
        return;
    // Bitmapをロック
    if (AndroidBitmap_lockPixels(env, bmp, &pixels) < 0)
        return;

    jint *p = pixels;
    int w = info.width;
    int h = info.height;

    // サンプルカラーの取得
    LAB *sc;
    sc = getSampleColor(p, w, h, (int)eyes_cp, (int)eyes_w);

    // 髪色強度マップの作成
    float *map;
    map = getHairIntensity(p, w, h, sc);

    int i, j;

    // Get Maximum and Minimum Value
    float max, min;
    max = *map;
    min = *map;
    for (i = 1; i < info.width * info.height; i++) {
        if (max < *(map + i))
            max = *(map + i);
        if (min > *(map + i))
            min = *(map + i);
    }
    // 256段階でグレースケール化
    unsigned char gray;
    int s;
    jint col;
    for (j = 0; j < info.height; j++) {
        for (i = 0; i < info.width; i++) {
            s = (int)((*(map + j * info.width + i) - (float)min) / ((float)max - min) * 255.0f);
            if (s > 255)
                gray = 255;
            else if (s < 1)
                gray = 0;
            else
                gray = (unsigned char)s;
            col = createColor(0xFF, gray, gray, gray);
            p[j * info.width + i] = col;
        }
    }

    free(map);
}
开发者ID:dego-96,项目名称:SampleIPCV,代码行数:60,代码来源:ipcv.c


示例16: Java_com_zspace_Android_updateBitmap

void Java_com_zspace_Android_updateBitmap(JNIEnv* env, jobject that, jobject bitmap, jlong data) {
    // timestamp: 122..305 microseconds mean=152. Contested lock up to 5800 mcs
//  timestamp("updateBitmap");
    void* buffer = ll2p(data);
    AndroidBitmapInfo info = {0};
    int r = AndroidBitmap_getInfo(env, bitmap, &info);
    if (r != 0) {
        trace("AndroidBitmap_getInfo() failed ! error=%d", r);
        return;
    }
    int width = info.width;
    int height = info.height;
    if (info.format != ANDROID_BITMAP_FORMAT_RGBA_8888 && info.format != ANDROID_BITMAP_FORMAT_A_8) {
        trace("Bitmap format is not RGBA_8888 or A_8");
        return;
    }
    void* pixels = null;
    r = AndroidBitmap_lockPixels(env, bitmap, &pixels);
    if (r != 0) {
        trace("AndroidBitmap_lockPixels() failed ! error=%d", r);
        return;
    }
    memcpy(pixels, buffer, width * height * (info.format == ANDROID_BITMAP_FORMAT_RGBA_8888 ? sizeof(int) : 1));
    AndroidBitmap_unlockPixels(env, bitmap);
//  timestamp("updateBitmap");
}
开发者ID:RahulSDeshpande,项目名称:android-tcc,代码行数:26,代码来源:zslib_jni.c


示例17: naPrepareDisplay

int naPrepareDisplay(JNIEnv *pEnv, jobject pObj, jobject pBitmap, jint width, jint height) {
	VideoState* vs = gvs;
	VideoDisplayUtil* vdu = av_mallocz(sizeof(VideoDisplayUtil));
	gvdu = vdu;
	vs->frame = avcodec_alloc_frame();
	vdu->frameNum = 0;
	vdu->width = width;
	vdu->height = height;
	vdu->pFrameRGBA = avcodec_alloc_frame();
	AndroidBitmapInfo linfo;
	int lret;
	//1. retrieve information about the bitmap
	if ((lret = AndroidBitmap_getInfo(pEnv, pBitmap, &linfo)) < 0) {
		LOGE(1, "AndroidBitmap_getinfo failed! error = %d", lret);
		return -1;
	}
	if (linfo.format != ANDROID_BITMAP_FORMAT_RGBA_8888) {
		LOGE(1, "bitmap format is not rgba_8888!");
		return- 1;
	}
	//2. lock the pixel buffer and retrieve a pointer to it
	if ((lret = AndroidBitmap_lockPixels(pEnv, pBitmap, &vdu->pBitmap)) < 0) {
		LOGE(1, "AndroidBitmap_lockpixels() failed! error = %d", lret);
		return -1;
	}
	//for android, we use the bitmap buffer as the buffer for pFrameRGBA
	avpicture_fill((AVPicture*)vdu->pFrameRGBA, vdu->pBitmap, PIX_FMT_RGBA, width, height);
	vdu->img_resample_ctx = sws_getContext(vs->pVideoStream->codec->width, vs->pVideoStream->codec->height, vs->pVideoStream->codec->pix_fmt, width, height, PIX_FMT_RGBA, SWS_BICUBIC, NULL, NULL, NULL);
	if (NULL == vdu->img_resample_ctx) {
		LOGE(1, "error initialize the video frame conversion context");
		return -1;
	}
	vs->nextFrameTime = av_gettime() + 50*1000;	//introduce 50 milliseconds of initial delay
	return 0;
}
开发者ID:GitNooby,项目名称:notes,代码行数:35,代码来源:framegrabber.c


示例18: Java_app_ssm_duck_duckapp_CropActivity_seperateLetter

JNIEXPORT void JNICALL Java_app_ssm_duck_duckapp_CropActivity_seperateLetter(JNIEnv *env, jobject obj, jobject bitmap) {
    AndroidBitmapInfo info;
    void* pixels;

    //get information for bitmap object
    if(0>AndroidBitmap_getInfo(env, bitmap,&info)){
        LOGE("AndroidBitmap_getInfo() failed!");
        return;
    }

    LOGI("imagesize(%d,%d)\n",info.width,info.height);

    if(info.format != ANDROID_BITMAP_FORMAT_RGB_565){
        LOGE("Bitmap format is not RGB_565:%d\n",info.format);
        //return;
    }

    //attemp to lock the pixel address.
    if(0> AndroidBitmap_lockPixels(env,bitmap,&pixels)){
        LOGE("AndroidBitmap_lockPixels() failed!");
        return;
    }

    //함수

    AndroidBitmap_unlockPixels(env,bitmap);

}
开发者ID:DuckYoo,项目名称:SSMemo,代码行数:28,代码来源:letterConvert.cpp


示例19: Java_makemachine_android_examples_Nati_getrot

JNIEXPORT void JNICALL Java_makemachine_android_examples_Nati_getrot(JNIEnv * env, jclass klass, jobject bitmap){
    int ret,j;
      uint32_t * pixels;
      void * raw;
      AndroidBitmapInfo  info;
      if ((ret = AndroidBitmap_getInfo(env, bitmap, &info)) < 0) return;
      if ((ret = AndroidBitmap_lockPixels(env, bitmap, &raw)) < 0) return;
      pixels=(uint32_t*)raw;
       for(j=0;j<info.height*info.width;j++){
          *(pixels+j)=*(Qwe::image+j);
      }
     int h,w,oH,oW,nW;
     oH=info.width;
     oW=info.height;
     nW=info.width;
      for(w=0;w<oW;w++){
	      for(h=0;h<oH;h++){
		      *(pixels+nW-h-1+nW*w)=*(Qwe::image+oW*h+w);
	      }
      }
      AndroidBitmap_unlockPixels(env, bitmap);
      free(Qwe::image);
      free(Qwe::integral);
      free(Qwe::mean);
      free(Qwe::dev);
#ifdef USE_DEVIATION
      free(Qwe::intsquare);
#endif
}
开发者ID:arpheno,项目名称:receiptKeeper,代码行数:29,代码来源:test.cpp


示例20: Java_com_example_nativebitmap_MainActivity_sepiaImage

void Java_com_example_nativebitmap_MainActivity_sepiaImage(JNIEnv* env,
                                                           jobject thiz,
                                                           jobject bitmap) {
  // 画像情報を取得
  AndroidBitmapInfo info;
  if (0 > AndroidBitmap_getInfo(env, bitmap, &info)) { /////-----(2)
    LOGE("AndroidBitmap_getInfo() failed !");
    return;
  }
  LOGI("imagesize(%d,%d)\n", info.width, info.height);
  // 指定フォーマット以外は処理を中断
  if (!(info.format == ANDROID_BITMAP_FORMAT_RGBA_8888 || info.format == ANDROID_BITMAP_FORMAT_RGB_565)){ /////-----(3)
    LOGE("Can't convert : format=%s",format_msg[info.format]);
    return;
  }
  LOGI("ImageFormat=%s",format_msg[info.format]);

  // 他からのBITMAPへのアクセスを排除する
  void* pixels;
  if (0 > AndroidBitmap_lockPixels(env, bitmap, &pixels)) { /////-----(4)
    LOGE("AndroidBitmap_lockPixels() failed !");
    return;
  }
  // セピア調に変換する
  switch(info.format){   /////-----(5)
  case ANDROID_BITMAP_FORMAT_RGBA_8888:
    convert_to_sepia_rgba8888(&info, pixels);
    break;
  case ANDROID_BITMAP_FORMAT_RGB_565:
    convert_to_sepia_rgb565(&info, pixels);
    break;
  }
  // 他からのBITMAPへのアクセスを許可する
  AndroidBitmap_unlockPixels(env, bitmap); /////-----(6)
}
开发者ID:demuyan,项目名称:NDKBook_2nd,代码行数:35,代码来源:nativebitmap.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ AndroidBitmap_lockPixels函数代码示例发布时间:2022-05-30
下一篇:
C++ Analyze函数代码示例发布时间: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