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


C++ write_image函数代码示例

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


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

示例1: unpack_krnl

static void
unpack_krnl(const char *path, uint8_t *buf, uint32_t size)
{
	uint32_t ksize;
	char rpath[PATH_MAX];

	ksize = buf[4] | buf[5] << 8 | buf[6] << 16 | buf[7] << 24;
	buf += 8;
	size -= 8;

	if ((ksize + 4) > size)
		fprintf(stderr, "invalid file size (should be %u bytes)\n",
		    ksize);

	snprintf(rpath, sizeof(rpath), "%s-raw", path);
	write_image(rpath, buf, ksize);

	buf += ksize + 4;
	size -= ksize + 4;

	if (size > 0) {
		snprintf(rpath, sizeof(rpath), "%s-symbol", path);
		write_image(rpath, buf, size);
	}
}
开发者ID:jaretcantu,项目名称:rkutils,代码行数:25,代码来源:rkunpack.c

示例2: assert

bool Frame::write(const char* file_path) const
{
    assert(file_path);

    const ImageAttributes image_attributes =
        ImageAttributes::create_default_attributes();

    bool result = write_image(file_path, *impl->m_image, image_attributes);

    if (!impl->m_aov_images->empty())
    {
        const filesystem::path boost_file_path(file_path);
        const filesystem::path directory = boost_file_path.branch_path();
        const string base_file_name = boost_file_path.stem();
        const string extension = boost_file_path.extension();

        for (size_t i = 0; i < impl->m_aov_images->size(); ++i)
        {
            const string aov_file_name =
                base_file_name + "." + impl->m_aov_images->get_name(i) + extension;
            const string aov_file_path = (directory / aov_file_name).string();

            if (!write_image(
                    aov_file_path.c_str(),
                    impl->m_aov_images->get_image(i),
                    image_attributes))
                result = false;
        }
    }

    return result;
}
开发者ID:tomcodes,项目名称:appleseed,代码行数:32,代码来源:frame.cpp

示例3: nemo_main

nemo_main()
{
    real frame[N][N];
    image f1;
    imageptr fp1, fp2;	/* or image *fp1 */
    stream instr,outstr;

    if (strcmp(getparam("mode"),"w")==0) {		/* write test */
	printf ("WRITING test (mode=w) foo.dat\n");
	outstr = stropen ("foo.dat","w");

	f1.frame = &frame[0][0];  /* compiler complained when = frame used ???? */
				  /* would be same as fp2->frame = ... */
	fp1 = &f1;		  /* to initialize structures, we need pointer to them */
	ini_matrix (&fp1,N,N);    /* ini_matrix MUST have pointer to pointer to image */
	
	fp2 = NULL;		  /* This is to check dynamic allocation of whole thing */
	ini_matrix (&fp2,N,N);

	write_image (outstr,fp2);
	write_image (outstr,&f1);		/* or fp1 */
	strclose(outstr);
	exit(0);
    } else {
	printf ("READING test (mode<>w) foo.dat\n");
	fp2=NULL;					/* read test */
	instr = stropen ("foo.dat","r");
	while (read_image(instr,&fp2)) {
            printf ("Read image\n");
            printf ("with MapValue(5,5)=%f\n",MapValue(fp2,5,5));
	}
	strclose(instr);
    }
}
开发者ID:jobovy,项目名称:nemo,代码行数:34,代码来源:image.c

示例4: write_image

bool
ImageOutputWrap::write_image_bt (TypeDesc::BASETYPE format, object &data,
                                 stride_t xstride, stride_t ystride,
                                 stride_t zstride)
{
    return write_image (format, data, xstride, ystride, zstride);
}
开发者ID:Chifoncake,项目名称:oiio,代码行数:7,代码来源:py_imageoutput.cpp

示例5: ffs_make_fsys_2

