本文整理汇总了C++中IMB_freeImBuf函数的典型用法代码示例。如果您正苦于以下问题:C++ IMB_freeImBuf函数的具体用法?C++ IMB_freeImBuf怎么用?C++ IMB_freeImBuf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IMB_freeImBuf函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
}
}
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}