Blender V2.61 - r43446
Functions | Variables

math_color.c File Reference

#include <assert.h>
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
#include "BLI_rand.h"
#include "BLI_utildefines.h"

Go to the source code of this file.

Functions

void hsv_to_rgb (float h, float s, float v, float *r, float *g, float *b)
void rgb_to_yuv (float r, float g, float b, float *ly, float *lu, float *lv)
void yuv_to_rgb (float y, float u, float v, float *lr, float *lg, float *lb)
void rgb_to_ycc (float r, float g, float b, float *ly, float *lcb, float *lcr, int colorspace)
void ycc_to_rgb (float y, float cb, float cr, float *lr, float *lg, float *lb, int colorspace)
void hex_to_rgb (char *hexcol, float *r, float *g, float *b)
void rgb_to_hsv (float r, float g, float b, float *lh, float *ls, float *lv)
void rgb_to_hsv_compat (float r, float g, float b, float *lh, float *ls, float *lv)
void xyz_to_rgb (float xc, float yc, float zc, float *r, float *g, float *b, int colorspace)
unsigned int hsv_to_cpack (float h, float s, float v)
unsigned int rgb_to_cpack (float r, float g, float b)
void cpack_to_rgb (unsigned int col, float *r, float *g, float *b)
void rgb_byte_to_float (const unsigned char in[3], float out[3])
void rgb_float_to_byte (const float in[3], unsigned char out[3])
void gamma_correct (float *c, float gamma)
float rec709_to_linearrgb (float c)
float linearrgb_to_rec709 (float c)
float srgb_to_linearrgb (float c)
float linearrgb_to_srgb (float c)
void minmax_rgb (short c[])
int constrain_rgb (float *r, float *g, float *b)
float rgb_to_grayscale (const float rgb[3])
unsigned char rgb_to_grayscale_byte (const unsigned char rgb[3])
float rgb_to_luma (const float rgb[3])
unsigned char rgb_to_luma_byte (const unsigned char rgb[3])
void lift_gamma_gain_to_asc_cdl (float *lift, float *gamma, float *gain, float *offset, float *slope, float *power)
void rgb_float_set_hue_float_offset (float rgb[3], float hue_offset)
void rgb_byte_set_hue_float_offset (unsigned char rgb[3], float hue_offset)
static unsigned short hipart (const float f)
static float index_to_float (const unsigned short i)
void BLI_init_srgb_conversion (void)

Variables

float BLI_color_from_srgb_table [256]
unsigned short BLI_color_to_srgb_table [0x10000]

Detailed Description

Definition in file math_color.c.


Function Documentation

void BLI_init_srgb_conversion ( void  )
int constrain_rgb ( float *  r,
float *  g,
float *  b 
)

Definition at line 416 of file math_color.c.

References g, and simple_enum_gen::w.

void cpack_to_rgb ( unsigned int  col,
float *  r,
float *  g,
float *  b 
)

Definition at line 327 of file math_color.c.

void gamma_correct ( float *  c,
float  gamma 
)

Definition at line 363 of file math_color.c.

References powf.

void hex_to_rgb ( char *  hexcol,
float *  r,
float *  g,
float *  b 
)

Definition at line 185 of file math_color.c.

References CLAMP().

Referenced by do_hex_rna_cb().

static unsigned short hipart ( const float  f) [static]

Definition at line 507 of file math_color.c.

Referenced by BLI_init_srgb_conversion().

unsigned int hsv_to_cpack ( float  h,
float  s,
float  v 
)

Definition at line 296 of file math_color.c.

References g, and hsv_to_rgb().

void hsv_to_rgb ( float  h,
float  s,
float  v,
float *  r,
float *  g,
float *  b 
)
static float index_to_float ( const unsigned short  i) [static]

Definition at line 523 of file math_color.c.

References FLT_MAX, and i.

Referenced by BLI_init_srgb_conversion().

void lift_gamma_gain_to_asc_cdl ( float *  lift,
float *  gamma,
float *  gain,
float *  offset,
float *  slope,
float *  power 
)

Definition at line 459 of file math_color.c.

References FLT_MAX.

float linearrgb_to_rec709 ( float  c)

Definition at line 376 of file math_color.c.

References powf.

float linearrgb_to_srgb ( float  c)
void minmax_rgb ( short  c[])

Definition at line 400 of file math_color.c.

float rec709_to_linearrgb ( float  c)

Definition at line 368 of file math_color.c.

References powf.

void rgb_byte_set_hue_float_offset ( unsigned char  rgb[3],
float  hue_offset 
)
void rgb_byte_to_float ( const unsigned char  in[3],
float  out[3] 
)
void rgb_float_set_hue_float_offset ( float  rgb[3],
float  hue_offset 
)

Definition at line 475 of file math_color.c.

References hsv_to_rgb(), and rgb_to_hsv().

void rgb_float_to_byte ( const float  in[3],
unsigned char  out[3] 
)
unsigned int rgb_to_cpack ( float  r,
float  g,
float  b 
)

Definition at line 313 of file math_color.c.

float rgb_to_grayscale ( const float  rgb[3])
unsigned char rgb_to_grayscale_byte ( const unsigned char  rgb[3])

Definition at line 442 of file math_color.c.

Referenced by IMB_color_to_bw().

void rgb_to_hsv ( float  r,
float  g,
float  b,
float *  lh,
float *  ls,
float *  lv 
)
void rgb_to_hsv_compat ( float  r,
float  g,
float  b,
float *  lh,
float *  ls,
float *  lv 
)
float rgb_to_luma ( const float  rgb[3])
unsigned char rgb_to_luma_byte ( const unsigned char  rgb[3])

Definition at line 452 of file math_color.c.

Referenced by image_sample_line_exec(), and make_waveform_view_from_ibuf_byte().

void rgb_to_ycc ( float  r,
float  g,
float  b,
float *  ly,
float *  lcb,
float *  lcr,
int  colorspace 
)
void rgb_to_yuv ( float  r,
float  g,
float  b,
float *  ly,
float *  lu,
float *  lv 
)
float srgb_to_linearrgb ( float  c)
void xyz_to_rgb ( float  xc,
float  yc,
float  zc,
float *  r,
float *  g,
float *  b,
int  colorspace 
)

Definition at line 271 of file math_color.c.

References BLI_XYZ_CIE, BLI_XYZ_REC709_SRGB, and BLI_XYZ_SMPTE.

Referenced by shadeSunView(), and sky_radiance().

void ycc_to_rgb ( float  y,
float  cb,
float  cr,
float *  lr,
float *  lg,
float *  lb,
int  colorspace 
)
void yuv_to_rgb ( float  y,
float  u,
float  v,
float *  lr,
float *  lg,
float *  lb 
)

Definition at line 105 of file math_color.c.

References g.

Referenced by do_comb_yuva(), and do_yuva_to_rgba().


Variable Documentation

Definition at line 504 of file math_color.c.

Referenced by BLI_init_srgb_conversion(), and srgb_to_linearrgb_uchar4().

unsigned short BLI_color_to_srgb_table[0x10000]

Definition at line 505 of file math_color.c.

Referenced by BLI_init_srgb_conversion(), and to_srgb_table_lookup().