unsigned
ffs_make_fsys_2(FILE *dst_fp, struct file_entry *list, char *mountpoint, char *destname) {
	struct tree_entry	*trp;
	ffs_sort_t			*sort;

	if(mountpoint == NULL) mountpoint = "";

	//
	//	If target endian is unknown, set to little endian
	//

	if (target_endian == -1)
		target_endian = 0;
	
	//
	//	Make sure block size is defined and reasonable (at least 1K)
	//

	if (block_size < 1024)
		mk_flash_exit("Error: block_size not defined or incorrectly defined (>1K), exiting ...\n");

	trp = make_tree(list);

	sort = ffs_entries(trp, mountpoint);

	write_f3s(sort, block_size);

	write_image(dst_fp);

	return 0;
}
开发者ID:vocho,项目名称:openqnx,代码行数:31,代码来源:mk_flash_fsys.c

示例6: main

int main(int argc, char *argv[]) {
    rrimage *data = read_image_with_compress_by_area("/Users/robert/Pictures/square.gif", compress_strategy, 960, 0, 0, 300, 300, ROTATE_90);
    printf("width = %d, height = %d, channels = %d\n", data->width, data->height, data->channels);
    printf("write result is: %d\n", write_image("/Users/robert/Desktop/out.jpg", data));

    return 0;
}
开发者ID:Tinker-S,项目名称:libnsgifdemo,代码行数:7,代码来源:main.c

示例7: assert

bool Frame::archive(
    const char*         directory,
    char**              output_path) const
{
    assert(directory);

    // Construct the name of the image file.
    const string filename =
        "autosave." + get_time_stamp_string() + ".exr";

    // Construct the path to the image file.
    const string file_path = (filesystem::path(directory) / filename).string();

    // Return the path to the image file.
    if (output_path)
        *output_path = duplicate_string(file_path.c_str());

    Image transformed_image(*impl->m_image);
    transform_to_output_color_space(transformed_image);

    return
        write_image(
            file_path.c_str(),
            transformed_image,
            ImageAttributes::create_default_attributes());
}
开发者ID:camargo,项目名称:appleseed,代码行数:26,代码来源:frame.cpp

示例8: nemo_main

void nemo_main()
{
  stream  outstr;
  int     nx, ny, nz;  
  int     ix, iy, iz;
  imageptr optr=NULL;        /* pointer to image, needs to be NULL to force new */
  real    tmp, sum = 0.0;

  outstr = stropen(getparam("out"), "w");

  nx = getiparam("nx");
  ny = getiparam("ny");
  nz = getiparam("nz");

  dprintf(0,"Creating image cube (size : %d x %d x %d)\n",nx,ny,nz);

  create_cube(&optr,nx,ny,nz);

  for (iz=0; iz<nz; iz++) {
    for (iy=0; iy<ny; iy++) {
      for (ix=0; ix<nx/2; ix++) {
        CubeValue(optr,ix,iy,iz) = 0.0;
      }
    }
  }

  write_image(outstr, optr);



}
开发者ID:Milkyway-at-home,项目名称:nemo,代码行数:31,代码来源:ccdwrite.c

示例9: nemo_main

void nemo_main ()
{
    setparams();			/* set par's in globals */

    instr = stropen (infile, "r");
    read_image (instr,&iptr);
				/* set some global paramters */
    nx = Nx(iptr);	
    ny = Ny(iptr);
    nz = Nz(iptr);
    xmin = Xmin(iptr);
    ymin = Ymin(iptr);
    zmin = Zmin(iptr);
    dx = Dx(iptr);
    dy = Dy(iptr);
    dz = Dz(iptr);

    if(hasvalue("gauss"))
        make_gauss_beam(getparam("dir"));

    outstr = stropen (outfile,"w");
    if (hasvalue("wiener"))
      wiener();
    else
      smooth_it();
    write_image (outstr,iptr);

    strclose(instr);
    strclose(outstr);
}
开发者ID:jobovy,项目名称:nemo,代码行数:30,代码来源:ccdsmooth.c

