您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ IMB_freeImBuf函数代码示例

51自学网 2021-06-01 21:29:18
  C++
这篇教程C++ IMB_freeImBuf函数代码示例写得很实用,希望能帮到您。

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

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

示例1: IMB_dupImBuf

ImBuf *BKE_sequence_modifier_apply_stack(const SeqRenderData *context, Sequence *seq, ImBuf *ibuf, int cfra){	SequenceModifierData *smd;	ImBuf *processed_ibuf = ibuf;	if (seq->modifiers.first && (seq->flag & SEQ_USE_LINEAR_MODIFIERS)) {		processed_ibuf = IMB_dupImBuf(ibuf);		BKE_sequencer_imbuf_from_sequencer_space(context->scene, processed_ibuf);	}	for (smd = seq->modifiers.first; smd; smd = smd->next) {		const SequenceModifierTypeInfo *smti = BKE_sequence_modifier_type_info_get(smd->type);		/* could happen if modifier is being removed or not exists in current version of blender */		if (!smti)			continue;		/* modifier is muted, do nothing */		if (smd->flag & SEQUENCE_MODIFIER_MUTE)			continue;		if (smti->apply) {			int frame_offset;			if (smd->mask_time == SEQUENCE_MASK_TIME_RELATIVE) {				frame_offset = seq->start;			}			else /*if (smd->mask_time == SEQUENCE_MASK_TIME_ABSOLUTE)*/ {				frame_offset = 0;			}			ImBuf *mask = modifier_mask_get(smd,			                                context,			                                cfra,			                                frame_offset,			                                ibuf->rect_float != NULL);			if (processed_ibuf == ibuf)				processed_ibuf = IMB_dupImBuf(ibuf);			smti->apply(smd, processed_ibuf, mask);			if (mask)				IMB_freeImBuf(mask);		}	}	if (seq->modifiers.first && (seq->flag & SEQ_USE_LINEAR_MODIFIERS)) {		BKE_sequencer_imbuf_to_sequencer_space(context->scene, processed_ibuf, false);	}	return processed_ibuf;}
开发者ID:mgschwan,项目名称:blensor,代码行数:52,


示例2: BKE_brush_painter_require_imbuf

void BKE_brush_painter_require_imbuf(BrushPainter *painter, short flt, short texonly, int size){	if ((painter->cache.flt != flt) || (painter->cache.size != size) ||	    ((painter->cache.texonly != texonly) && texonly))	{		if (painter->cache.ibuf) IMB_freeImBuf(painter->cache.ibuf);		if (painter->cache.maskibuf) IMB_freeImBuf(painter->cache.maskibuf);		painter->cache.ibuf = painter->cache.maskibuf = NULL;		painter->cache.lastsize = -1; /* force ibuf create in refresh */	}	if (painter->cache.flt != flt) {		if (painter->cache.texibuf) IMB_freeImBuf(painter->cache.texibuf);		painter->cache.texibuf = NULL;		painter->cache.lastsize = -1; /* force ibuf create in refresh */	}	painter->cache.size = size;	painter->cache.flt = flt;	painter->cache.texonly = texonly;	painter->cache.enabled = 1;}
开发者ID:danielmarg,项目名称:blender-main,代码行数:22,


示例3: free_buffers

static void free_buffers(MovieClip *clip){	if (clip->cache) {		IMB_moviecache_free(clip->cache->moviecache);		if (clip->cache->postprocessed.ibuf)			IMB_freeImBuf(clip->cache->postprocessed.ibuf);		if (clip->cache->stabilized.ibuf)			IMB_freeImBuf(clip->cache->stabilized.ibuf);		MEM_freeN(clip->cache);		clip->cache = NULL;	}	if (clip->anim) {		IMB_free_anim(clip->anim);		clip->anim = NULL;	}	BKE_free_animdata((ID *) clip);}
开发者ID:Walid-Shouman,项目名称:Blender,代码行数:22,


示例4: rendersize_to_proxy

