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


C++ ImFileType类代码示例

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


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

示例1: sizeof

ImBuf *IMB_ibImageFromMemory(unsigned char *mem, size_t size, int flags, char colorspace[IM_MAX_SPACE], const char *descr)
{
	ImBuf *ibuf;
	ImFileType *type;
	char effective_colorspace[IM_MAX_SPACE] = "";

	if (mem == NULL) {
		fprintf(stderr, "%s: NULL pointer\n", __func__);
		return NULL;
	}

	if (colorspace)
		BLI_strncpy(effective_colorspace, colorspace, sizeof(effective_colorspace));

	for (type = IMB_FILE_TYPES; type < IMB_FILE_TYPES_LAST; type++) {
		if (type->load) {
			ibuf = type->load(mem, size, flags, effective_colorspace);
			if (ibuf) {
				imb_handle_alpha(ibuf, flags, colorspace, effective_colorspace);
				return ibuf;
			}
		}
	}

	if ((flags & IB_test) == 0)
		fprintf(stderr, "%s: unknown fileformat (%s)\n", __func__, descr);

	return NULL;
}
开发者ID:,项目名称:,代码行数:29,代码来源:

示例2: IMB_saveiff

short IMB_saveiff(struct ImBuf *ibuf, const char *name, int flags)
{
	ImFileType *type;

	if (ibuf == NULL) return (false);
	ibuf->flags = flags;

	for (type = IMB_FILE_TYPES; type < IMB_FILE_TYPES_LAST; type++) {
		if (type->save && type->ftype(type, ibuf)) {
			ImBuf *write_ibuf;
			short result = false;

			write_ibuf = prepare_write_imbuf(type, ibuf);

			result = type->save(write_ibuf, name, flags);

			if (write_ibuf != ibuf)
				IMB_freeImBuf(write_ibuf);

			return result;
		}
	}

	fprintf(stderr, "Couldn't save picture.\n");

	return false;
}
开发者ID:akonneker,项目名称:blensor,代码行数:27,代码来源:writeimage.c

示例3:

ImBuf *IMB_ibImageFromMemory(unsigned char *mem, size_t size, int flags)
{
	ImBuf *ibuf;
	ImFileType *type;

	if(mem == NULL) {
		printf("Error in ibImageFromMemory: NULL pointer\n");
		return NULL;
	}

	for(type=IMB_FILE_TYPES; type->is_a; type++) {
		if(type->load) {
			ibuf= type->load(mem, size, flags);
			if(ibuf) {
				if(flags & IB_premul) {
					IMB_premultiply_alpha(ibuf);
					ibuf->flags |= IB_premul;
				}

				return ibuf;
			}
		}
	}

	fprintf(stderr, "Unknown fileformat\n");
	
	return NULL;
}
开发者ID:BHCLL,项目名称:blendocv,代码行数:28,代码来源:readimage.c

示例4: IMB_ispic_name

static int IMB_ispic_name(const char *name)
{
	ImFileType *type;
	struct stat st;
	int fp, buf[10];

	if(UTIL_DEBUG) printf("IMB_ispic_name: loading %s\n", name);
	
	if(stat(name,&st) == -1)
		return FALSE;
	if(((st.st_mode) & S_IFMT) != S_IFREG)
		return FALSE;

	if((fp = open(name,O_BINARY|O_RDONLY)) < 0)
		return FALSE;

	if(read(fp, buf, 32) != 32) {
		close(fp);
		return FALSE;
	}

	close(fp);

	/* XXX move this exception */
	if((BIG_LONG(buf[0]) & 0xfffffff0) == 0xffd8ffe0)
		return JPG;

	for(type=IMB_FILE_TYPES; type->is_a; type++)
		if(type->is_a((uchar*)buf))
			return type->filetype;

	return FALSE;
}
开发者ID:,项目名称:,代码行数:33,代码来源:

示例5: imb_filetypes_init

void imb_filetypes_init(void)
{
	ImFileType *type;

	for(type=IMB_FILE_TYPES; type->is_a; type++)
		if(type->init)
			type->init();
}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例6: imb_filetypes_init

void imb_filetypes_init(void)
{
	ImFileType *type;

	for (type = IMB_FILE_TYPES; type < IMB_FILE_TYPES_LAST; type++)
		if (type->init)
			type->init();

#ifdef WITH_QUICKTIME
	quicktime_init();
#endif
}
开发者ID:SuriyaaKudoIsc,项目名称:blender-git,代码行数:12,代码来源:filetype.c

示例7: IMB_ispic

int IMB_ispic(const char *name)
{
	/* increased from 32 to 64 because of the bitmaps header size */
#define HEADER_SIZE 64

	unsigned char buf[HEADER_SIZE];
	ImFileType *type;
	struct stat st;
	int fp;

	if (UTIL_DEBUG) printf("IMB_ispic_name: loading %s\n", name);
	
	if (BLI_stat(name, &st) == -1)
		return FALSE;
	if (((st.st_mode) & S_IFMT) != S_IFREG)
		return FALSE;

	if ((fp = BLI_open(name, O_BINARY | O_RDONLY, 0)) < 0)
		return FALSE;

	memset(buf, 0, sizeof(buf));
	if (read(fp, buf, HEADER_SIZE) <= 0) {
		close(fp);
		return FALSE;
	}

	close(fp);

	/* XXX move this exception */
	if ((BIG_LONG(((int *)buf)[0]) & 0xfffffff0) == 0xffd8ffe0)
		return JPG;

	for (type = IMB_FILE_TYPES; type < IMB_FILE_TYPES_LAST; type++) {
		if (type->is_a) {
			if (type->is_a(buf)) {
				return type->filetype;
			}
		}
		else if (type->is_a_filepath) {
			if (type->is_a_filepath(name)) {
				return type->filetype;
			}
		}
	}

	return FALSE;

#undef HEADER_SIZE
}
开发者ID:,项目名称:,代码行数:49,代码来源:

示例8: IMB_saveiff

short IMB_saveiff(struct ImBuf *ibuf, const char *name, int flags)
{
	ImFileType *type;

	if(ibuf == NULL) return (FALSE);
	ibuf->flags = flags;

	for(type=IMB_FILE_TYPES; type->is_a; type++) {
		if(type->save && type->ftype(type, ibuf)) {
			if(!(type->flag & IM_FTYPE_FLOAT)) {
				if(ibuf->rect==NULL && ibuf->rect_float)
					IMB_rect_from_float(ibuf);
			}
			return type->save(ibuf, name, flags);
		}
	}

	fprintf(stderr, "Couldn't save picture.\n");

	return FALSE;
}
开发者ID:,项目名称:,代码行数:21,代码来源:

示例9: imb_loadtilefile

static void imb_loadtilefile(ImBuf *ibuf, int file, int tx, int ty, unsigned int *rect)
{
	ImFileType *type;
	unsigned char *mem;
	size_t size;

	if (file == -1) return;

	size = BLI_file_descriptor_size(file);

	mem = mmap(NULL, size, PROT_READ, MAP_SHARED, file, 0);
	if (mem == (unsigned char *) -1) {
		fprintf(stderr, "Couldn't get memory mapping for %s\n", ibuf->cachename);
		return;
	}

	for (type = IMB_FILE_TYPES; type < IMB_FILE_TYPES_LAST; type++)
		if (type->load_tile && type->ftype(type, ibuf))
			type->load_tile(ibuf, mem, size, tx, ty, rect);

	if (munmap(mem, size))
		fprintf(stderr, "Couldn't unmap memory for %s.\n", ibuf->cachename);
}
开发者ID:,项目名称:,代码行数:23,代码来源:


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