示例10: unpack_android

static void
unpack_android(const char *path, uint8_t *buf, uint32_t size)
{
	uint32_t pgsz, i, iof_pos, isz_pos, ioff, isize, iload;
	char rpath[PATH_MAX];
	char* images[] = { "kernel", "ramdisk", "second" };
	const int num_images = sizeof(images)/sizeof(images[0]);

	printf("\nunpacking Android images\n");

	pgsz = buf[36] | buf[37] << 8 | buf[38] << 16 | buf[39] << 24;

	ioff = pgsz; /* running page offset */
	for (i=0; i<num_images; i++) {
		isz_pos = 8 + 8*i;
		iof_pos = 12 + 8*i;
		isize = (((buf[isz_pos] | buf[isz_pos+1] << 8 |
			   buf[isz_pos+2] << 16 | buf[isz_pos+3] << 24)
			+ pgsz-1) / pgsz) * pgsz;
		iload = (((buf[iof_pos] | buf[iof_pos+1] << 8 |
			   buf[iof_pos+2] << 16 | buf[iof_pos+3] << 24)
			+ pgsz-1) / pgsz) * pgsz;

		snprintf(rpath, sizeof(rpath), "%s-%s.img", path, images[i]);
		printf("%08x-%08x/%08x-%08x %s %d bytes\n",
			iload, iload + isize - 1,
			ioff, ioff + isize - 1,
			rpath, isize);
		write_image(rpath, &buf[ioff], isize);

		ioff += isize;
	}
}
开发者ID:jaretcantu,项目名称:rkutils,代码行数:33,代码来源:rkunpack.c

示例11: main

int main(int argc, char**argv){
	char * evar = getenv("RELY_SRAND_DATA");
	if(evar != NULL) srand(atoi(evar));
	else srand(0);
	
	if(argc <= 3){
		printf("USAGE: scale FACTOR INPUT OUTPUT\n");
		return 1;
	}
	inst_timer GLOBAL_TIMER = create_timer();
	start_timer(&GLOBAL_TIMER);
	double scale_factor = atof(argv[1]);
	char* in_filename = argv[2];
	char * out_filename = argv[3];
	printf("scale by %f: %s -> %s\n", scale_factor, in_filename, out_filename);

    int* src, * transformed;

	size_t sw, sh, dw, dh;
	printf("read from \"%s\" ...\n", in_filename);
	src = read_image(in_filename, &sw, &sh);
	if(src == NULL){
		fprintf(stderr, ">> Failed to read image %s\n", in_filename);
		exit(1);
	}
	transformed = allocate_transform_image(scale_factor, sw, sh, &dw, &dh);
	scale(scale_factor, src, sw, sh, transformed, dw, dh);
	printf("write to \"%s\" ...\n", out_filename);
	write_image(out_filename, transformed, dw, dh);
	free((void *) src);
	free((void *) transformed);
	end_timer(&GLOBAL_TIMER);
	printf("GLOBAL TIME\n");
	print_timer(&GLOBAL_TIMER);
}
开发者ID:sarachour,项目名称:topaz,代码行数:35,代码来源:main-instr.cpp

示例12: unpack_rkfw

