当前位置: 首页>>代码示例>>C++>>正文


C++ LibRaw::dcraw_make_mem_thumb方法代码示例

本文整理汇总了C++中LibRaw::dcraw_make_mem_thumb方法的典型用法代码示例。如果您正苦于以下问题:C++ LibRaw::dcraw_make_mem_thumb方法的具体用法?C++ LibRaw::dcraw_make_mem_thumb怎么用?C++ LibRaw::dcraw_make_mem_thumb使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LibRaw的用法示例。


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

示例1:

 libraw_processed_image_t *libraw_dcraw_make_mem_thumb(libraw_data_t* lr,int *errc)
 {
     if(!lr) { if(errc) *errc=EINVAL; return NULL;}
     LibRaw *ip = (LibRaw*) lr->parent_class;
     return ip->dcraw_make_mem_thumb(errc);
 }
开发者ID:2php,项目名称:ogre-android,代码行数:6,代码来源:libraw_c_api.cpp

示例2: if


//.........这里部分代码省略.........
	{
		goto end;
	}

	DEBUG_INFO if ((ret = RawProcessor->unpack_thumb()) != LIBRAW_SUCCESS)
	{
		goto end;
	}

	DEBUG_INFO imageDescription = env->NewObject(imageDescription_class, imageDescription_init);

	// Setting fields
	printf("[Native] flip = %d\n", RawProcessor->imgdata.sizes.flip);
	DEBUG_INFO env->SetIntField(imageDescription, flip_id, RawProcessor->imgdata.sizes.flip);	// 0 - no rotation; 3 - 180-deg rotation; 5 - 90-deg counterclockwise, 6 - 90-deg clockwise
	printf("[Native] iso speed = %f\n", RawProcessor->imgdata.other.iso_speed);
	env->SetFloatField(imageDescription, isoSpeed_id, RawProcessor->imgdata.other.iso_speed);
	printf("[Native] shutter = %f\n", RawProcessor->imgdata.other.shutter);
	env->SetFloatField(imageDescription, shutter_id, RawProcessor->imgdata.other.shutter);
	printf("[Native] aperture = %f\n", RawProcessor->imgdata.other.aperture);
	env->SetFloatField(imageDescription, aperture_id, RawProcessor->imgdata.other.aperture);
	printf("[Native] focal length = %f\n", RawProcessor->imgdata.other.focal_len);
	env->SetFloatField(imageDescription, focalLength_id, RawProcessor->imgdata.other.focal_len);
	printf("[Native] shot order = %d\n", RawProcessor->imgdata.other.shot_order);
	env->SetIntField(imageDescription, shotOrder_id, RawProcessor->imgdata.other.shot_order);

	DEBUG_INFO time_con = RawProcessor->imgdata.other.timestamp;
	printf("[Native] timestamp = %d\n", time_con);
	//timestamp = env->NewObject(date_class, date_init, time_con);
	//env->SetObjectField(imageDescription, timeStamp_id, timestamp);
	DEBUG_INFO env->SetLongField(imageDescription, timeStamp_id, time_con);


	printf("[Native] description = %s\n", RawProcessor->imgdata.other.desc);
	env->SetObjectField(imageDescription, description_id, env->NewStringUTF(RawProcessor->imgdata.other.desc));
	printf("[Native] artist = %s\n", RawProcessor->imgdata.other.artist);
	env->SetObjectField(imageDescription, artist_id, env->NewStringUTF(RawProcessor->imgdata.other.artist));
	printf("[Native] camera maker = %s\n", RawProcessor->imgdata.idata.make);
	env->SetObjectField(imageDescription, cameraMaker_id, env->NewStringUTF(RawProcessor->imgdata.idata.make));
	printf("[Native] camera model = %s\n", RawProcessor->imgdata.idata.model);
	env->SetObjectField(imageDescription, cameraModel_id, env->NewStringUTF(RawProcessor->imgdata.idata.model));

	DEBUG_INFO
	fflush(stdout);

	DEBUG_INFO previewBitmap = env->NewObject(previewBitmap_class, previewBitmap_init);

	// Getting bitmap field ids
	jfieldID r_id, g_id, b_id, width_id, height_id;
	r_id = env->GetFieldID(previewBitmap_class, "r", "J");
	g_id = env->GetFieldID(previewBitmap_class, "g", "J");
	b_id = env->GetFieldID(previewBitmap_class, "b", "J");
	width_id = env->GetFieldID(previewBitmap_class, "width", "I");
	height_id = env->GetFieldID(previewBitmap_class, "height", "I");

	PreviewBitmap thumb;

	// Extracting and saving the thumbnail picture

	DEBUG_INFO image = RawProcessor->dcraw_make_mem_thumb(&ret);
	if (image == 0)
	{
		goto end;
	}

	printf("[Native] Image type: %s\n", (image->type == LIBRAW_IMAGE_JPEG) ? "jpeg" : "bitmap");

	if (image->type == LIBRAW_IMAGE_JPEG)
	{
		decode_jpeg(thumb, image->data, image->data_size);
	}
	else
	{
		decode_plain(thumb, image->width, image->height, image->data, image->data_size);
	}
	DEBUG_INFO
	// Setting field values
	env->SetIntField(previewBitmap, width_id, thumb.width);
	env->SetIntField(previewBitmap, height_id, thumb.height);
	env->SetLongField(previewBitmap, r_id, (jlong)(thumb.r));
	env->SetLongField(previewBitmap, g_id, (jlong)(thumb.g));
	env->SetLongField(previewBitmap, b_id, (jlong)(thumb.b));

	env->SetObjectField(imageDescription, thumbnail_id, previewBitmap);

	DEBUG_INFO

	RawProcessor->recycle();   // just for show this call...
	                           // use it if you want to load something else