static ImBuf *put_postprocessed_frame_to_cache(MovieClip *clip, MovieClipUser *user, ImBuf *ibuf,                                               int flag, int postprocess_flag){	MovieClipCache *cache = clip->cache;	MovieTrackingCamera *camera = &clip->tracking.camera;	ImBuf *postproc_ibuf = NULL;	cache->postprocessed.framenr = user->framenr;	cache->postprocessed.flag = postprocess_flag;	if (flag & MCLIP_USE_PROXY) {		cache->postprocessed.proxy = rendersize_to_proxy(user, flag);		cache->postprocessed.render_flag = user->render_flag;	}	else {		cache->postprocessed.proxy = IMB_PROXY_NONE;		cache->postprocessed.render_flag = 0;	}	if (need_undistortion_postprocess(user)) {		copy_v2_v2(cache->postprocessed.principal, camera->principal);		copy_v3_v3(&cache->postprocessed.k1, &camera->k1);		cache->postprocessed.undistortion_used = TRUE;		postproc_ibuf = get_undistorted_ibuf(clip, NULL, ibuf);	}	else {		cache->postprocessed.undistortion_used = FALSE;	}	if (postprocess_flag) {		int disable_red   = postprocess_flag & MOVIECLIP_DISABLE_RED,		    disable_green = postprocess_flag & MOVIECLIP_DISABLE_GREEN,		    disable_blue  = postprocess_flag & MOVIECLIP_DISABLE_BLUE,		    grayscale     = postprocess_flag & MOVIECLIP_PREVIEW_GRAYSCALE;		if (!postproc_ibuf)			postproc_ibuf = IMB_dupImBuf(ibuf);		if (disable_red || disable_green || disable_blue || grayscale)			BKE_tracking_disable_channels(postproc_ibuf, disable_red, disable_green, disable_blue, 1);	}	IMB_refImBuf(postproc_ibuf);	if (cache->postprocessed.ibuf)		IMB_freeImBuf(cache->postprocessed.ibuf);	cache->postprocessed.ibuf = postproc_ibuf;	return postproc_ibuf;}
开发者ID:silkentrance,项目名称:blender,代码行数:51,


示例5: IMB_dupImBuf

ImBuf *IMB_makeSingleUser(ImBuf *ibuf){    ImBuf *rval;    if (!ibuf || ibuf->refcounter == 0) {        return ibuf;    }    rval = IMB_dupImBuf(ibuf);    IMB_freeImBuf(ibuf);    return rval;}
开发者ID:mcgrathd,项目名称:blender,代码行数:14,


示例6: BKE_sequencer_preprocessed_cache_cleanup

void BKE_sequencer_preprocessed_cache_cleanup(void){	SeqPreprocessCacheElem *elem;	if (!preprocess_cache)		return;	for (elem = preprocess_cache->elems.first; elem; elem = elem->next) {		IMB_freeImBuf(elem->ibuf);	}	BLI_freelistN(&preprocess_cache->elems);	BLI_listbase_clear(&preprocess_cache->elems);}
开发者ID:SuriyaaKudoIsc,项目名称:blender-git,代码行数:14,


示例7: IMB_dupImBuf

static ImBuf *sequencer_make_scope(Scene *scene, ImBuf *ibuf, ImBuf *(*make_scope_cb) (ImBuf *ibuf)){	ImBuf *display_ibuf = IMB_dupImBuf(ibuf);	ImBuf *scope;		IMB_colormanagement_imbuf_make_display_space(display_ibuf, &scene->view_settings,		                                             &scene->display_settings);	scope = make_scope_cb(display_ibuf);	IMB_freeImBuf(display_ibuf);	return scope;}
开发者ID:ideasman42,项目名称:blender-wayland,代码行数:14,


示例8: icon_copy_rect