static void
unpack_rkfw(const char *path, uint8_t *buf, uint32_t size)
{
	uint32_t ioff, isize;
	char rpath[PATH_MAX];

	printf("VERSION:%d.%d.%d\n", buf[8], buf[7], buf[6]);
	printf("\nunpacking\n");

	ioff = 0;
	isize = buf[4];
	snprintf(rpath, sizeof(rpath), "%s-HEAD", path);
	printf("%08x-%08x %s %d bytes\n", ioff, ioff + isize - 1, rpath, isize);
	write_image(rpath, &buf[ioff], isize);

	ioff = buf[0x19] | buf[0x1a] << 8 | buf[0x1b] << 16 | buf[0x1c] << 24;
	isize = buf[0x1d] | buf[0x1e] << 8 | buf[0x1f] << 16 | buf[0x20] << 24;

	if (memcmp(&buf[ioff], "BOOT", 4) != 0)
		errx(EXIT_FAILURE, "no BOOT signature");

	snprintf(rpath, sizeof(rpath), "%s-BOOT", path);
	printf("%08x-%08x %s %d bytes\n", ioff, ioff + isize - 1, rpath, isize);
	write_image(rpath, &buf[ioff], isize);

	ioff = buf[0x21] | buf[0x22] << 8 | buf[0x23] << 16 | buf[0x24] << 24;
	isize = buf[0x25] | buf[0x26] << 8 | buf[0x27] << 16 | buf[0x28] << 24;

	if (memcmp(&buf[ioff], "RKAF", 4) != 0)
		errx(EXIT_FAILURE, "no RKAF signature");

	printf("%08x-%08x update.img %d bytes\n", ioff, ioff + isize - 1,
	    isize);
	write_image("update.img", &buf[ioff], isize);

	printf("\nunpacking update.img\n");
	printf("================================================================================\n");
	unpack_rkaf("update.img", &buf[ioff], isize);
	printf("================================================================================\n\n");

	if (size - (ioff + isize) != 32)
		errx(EXIT_FAILURE, "invalid MD5 length");

	snprintf(rpath, sizeof(rpath), "%s-MD5", path);
	printf("%08x-%08x %s 32 bytes\n", ioff, ioff + isize - 1, rpath);
	write_image(rpath, &buf[ioff + isize], 32);
}
开发者ID:jaretcantu,项目名称:rkutils,代码行数:47,代码来源:rkunpack.c

示例13: PNG_Graph_close

/*!
  \brief Close down the graphics processing. This gets called only at driver
         termination time.
*/
void PNG_Graph_close(void)
{
    write_image();

    if (png.mapped)
	unmap_file();
    else
	G_free(png.grid);
}
开发者ID:caomw,项目名称:grass,代码行数:13,代码来源:Graph_close.c

示例14: main

int
main(int argc, char* argv[])
{
    image* im = read_image(INPUT);
    gaussian_blur(im, SIGMA);
    write_image(OUTPUT, im);
    free_image(im);
    return 0;
}
开发者ID:NatTuck,项目名称:cakemark,代码行数:9,代码来源:ref_blur.c

示例15: main

int main(int argc, char *argv[])
{
    static const struct option long_options[] = {
        { "help",        0, 0, 'h' },
        { "version",     0, 0, 'V' },
        { NULL,          0, 0, 0 },
    };
    const char *filename;
    int ch;

    printf("SD image writer, Version %s\n", VERSION);
    progname = argv[0];
    setvbuf(stdout, NULL, _IOLBF, 0);
    setvbuf(stderr, NULL, _IOLBF, 0);
    signal(SIGINT, interrupted);
#ifdef __linux__
    signal(SIGHUP, interrupted);
#endif
    signal(SIGTERM, interrupted);

    while ((ch = getopt_long(argc, argv, "vd:DhV", long_options, 0)) != -1)
    {
        switch (ch) {
        case 'v':
            ++verify_only;
            continue;
        case 'd':
            device_name = optarg;
            continue;
        case 'D':
            ++debug_level;
            continue;
        case 'h':
            break;
        case 'V':
            /* Version already printed above. */
            return 0;
        }
        usage();
    }
    argc -= optind;
    argv += optind;
    if (argc != 1)
        usage();
    filename = argv[0];

    printf("%s\n", copyright);

    if (! device_name)
        device_name = ask_device();

    write_image(filename, device_name, verify_only);

    quit(1);
    return 0;
}
开发者ID:aszhokhin,项目名称:sdwriter,代码行数:56,代码来源:sdwriter.c


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