Blender  V3.3
Classes | Macros | Functions
colorband.c File Reference
#include "MEM_guardedalloc.h"
#include "BLI_heap.h"
#include "BLI_math.h"
#include "BLI_math_color.h"
#include "BLI_utildefines.h"
#include "DNA_key_types.h"
#include "DNA_texture_types.h"
#include "BKE_colorband.h"
#include "BKE_key.h"
#include "BKE_material.h"

Go to the source code of this file.

Classes

struct  ColorResampleElem
 

Macros

#define HUE_INTERP(h_a, h_b)   ((mfac * (h_a)) + (fac * (h_b)))
 
#define HUE_MOD(h)   (((h) < 1.0f) ? (h) : (h)-1.0f)
 

Functions

void BKE_colorband_init (ColorBand *coba, bool rangetype)
 
static void colorband_init_from_table_rgba_simple (ColorBand *coba, const float(*array)[4], const int array_len)
 
ColorBandBKE_colorband_add (bool rangetype)
 
static float colorband_hue_interp (const int ipotype_hue, const float mfac, const float fac, float h1, float h2)
 
bool BKE_colorband_evaluate (const ColorBand *coba, float in, float out[4])
 
void BKE_colorband_evaluate_table_rgba (const ColorBand *coba, float **array, int *size)
 
static int vergcband (const void *a1, const void *a2)
 
void BKE_colorband_update_sort (ColorBand *coba)
 
CBDataBKE_colorband_element_add (struct ColorBand *coba, float position)
 
bool BKE_colorband_element_remove (struct ColorBand *coba, int index)
 
Color Ramp Re-Sample
static float color_sample_remove_cost (const struct ColorResampleElem *c)
 
static float filter_gauss (float x)
 
static void colorband_init_from_table_rgba_resample (ColorBand *coba, const float(*array)[4], const int array_len, bool filter_samples)
 
void BKE_colorband_init_from_table_rgba (ColorBand *coba, const float(*array)[4], const int array_len, bool filter_samples)
 

Macro Definition Documentation

◆ HUE_INTERP

#define HUE_INTERP (   h_a,
  h_b 
)    ((mfac * (h_a)) + (fac * (h_b)))

◆ HUE_MOD

#define HUE_MOD (   h)    (((h) < 1.0f) ? (h) : (h)-1.0f)

Function Documentation

◆ BKE_colorband_add()

ColorBand* BKE_colorband_add ( bool  rangetype)

◆ BKE_colorband_element_add()

CBData* BKE_colorband_element_add ( struct ColorBand coba,
float  position 
)

◆ BKE_colorband_element_remove()

bool BKE_colorband_element_remove ( struct ColorBand coba,
int  index 
)

Definition at line 628 of file colorband.c.

References Freestyle::a, ColorBand::cur, ColorBand::data, and ColorBand::tot.

Referenced by colorband_del_cb().

◆ BKE_colorband_evaluate()

bool BKE_colorband_evaluate ( const ColorBand coba,
float  in,
float  out[4] 
)

◆ BKE_colorband_evaluate_table_rgba()

void BKE_colorband_evaluate_table_rgba ( const ColorBand coba,
float **  array,
int *  size 
)

Definition at line 555 of file colorband.c.

References Freestyle::a, BKE_colorband_evaluate(), CM_TABLE, MEM_callocN, and size().

◆ BKE_colorband_init()

void BKE_colorband_init ( ColorBand coba,
bool  rangetype 
)

◆ BKE_colorband_init_from_table_rgba()

void BKE_colorband_init_from_table_rgba ( ColorBand coba,
const float(*)  array[4],
const int  array_len,
bool  filter_samples 
)

◆ BKE_colorband_update_sort()

void BKE_colorband_update_sort ( ColorBand coba)

◆ color_sample_remove_cost()

static float color_sample_remove_cost ( const struct ColorResampleElem c)
static

Measure the 'area' of each channel and combine to use as a cost for this samples removal.

Definition at line 117 of file colorband.c.

References blender::compositor::area(), Freestyle::c, cross_tri_v2(), fabsf, and NULL.

Referenced by colorband_init_from_table_rgba_resample().

◆ colorband_hue_interp()

static float colorband_hue_interp ( const int  ipotype_hue,
const float  mfac,
const float  fac,
float  h1,
float  h2 
)
static

◆ colorband_init_from_table_rgba_resample()

static void colorband_init_from_table_rgba_resample ( ColorBand coba,
const float(*)  array[4],
const int  array_len,
bool  filter_samples 
)
static

◆ colorband_init_from_table_rgba_simple()

static void colorband_init_from_table_rgba_simple ( ColorBand coba,
const float(*)  array[4],
const int  array_len 
)
static

◆ filter_gauss()

static float filter_gauss ( float  x)
static

Definition at line 148 of file colorband.c.

References expf, M_PI, sqrtf, and x.

Referenced by colorband_init_from_table_rgba_resample().

◆ vergcband()

static int vergcband ( const void a1,
const void a2 
)
static

Definition at line 567 of file colorband.c.

References CBData::pos, and x2.

Referenced by BKE_colorband_update_sort().