static void icon_copy_rect(ImBuf *ibuf, unsigned int w, unsigned int h, unsigned int *rect){	struct ImBuf *ima;	unsigned int *drect, *srect;	float scaledx, scaledy;	short ex, ey, dx, dy;	/* paranoia test */	if(ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL))		return;		/* waste of cpu cyles... but the imbuf API has no other way to scale fast (ton) */	ima = IMB_dupImBuf(ibuf);		if (!ima) 		return;		if (ima->x > ima->y) {		scaledx = (float)w;		scaledy =  ( (float)ima->y/(float)ima->x )*(float)w;	}	else {					scaledx =  ( (float)ima->x/(float)ima->y )*(float)h;		scaledy = (float)h;	}		ex = (short)scaledx;	ey = (short)scaledy;		dx = (w - ex) / 2;	dy = (h - ey) / 2;		IMB_scalefastImBuf(ima, ex, ey);		/* if needed, convert to 32 bits */	if(ima->rect==NULL)		IMB_rect_from_float(ima);	srect = ima->rect;	drect = rect;	drect+= dy*w+dx;	for (;ey > 0; ey--){				memcpy(drect,srect, ex * sizeof(int));		drect += w;		srect += ima->x;	}	IMB_freeImBuf(ima);}
开发者ID:OldBrunet,项目名称:BGERTPS,代码行数:50,


示例9: BKE_free_ocean_cache

void BKE_free_ocean_cache(struct OceanCache *och){	int i, f = 0;	if (!och) return;	if (och->ibufs_disp) {		for (i = och->start, f = 0; i <= och->end; i++, f++) {			if (och->ibufs_disp[f]) {				IMB_freeImBuf(och->ibufs_disp[f]);			}		}		MEM_freeN(och->ibufs_disp);	}	if (och->ibufs_foam) {		for (i = och->start, f = 0; i <= och->end; i++, f++) {			if (och->ibufs_foam[f]) {				IMB_freeImBuf(och->ibufs_foam[f]);			}		}		MEM_freeN(och->ibufs_foam);	}	if (och->ibufs_norm) {		for (i = och->start, f = 0; i <= och->end; i++, f++) {			if (och->ibufs_norm[f]) {				IMB_freeImBuf(och->ibufs_norm[f]);			}		}		MEM_freeN(och->ibufs_norm);	}	if (och->time)		MEM_freeN(och->time);	MEM_freeN(och);}
开发者ID:danielmarg,项目名称:blender-main,代码行数:37,


示例10: BKE_movieclip_get_postprocessed_ibuf

ImBuf *BKE_movieclip_get_stable_ibuf(MovieClip *clip, MovieClipUser *user, float loc[2], float *scale, float *angle,                                     int postprocess_flag){	ImBuf *ibuf, *stableibuf = NULL;	int framenr = user->framenr;	ibuf = BKE_movieclip_get_postprocessed_ibuf(clip, user, postprocess_flag);	if (!ibuf)		return NULL;	if (clip->tracking.stabilization.flag & TRACKING_2D_STABILIZATION) {		MovieClipCache *cache = clip->cache;		stableibuf = get_stable_cached_frame(clip, user, ibuf, framenr, postprocess_flag);		if (!stableibuf)			stableibuf = put_stabilized_frame_to_cache(clip, user, ibuf, framenr, postprocess_flag);		if (loc)			copy_v2_v2(loc, cache->stabilized.loc);		if (scale)			*scale = cache->stabilized.scale;		if (angle)			*angle = cache->stabilized.angle;	}	else {		if (loc)			zero_v2(loc);		if (scale)			*scale = 1.0f;		if (angle)			*angle = 0.0f;		stableibuf = ibuf;	}	if (stableibuf != ibuf) {		IMB_freeImBuf(ibuf);		ibuf = stableibuf;	}	return ibuf;}
开发者ID:Walid-Shouman,项目名称:Blender,代码行数:49,


示例11: BKE_previewimg_ensure

