Blender  V3.3
Functions
filter.c File Reference
#include <math.h>
#include "MEM_guardedalloc.h"
#include "BLI_math_base.h"
#include "BLI_utildefines.h"
#include "IMB_filter.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
#include "imbuf.h"

Go to the source code of this file.

Functions

static void filtrow (unsigned char *point, int x)
 
static void filtrowf (float *point, int x)
 
static void filtcolum (unsigned char *point, int y, int skip)
 
static void filtcolumf (float *point, int y, int skip)
 
void IMB_filtery (struct ImBuf *ibuf)
 
void imb_filterx (struct ImBuf *ibuf)
 
static void imb_filterN (ImBuf *out, ImBuf *in)
 
void IMB_filter (struct ImBuf *ibuf)
 
void IMB_mask_filter_extend (char *mask, int width, int height)
 
void IMB_mask_clear (ImBuf *ibuf, const char *mask, int val)
 
static int filter_make_index (const int x, const int y, const int w, const int h)
 
static int check_pixel_assigned (const void *buffer, const char *mask, const int index, const int depth, const bool is_float)
 
void IMB_filter_extend (struct ImBuf *ibuf, char *mask, int filter)
 
void IMB_remakemipmap (ImBuf *ibuf, int use_filter)
 
void IMB_makemipmap (ImBuf *ibuf, int use_filter)
 
ImBufIMB_getmipmap (ImBuf *ibuf, int level)
 
void IMB_premultiply_rect (unsigned int *rect, char planes, int w, int h)
 
void IMB_premultiply_rect_float (float *rect_float, int channels, int w, int h)
 
void IMB_premultiply_alpha (ImBuf *ibuf)
 
void IMB_unpremultiply_rect (unsigned int *rect, char planes, int w, int h)
 
void IMB_unpremultiply_rect_float (float *rect_float, int channels, int w, int h)
 
void IMB_unpremultiply_alpha (ImBuf *ibuf)
 

Function Documentation

◆ check_pixel_assigned()

static int check_pixel_assigned ( const void buffer,
const char *  mask,
const int  index,
const int  depth,
const bool  is_float 
)
static

Definition at line 386 of file filter.c.

References buffer, mask(), and NULL.

Referenced by IMB_filter_extend().

◆ filtcolum()

static void filtcolum ( unsigned char *  point,
int  y,
int  skip 
)
static

Definition at line 59 of file filter.c.

References error(), point, and y.

Referenced by IMB_filtery().

◆ filtcolumf()

static void filtcolumf ( float point,
int  y,
int  skip 
)
static

Definition at line 82 of file filter.c.

References point, and y.

Referenced by IMB_filtery().

◆ filter_make_index()

static int filter_make_index ( const int  x,
const int  y,
const int  w,
const int  h 
)
static

Definition at line 377 of file filter.c.

References w(), x, and y.

Referenced by IMB_filter_extend().

◆ filtrow()

static void filtrow ( unsigned char *  point,
int  x 
)
static

Definition at line 21 of file filter.c.

References error(), point, and x.

Referenced by imb_filterx().

◆ filtrowf()

static void filtrowf ( float point,
int  x 
)
static

Definition at line 41 of file filter.c.

References point, and x.

Referenced by imb_filterx().

◆ IMB_filter()

void IMB_filter ( struct ImBuf ibuf)

Definition at line 301 of file filter.c.

References imb_filterx(), and IMB_filtery().

◆ IMB_filter_extend()

void IMB_filter_extend ( struct ImBuf ibuf,
char *  mask,
int  filter 
)

If alpha is zero, it checks surrounding pixels and averages color. sets new alphas to 1.0 When a mask is given, the mask will be used instead of the alpha channel, where only pixels with a mask value of 0 will be written to, and only pixels with a mask value of 1 will be used for the average. The mask will be set to one for the pixels which were written.

Definition at line 406 of file filter.c.