end:
	DEBUG_INFO if (image != NULL) LibRaw::dcraw_clear_mem(image);
	DEBUG_INFO if (RawProcessor != NULL) delete RawProcessor;
	DEBUG_INFO env->ReleaseStringUTFChars(filename, fn);
	DEBUG_INFO if (ret != LIBRAW_SUCCESS)
	{
		DEBUG_INFO throw_libraw_exception(env, ret);
	}
	DEBUG_INFO return imageDescription;
}
开发者ID:bigfatbrowncat,项目名称:CatEyeB,代码行数:101,代码来源:RawImageLoader.cpp

示例3: main

int main(int ac, char *av[])
{
    int  i, ret, output_thumbs=0;

    // don't use fixed size buffers in real apps!

    LibRaw RawProcessor;
    
    if(ac<2) 
        {
            printf(
                "mem_image - LibRaw sample, to illustrate work for memory buffers. Emulates dcraw [-4] [-1] [-e] [-h]\n"
                "Usage: %s [-D] [-T] [-v] [-e] raw-files....\n"
                "\t-6 - output 16-bit PPM\n"
                "\t-4 - linear 16-bit data\n"
                "\t-e - extract thumbnails (same as dcraw -e in separate run)\n",
                "\t-h - use half_size\n");
            return 0;
        }

    putenv ((char*)"TZ=UTC"); // dcraw compatibility, affects TIFF datestamp field
    
#define P1 RawProcessor.imgdata.idata
#define S RawProcessor.imgdata.sizes
#define C RawProcessor.imgdata.color
#define T RawProcessor.imgdata.thumbnail
#define P2 RawProcessor.imgdata.other
#define OUT RawProcessor.imgdata.params


    for (i=1;i<ac;i++)
        {
            if(av[i][0]=='-')
                {
                    if(av[i][1]=='6' && av[i][2]==0)
                        OUT.output_bps = 16;
                    if(av[i][1]=='4' && av[i][2]==0)
                        {
                            OUT.output_bps = 16;
                            OUT.gamm[0] = OUT.gamm[1] =  OUT.no_auto_bright    = 1;
                        }
                    if(av[i][1]=='e' && av[i][2]==0)
                        output_thumbs++;
                    if(av[i][1]=='h' && av[i][2]==0)
                        OUT.half_size=1;
                    continue;
                }
            printf("Processing %s\n",av[i]);
            if( (ret = RawProcessor.open_file(av[i])) != LIBRAW_SUCCESS)
                {
                    fprintf(stderr,"Cannot open %s: %s\n",av[i],libraw_strerror(ret));
                    continue; // no recycle b/c open file will recycle itself
                }
            
            if( (ret = RawProcessor.unpack() ) != LIBRAW_SUCCESS)
                {
                    fprintf(stderr,"Cannot unpack %s: %s\n",av[i],libraw_strerror(ret));
                    continue;
                }

            // we should call dcraw_process before thumbnail extraction because for
            // some cameras (i.e. Kodak ones) white balance for thumbnal should be set
            // from main image settings


            ret = RawProcessor.dcraw_process();
                
            if(LIBRAW_SUCCESS !=ret)
                {
                    fprintf(stderr,"Cannot do postpocessing on %s: %s\n",
                            av[i],libraw_strerror(ret));
                    if(LIBRAW_FATAL_ERROR(ret))
                        continue; 
                }
            libraw_processed_image_t *image = RawProcessor.dcraw_make_mem_image(&ret);
            if(image)
                {
                    write_ppm(image,av[i]);
                    LibRaw::dcraw_clear_mem(image);
                }
            else
                fprintf(stderr,"Cannot unpack %s to memory buffer: %s\n" , av[i],libraw_strerror(ret));

            if(output_thumbs)
                {

                    if( (ret = RawProcessor.unpack_thumb() ) != LIBRAW_SUCCESS)
                        {
                            fprintf(stderr,"Cannot unpack_thumb %s: %s\n",av[i],libraw_strerror(ret));
                            if(LIBRAW_FATAL_ERROR(ret))
                                continue; // skip to next file
                        }
                    else
                        {
                            libraw_processed_image_t *thumb = RawProcessor.dcraw_make_mem_thumb(&ret);
                            if(thumb)
                                {
                                    write_thumb(thumb,av[i]);
                                    LibRaw::dcraw_clear_mem(thumb);
                                }
//.........这里部分代码省略.........
开发者ID:KingBing,项目名称:LibRaw,代码行数:101,代码来源:mem_image.cpp


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