/** Handle deferred (lazy) loading/generation of preview image, if needed. * For now, only used with file thumbnails. */void BKE_previewimg_ensure(PreviewImage *prv, const int size){	if (prv->use_deferred) {		const bool do_icon = ((size == ICON_SIZE_ICON) && !prv->rect[ICON_SIZE_ICON]);		const bool do_preview = ((size == ICON_SIZE_PREVIEW) && !prv->rect[ICON_SIZE_PREVIEW]);		if (do_icon || do_preview) {			ImBuf *thumb;			char *prv_deferred_data = PRV_DEFERRED_DATA(prv);			int source =  prv_deferred_data[0];			char *path = &prv_deferred_data[1];			int icon_w, icon_h;			thumb = IMB_thumb_manage(path, THB_LARGE, source);			if (thumb) {				/* PreviewImage assumes premultiplied alhpa... */				IMB_premultiply_alpha(thumb);				if (do_preview) {					prv->w[ICON_SIZE_PREVIEW] = thumb->x;					prv->h[ICON_SIZE_PREVIEW] = thumb->y;					prv->rect[ICON_SIZE_PREVIEW] = MEM_dupallocN(thumb->rect);					prv->flag[ICON_SIZE_PREVIEW] &= ~(PRV_CHANGED | PRV_USER_EDITED);				}				if (do_icon) {					if (thumb->x > thumb->y) {						icon_w = ICON_RENDER_DEFAULT_HEIGHT;						icon_h = (thumb->y * icon_w) / thumb->x + 1;					}					else if (thumb->x < thumb->y) {						icon_h = ICON_RENDER_DEFAULT_HEIGHT;						icon_w = (thumb->x * icon_h) / thumb->y + 1;					}					else {						icon_w = icon_h = ICON_RENDER_DEFAULT_HEIGHT;					}					IMB_scaleImBuf(thumb, icon_w, icon_h);					prv->w[ICON_SIZE_ICON] = icon_w;					prv->h[ICON_SIZE_ICON] = icon_h;					prv->rect[ICON_SIZE_ICON] = MEM_dupallocN(thumb->rect);					prv->flag[ICON_SIZE_ICON] &= ~(PRV_CHANGED | PRV_USER_EDITED);				}				IMB_freeImBuf(thumb);			}		}	}}
开发者ID:khanhha,项目名称:blender,代码行数:51,


示例12: BKE_brush_free

/* not brush itself */void BKE_brush_free(Brush *brush){	if (brush->mtex.tex)		brush->mtex.tex->id.us--;	if (brush->mask_mtex.tex)		brush->mask_mtex.tex->id.us--;	if (brush->icon_imbuf)		IMB_freeImBuf(brush->icon_imbuf);	BKE_previewimg_free(&(brush->preview));	curvemapping_free(brush->curve);}
开发者ID:BlueLabelStudio,项目名称:blender,代码行数:16,


示例13: MEM_mallocN

ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y, uchar planes, unsigned int flags){	ImBuf *ibuf;	ibuf = MEM_mallocN(sizeof(ImBuf), "ImBuf_struct");	if (ibuf) {		if (!IMB_initImBuf(ibuf, x, y, planes, flags)) {			IMB_freeImBuf(ibuf);			return NULL;		}	}	return (ibuf);}
开发者ID:Ichthyostega,项目名称:blender,代码行数:15,


示例14: imb_freemipmapImBuf

void imb_freemipmapImBuf(ImBuf *ibuf){	int a;	/* Do not trust ibuf->miptot, in some cases IMB_remakemipmap can leave unfreed unused levels,	 * leading to memory leaks... */	for (a = 0; a < IMB_MIPMAP_LEVELS; a++) {		if (ibuf->mipmap[a] != NULL) {			IMB_freeImBuf(ibuf->mipmap[a]);			ibuf->mipmap[a] = NULL;		}	}	ibuf->miptot = 0;}
开发者ID:Ichthyostega,项目名称:blender,代码行数:15,


示例15: ED_space_clip_color_sample