References Freestyle::c, check_pixel_assigned(), filter(), filter_make_index(), FILTER_MASK_MARGIN, float(), height, mask(), MEM_dupallocN, MEM_freeN, NULL, r, ImBuf::rect, ImBuf::rect_float, sqrt(), width, x, ImBuf::x, y, and ImBuf::y.

Referenced by bake_ibuf_filter(), blender::render::texturemargin::generate_margin(), and RE_bake_margin().

◆ imb_filterN()

static void imb_filterN ( ImBuf out,
ImBuf in 
)
static

◆ imb_filterx()

void imb_filterx ( struct ImBuf ibuf)

Definition at line 143 of file filter.c.

References filtrow(), filtrowf(), ImBuf::planes, point, ImBuf::rect, ImBuf::rect_float, x, ImBuf::x, y, and ImBuf::y.

Referenced by IMB_double_x(), and IMB_filter().

◆ IMB_filtery()

void IMB_filtery ( struct ImBuf ibuf)
Attention
Defined in filter.c

Definition at line 102 of file filter.c.

References filtcolum(), filtcolumf(), ImBuf::planes, point, ImBuf::rect, ImBuf::rect_float, x, ImBuf::x, y, and ImBuf::y.

Referenced by IMB_anim_absolute(), IMB_double_y(), IMB_filter(), and input_preprocess().

◆ IMB_getmipmap()

ImBuf* IMB_getmipmap ( ImBuf ibuf,
int  level 
)

Definition at line 610 of file filter.c.

References CLAMP, ImBuf::mipmap, and ImBuf::miptot.

Referenced by IMB_tiles_to_rect().

◆ IMB_makemipmap()

void IMB_makemipmap ( struct ImBuf ibuf,
int  use_filter 
)

◆ IMB_mask_clear()

void IMB_mask_clear ( ImBuf ibuf,
const char *  mask,
int  val 
)

Definition at line 351 of file filter.c.

References col, mask(), ImBuf::rect, ImBuf::rect_float, x, ImBuf::x, y, and ImBuf::y.

◆ IMB_mask_filter_extend()

void IMB_mask_filter_extend ( char *  mask,
int  width,
int  height 
)

Definition at line 307 of file filter.c.

References FILTER_MASK_MARGIN, height, mask(), MEM_dupallocN, MEM_freeN, width, x, and y.

◆ IMB_premultiply_alpha()

void IMB_premultiply_alpha ( ImBuf ibuf)

◆ IMB_premultiply_rect()

void IMB_premultiply_rect ( unsigned int *  rect,
char  planes,
int  w,
int  h 
)

Definition at line 616 of file filter.c.

References w(), x, and y.

Referenced by IMB_premultiply_alpha().

◆ IMB_premultiply_rect_float()

void IMB_premultiply_rect_float ( float rect_float,
int  channels,
int  w,
int  h 
)

◆ IMB_remakemipmap()

void IMB_remakemipmap ( struct ImBuf ibuf,
int  use_filter 
)

Thread-safe version, only recreates existing maps.

Definition at line 537 of file filter.c.

References ImBuf::flags, IMB_allocImBuf(), imb_filterN(), IMB_freeImBuf(), IMB_MIPMAP_LEVELS, imb_onehalf_no_alloc(), ImBuf::miplevel, ImBuf::mipmap, ImBuf::miptot, ImBuf::planes, ImBuf::x, and ImBuf::y.

Referenced by image_mipmap_test().

◆ IMB_unpremultiply_alpha()

void IMB_unpremultiply_alpha ( ImBuf ibuf)

◆ IMB_unpremultiply_rect()

void IMB_unpremultiply_rect ( unsigned int *  rect,
char  planes,
int  w,
int  h 
)

Definition at line 677 of file filter.c.

References float(), unit_float_to_uchar_clamp(), w(), x, and y.

Referenced by IMB_unpremultiply_alpha().

◆ IMB_unpremultiply_rect_float()

void IMB_unpremultiply_rect_float ( float rect_float,
int  channels,
int  w,
int  h 
)

Definition at line 706 of file filter.c.

References channels(), w(), x, and y.

Referenced by IMB_rect_from_float(), and IMB_unpremultiply_alpha().