/* Returns color in the display space, matching ED_space_image_color_sample(). */bool ED_space_clip_color_sample(Scene *scene, SpaceClip *sc, ARegion *ar, int mval[2], float r_col[3]){	const char *display_device = scene->display_settings.display_device;	struct ColorManagedDisplay *display = IMB_colormanagement_display_get_named(display_device);	ImBuf *ibuf;	float fx, fy, co[2];	bool ret = false;	ibuf = ED_space_clip_get_buffer(sc);	if (!ibuf) {		return false;	}	/* map the mouse coords to the backdrop image space */	ED_clip_mouse_pos(sc, ar, mval, co);	fx = co[0];	fy = co[1];	if (fx >= 0.0f && fy >= 0.0f && fx < 1.0f && fy < 1.0f) {		const float *fp;		unsigned char *cp;		int x = (int)(fx * ibuf->x), y = (int)(fy * ibuf->y);		CLAMP(x, 0, ibuf->x - 1);		CLAMP(y, 0, ibuf->y - 1);		if (ibuf->rect_float) {			fp = (ibuf->rect_float + (ibuf->channels) * (y * ibuf->x + x));			copy_v3_v3(r_col, fp);			ret = true;		}		else if (ibuf->rect) {			cp = (unsigned char *)(ibuf->rect + y * ibuf->x + x);			rgb_uchar_to_float(r_col, cp);			IMB_colormanagement_colorspace_to_scene_linear_v3(r_col, ibuf->rect_colorspace);			ret = true;		}	}	if (ret) {		IMB_colormanagement_scene_linear_to_display_v3(r_col, display);	}	IMB_freeImBuf(ibuf);	return ret;}
开发者ID:SuriyaaKudoIsc,项目名称:blender-git,代码行数:49,


示例16: defined

static ImBuf *avi_fetchibuf(struct anim *anim, int position){	ImBuf *ibuf = NULL;	int *tmp;	int y;		if (anim == NULL) {		return NULL;	}#if defined(_WIN32) && !defined(FREE_WINDOWS)	if (anim->avistreams) {		LPBITMAPINFOHEADER lpbi;		if (anim->pgf) {			lpbi = AVIStreamGetFrame(anim->pgf, position + AVIStreamStart(anim->pavi[anim->firstvideo]));			if (lpbi) {				ibuf = IMB_ibImageFromMemory((unsigned char *) lpbi, 100, IB_rect, anim->colorspace, "<avi_fetchibuf>");//Oh brother...			}		}	}	else#endif	{		ibuf = IMB_allocImBuf(anim->x, anim->y, 24, IB_rect);		tmp = AVI_read_frame(anim->avi, AVI_FORMAT_RGB32, position,		                     AVI_get_stream(anim->avi, AVIST_VIDEO, 0));				if (tmp == NULL) {			printf("Error reading frame from AVI: '%s'/n", anim->name);			IMB_freeImBuf(ibuf);			return NULL;		}		for (y = 0; y < anim->y; y++) {			memcpy(&(ibuf->rect)[((anim->y - y) - 1) * anim->x],  &tmp[y * anim->x],			       anim->x * 4);		}				MEM_freeN(tmp);	}		ibuf->rect_colorspace = colormanage_colorspace_get_named(anim->colorspace);	return ibuf;}
开发者ID:Eibriel,项目名称:kiriblender,代码行数:48,


示例17: BKE_brush_free

/* not brush itself */void BKE_brush_free(Brush *brush){	id_us_min((ID *)brush->mtex.tex);	id_us_min((ID *)brush->mask_mtex.tex);	id_us_min((ID *)brush->paint_curve);	if (brush->icon_imbuf)		IMB_freeImBuf(brush->icon_imbuf);	BKE_previewimg_free(&(brush->preview));	curvemapping_free(brush->curve);	if (brush->gradient)		MEM_freeN(brush->gradient);}
开发者ID:Rojuinex,项目名称:Blender,代码行数:17,


示例18: screenshot_exec

static int screenshot_exec(bContext *C, wmOperator *op){  ScreenshotData *scd = op->customdata;  bool ok = false;  if (scd == NULL) {    /* when running exec directly */    screenshot_data_create(C, op);    scd = op->customdata;  }  if (scd) {    if (scd->dumprect) {      ImBuf *ibuf;      char path[FILE_MAX];      RNA_string_get(op->ptr, "filepath", path);      BLI_path_abs(path, BKE_main_blendfile_path_from_global());      /* operator ensures the extension */      ibuf = IMB_allocImBuf(scd->dumpsx, scd->dumpsy, 24, 0);      ibuf->rect = scd->dumprect;      /* crop to show only single editor */      if (!RNA_boolean_get(op->ptr, "full")) {        screenshot_crop(ibuf, scd->crop);      }      if (scd->im_format.planes == R_IMF_PLANES_BW) {        /* bw screenshot? - users will notice if it fails! */        IMB_color_to_bw(ibuf);      }      if (BKE_imbuf_write(ibuf, path, &scd->im_format)) {        ok = true;      }      else {        BKE_reportf(op->reports, RPT_ERROR, "Could not write image: %s", strerror(errno));      }      IMB_freeImBuf(ibuf);    }  }  screenshot_data_free(op);  return ok ? OPERATOR_FINISHED : OPERATOR_CANCELLED;}
开发者ID:dfelinto,项目名称:blender,代码行数:47,


示例19: thumbnails_update

static void thumbnails_update(void *tjv){	ThumbnailJob *tj = tjv;	if (tj->filelist && tj->filelist->filelist) {		FileImage *limg = tj->loadimages.first;		while (limg) {			if (!limg->done && limg->img) {				tj->filelist->filelist[limg->index].image = IMB_dupImBuf(limg->img);				limg->done = true;				IMB_freeImBuf(limg->img);				limg->img = NULL;			}			limg = limg->next;		}	}}
开发者ID:bitfusionio,项目名称:blender,代码行数:17,


示例20: BKE_sequencer_preprocessed_cache_cleanup_sequence

void BKE_sequencer_preprocessed_cache_cleanup_sequence(Sequence *seq){	SeqPreprocessCacheElem *elem, *elem_next;	if (!preprocess_cache)		return;	for (elem = preprocess_cache->elems.first; elem; elem = elem_next) {		elem_next = elem->next;		if (elem->seq == seq) {			IMB_freeImBuf(elem->ibuf);			BLI_freelinkN(&preprocess_cache->elems, elem);		}	}}
开发者ID:SuriyaaKudoIsc,项目名称:blender-git,代码行数:17,


示例21: BLI_free_filelist

/* frees storage for an array of direntries, including the array itself. */void BLI_free_filelist(struct direntry *filelist, unsigned int nrentries){	unsigned int i;	for (i = 0; i < nrentries; ++i) {		struct direntry * const entry = filelist + i;		if (entry->image) {			IMB_freeImBuf(entry->image);		}		if (entry->relname)			MEM_freeN(entry->relname);		if (entry->path)			MEM_freeN(entry->path);		/* entry->poin assumed not to point to anything needing freeing here */	}	free(filelist);}
开发者ID:Eibriel,项目名称:kiriblender,代码行数:18,


示例22: detect_clip_source

static void detect_clip_source(MovieClip *clip){	ImBuf *ibuf;	char name[FILE_MAX];	BLI_strncpy(name, clip->name, sizeof(name));	BLI_path_abs(name, G.main->name);	ibuf = IMB_testiffname(name, IB_rect | IB_multilayer);	if (ibuf) {		clip->source = MCLIP_SRC_SEQUENCE;		IMB_freeImBuf(ibuf);	}	else {		clip->source = MCLIP_SRC_MOVIE;	}}
开发者ID:Walid-Shouman,项目名称:Blender,代码行数:17,



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


C++ IMG_ASSERT函数代码示例
C++ IMB_allocImBuf函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。