Blender V2.61 - r43446
|
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <float.h>
#include "MEM_guardedalloc.h"
#include "DNA_color_types.h"
#include "DNA_curve_types.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BKE_colortools.h"
#include "BKE_curve.h"
#include "BKE_fcurve.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
Go to the source code of this file.
Defines | |
#define | INV_255 (1.f/255.f) |
Functions | |
CurveMapping * | curvemapping_add (int tot, float minx, float miny, float maxx, float maxy) |
void | curvemapping_free (CurveMapping *cumap) |
CurveMapping * | curvemapping_copy (CurveMapping *cumap) |
void | curvemapping_set_black_white (CurveMapping *cumap, const float black[3], const float white[3]) |
void | curvemap_remove (CurveMap *cuma, int flag) |
void | curvemap_insert (CurveMap *cuma, float x, float y) |
void | curvemap_reset (CurveMap *cuma, rctf *clipr, int preset, int slope) |
void | curvemap_sethandle (CurveMap *cuma, int type) |
static void | calchandle_curvemap (BezTriple *bezt, BezTriple *prev, BezTriple *next, int UNUSED(mode)) |
static float | curvemap_calc_extend (CurveMap *cuma, float x, const float first[2], const float last[2]) |
static void | curvemap_make_table (CurveMap *cuma, rctf *clipr) |
void | curvemapping_premultiply (CurveMapping *cumap, int restore) |
static int | sort_curvepoints (const void *a1, const void *a2) |
void | curvemapping_changed (CurveMapping *cumap, int rem_doubles) |
float | curvemap_evaluateF (CurveMap *cuma, float value) |
float | curvemapping_evaluateF (CurveMapping *cumap, int cur, float value) |
void | curvemapping_evaluate3F (CurveMapping *cumap, float vecout[3], const float vecin[3]) |
void | curvemapping_evaluateRGBF (CurveMapping *cumap, float vecout[3], const float vecin[3]) |
void | curvemapping_evaluate_premulRGBF (CurveMapping *cumap, float vecout[3], const float vecin[3]) |
void | curvemapping_do_ibuf (CurveMapping *cumap, ImBuf *ibuf) |
int | curvemapping_RGBA_does_something (CurveMapping *cumap) |
void | curvemapping_initialize (CurveMapping *cumap) |
void | curvemapping_table_RGBA (CurveMapping *cumap, float **array, int *size) |
DO_INLINE int | get_bin_float (float f) |
DO_INLINE void | save_sample_line (Scopes *scopes, const int idx, const float fx, float *rgb, float *ycc) |
void | scopes_update (Scopes *scopes, ImBuf *ibuf, int use_color_management) |
void | scopes_free (Scopes *scopes) |
void | scopes_new (Scopes *scopes) |
Definition in file colortools.c.
#define INV_255 (1.f/255.f) |
Definition at line 858 of file colortools.c.
Referenced by scopes_update().
static void calchandle_curvemap | ( | BezTriple * | bezt, |
BezTriple * | prev, | ||
BezTriple * | next, | ||
int | UNUSEDmode | ||
) | [static] |
Definition at line 320 of file colortools.c.
References BezTriple::h1, BezTriple::h2, HD_AUTO, HD_VECT, len(), len_v2(), madd_v2_v2v2fl(), NULL, sub_v2_v2v2(), and BezTriple::vec.
Referenced by curvemap_make_table().
static float curvemap_calc_extend | ( | CurveMap * | cuma, |
float | x, | ||
const float | first[2], | ||
const float | last[2] | ||
) | [static] |
Definition at line 390 of file colortools.c.
References CUMA_EXTEND_EXTRAPOLATE, CurveMap::ext_in, CurveMap::ext_out, and CurveMap::flag.
Referenced by curvemap_evaluateF(), and curvemap_make_table().
float curvemap_evaluateF | ( | CurveMap * | cuma, |
float | value | ||
) |
Definition at line 675 of file colortools.c.
References CM_TABLE, curvemap_calc_extend(), i, CurveMap::mintable, CurveMap::range, CurveMap::table, CurveMapPoint::x, and CurveMapPoint::y.
Referenced by curvemapping_do_ibuf(), curvemapping_evaluate_premulRGBF(), curvemapping_evaluateF(), and curvemapping_premultiply().
void curvemap_insert | ( | CurveMap * | cuma, |
float | x, | ||
float | y | ||
) |
Definition at line 171 of file colortools.c.
References CUMA_SELECT, CurveMap::curve, CurveMapPoint::flag, MEM_callocN(), MEM_freeN(), CurveMapPoint::shorty, CurveMap::totpoint, CurveMapPoint::x, and CurveMapPoint::y.
Referenced by ui_do_but_CURVE().
Definition at line 420 of file colortools.c.
References add_v3_v3v3(), calchandle_curvemap(), CM_RESOL, CM_TABLE, CM_TABLEDIV, copy_v3_v3(), correct_bezpart(), CUMA_VECTOR, CurveMap::curve, curvemap_calc_extend(), CurveMap::ext_in, CurveMap::ext_out, forward_diff_bezier(), BezTriple::h1, BezTriple::h2, HD_AUTO, HD_VECT, len_v3(), len_v3v3(), MAX2, CurveMap::maxtable, MEM_callocN(), MEM_freeN(), MIN2, CurveMap::mintable, mul_v3_fl(), NULL, CurveMap::range, sqrt(), sub_v3_v3(), sub_v3_v3v3(), CurveMap::table, CurveMap::totpoint, BezTriple::vec, CurveMapPoint::x, rctf::xmax, rctf::xmin, and CurveMapPoint::y.
Referenced by curvemapping_changed(), curvemapping_evaluateF(), curvemapping_initialize(), and curvemapping_premultiply().
void curvemap_remove | ( | CurveMap * | cuma, |
int | flag | ||
) |
Definition at line 150 of file colortools.c.
References CurveMap::curve, CurveMapPoint::flag, MEM_freeN(), MEM_mallocN(), and CurveMap::totpoint.
Referenced by curvemap_buttons_delete(), and curvemapping_changed().
Definition at line 200 of file colortools.c.
References CurveMap::curve, CURVE_PRESET_LINE, CURVE_PRESET_MAX, CURVE_PRESET_MID9, CURVE_PRESET_ROOT, CURVE_PRESET_ROUND, CURVE_PRESET_SHARP, CURVE_PRESET_SMOOTH, CURVEMAP_SLOPE_POSITIVE, CurveMapPoint::flag, i, MEM_callocN(), MEM_dupallocN(), MEM_freeN(), NULL, CurveMap::table, CurveMap::totpoint, CurveMapPoint::x, rctf::xmax, rctf::xmin, CurveMapPoint::y, rctf::ymax, and rctf::ymin.
Referenced by BKE_add_pointdensity(), brush_curve_preset(), curvemap_buttons_reset(), curvemap_tools_dofunc(), do_versions(), and node_composit_init_huecorrect().
void curvemap_sethandle | ( | CurveMap * | cuma, |
int | type | ||
) |
Definition at line 305 of file colortools.c.
References CUMA_SELECT, CUMA_VECTOR, CurveMap::curve, CurveMapPoint::flag, and CurveMap::totpoint.
Referenced by curvemap_tools_dofunc().
CurveMapping* curvemapping_add | ( | int | tot, |
float | minx, | ||
float | miny, | ||
float | maxx, | ||
float | maxy | ||
) | [read] |
Definition at line 59 of file colortools.c.
References BLI_init_rctf(), CurveMapping::bwmul, CurveMapping::changed_timestamp, CurveMapping::clipr, CurveMapping::cm, CUMA_DO_CLIP, CUMA_EXTEND_EXTRAPOLATE, CurveMapping::cur, CurveMapping::curr, CurveMap::curve, CurveMap::flag, CurveMapping::flag, MAX2, MEM_callocN(), MIN2, CurveMap::totpoint, CurveMapping::white, CurveMapPoint::x, and CurveMapPoint::y.
Referenced by add_lamp(), BKE_add_pointdensity(), brush_curve_preset(), do_versions(), image_panel_curves(), initData(), node_composit_init_curve_rgb(), node_composit_init_curve_vec(), node_composit_init_curves_time(), node_composit_init_huecorrect(), node_shader_init_curve_rgb(), node_shader_init_curve_vec(), rgb_init(), time_init(), and warpModifier_do().
void curvemapping_changed | ( | CurveMapping * | cumap, |
int | rem_doubles | ||
) |
Definition at line 613 of file colortools.c.
References CurveMapping::changed_timestamp, CurveMapping::clipr, CurveMapping::cm, CUMA_DO_CLIP, CUMA_SELECT, CurveMapping::cur, CurveMap::curve, curvemap_make_table(), curvemap_remove(), CurveMapPoint::flag, CurveMapping::flag, MAX2, MIN2, sort_curvepoints(), sqrtf, thresh, CurveMap::totpoint, CurveMapPoint::x, rctf::xmax, rctf::xmin, CurveMapPoint::y, rctf::ymax, and rctf::ymin.
Referenced by BKE_add_pointdensity(), brush_curve_preset(), curvemap_buttons_delete(), curvemap_buttons_reset(), curvemap_buttons_setclip(), curvemap_tools_dofunc(), do_versions(), ui_do_but_CURVE(), ui_draw_but_CURVE(), and ui_numedit_but_CURVE().
CurveMapping* curvemapping_copy | ( | CurveMapping * | cumap | ) | [read] |
Definition at line 110 of file colortools.c.
References CurveMapping::cm, CM_TOT, CurveMap::curve, MEM_dupallocN(), NULL, CurveMap::premultable, and CurveMap::table.
Referenced by add_render_lamp(), BKE_copy_pointdensity(), copy_brush(), copy_lamp(), copyData(), image_duplicate(), localize_lamp(), and node_copy_curves().
void curvemapping_do_ibuf | ( | CurveMapping * | cumap, |
ImBuf * | ibuf | ||
) |
Definition at line 744 of file colortools.c.
References ImBuf::channels, CurveMapping::cm, curvemap_evaluateF(), curvemapping_evaluate_premulRGBF(), curvemapping_premultiply(), imb_addrectImBuf(), IMB_dupImBuf(), IMB_float_from_rect(), IMB_freeImBuf(), IMB_rect_from_float(), NULL, ImBuf::rect, ImBuf::rect_float, SWAP, ImBuf::x, and ImBuf::y.
Referenced by image_sample_apply().
void curvemapping_evaluate3F | ( | CurveMapping * | cumap, |
float | vecout[3], | ||
const float | vecin[3] | ||
) |
Definition at line 711 of file colortools.c.
References curvemapping_evaluateF().
Referenced by node_shader_exec_curve_vec().
void curvemapping_evaluate_premulRGBF | ( | CurveMapping * | cumap, |
float | vecout[3], | ||
const float | vecin[3] | ||
) |
Definition at line 728 of file colortools.c.
References CurveMapping::black, CurveMapping::bwmul, CurveMapping::cm, and curvemap_evaluateF().
Referenced by curvemapping_do_ibuf(), do_curves(), do_curves_fac(), and node_composit_exec_curve_vec().
float curvemapping_evaluateF | ( | CurveMapping * | cumap, |
int | cur, | ||
float | value | ||
) |
Definition at line 697 of file colortools.c.
References CurveMapping::clipr, CurveMapping::cm, curvemap_evaluateF(), curvemap_make_table(), NULL, and CurveMap::table.
Referenced by accum_density(), brush_curve_strength(), brush_curve_strength_clamp(), curvemapping_evaluate3F(), curvemapping_evaluateRGBF(), do_huecorrect(), do_huecorrect_fac(), lamp_get_visibility(), node_composit_exec_curves_time(), time_colorfn(), warpModifier_do(), and weightvg_do_map().
void curvemapping_evaluateRGBF | ( | CurveMapping * | cumap, |
float | vecout[3], | ||
const float | vecin[3] | ||
) |
Definition at line 719 of file colortools.c.
References curvemapping_evaluateF().
Referenced by node_composit_exec_curve_rgb(), node_shader_exec_curve_rgb(), and rgb_colorfn().
void curvemapping_free | ( | CurveMapping * | cumap | ) |
Definition at line 96 of file colortools.c.
References CurveMapping::cm, CM_TOT, CurveMap::curve, MEM_freeN(), CurveMap::premultable, and CurveMap::table.
Referenced by BKE_free_pointdensitydata(), free_brush(), free_lamp(), freeData(), image_free(), node_free_curves(), and RE_Database_Free().
void curvemapping_initialize | ( | CurveMapping * | cumap | ) |
Definition at line 824 of file colortools.c.
References CurveMapping::clipr, CurveMapping::cm, CM_TOT, curvemap_make_table(), NULL, and CurveMap::table.
Referenced by add_lamp(), curvemapping_table_RGBA(), do_versions(), initData(), and ntreeCompositBeginExecTree().
void curvemapping_premultiply | ( | CurveMapping * | cumap, |
int | restore | ||
) |
Definition at line 559 of file colortools.c.
References CurveMapping::clipr, CurveMapping::cm, CM_TABLE, CUMA_PREMULLED, curvemap_evaluateF(), curvemap_make_table(), CurveMapping::flag, MEM_freeN(), MEM_mallocN(), NULL, CurveMap::premultable, CurveMap::table, and CurveMapPoint::y.
Referenced by curvemapping_do_ibuf(), ntreeCompositBeginExecTree(), and ntreeCompositEndExecTree().
int curvemapping_RGBA_does_something | ( | CurveMapping * | cumap | ) |
Definition at line 800 of file colortools.c.
References CurveMapping::black, CurveMapping::cm, CM_TOT, CurveMap::curve, CurveMap::totpoint, CurveMapping::white, CurveMapPoint::x, and CurveMapPoint::y.
void curvemapping_set_black_white | ( | CurveMapping * | cumap, |
const float | black[3], | ||
const float | white[3] | ||
) |
Definition at line 129 of file colortools.c.
References CurveMapping::black, CurveMapping::bwmul, copy_v3_v3(), and CurveMapping::white.
Referenced by curvemap_buttons_reset(), image_sample_apply(), and node_composit_exec_curve_rgb().
void curvemapping_table_RGBA | ( | CurveMapping * | cumap, |
float ** | array, | ||
int * | size | ||
) |
Definition at line 836 of file colortools.c.
References CurveMapping::cm, CM_TABLE, curvemapping_initialize(), MEM_callocN(), size(), CurveMap::table, and CurveMapPoint::y.
Referenced by gpu_shader_curve_rgb(), gpu_shader_curve_vec(), and lamp_get_visibility().
DO_INLINE int get_bin_float | ( | float | f | ) |
Definition at line 860 of file colortools.c.
References CLAMP().
Referenced by make_histogram_view_from_ibuf_float(), and scopes_update().
DO_INLINE void save_sample_line | ( | Scopes * | scopes, |
const int | idx, | ||
const float | fx, | ||
float * | rgb, | ||
float * | ycc | ||
) |
Definition at line 870 of file colortools.c.
References rgb_to_yuv(), SCOPES_WAVEFRM_LUMA, SCOPES_WAVEFRM_RGB, SCOPES_WAVEFRM_YCC_601, SCOPES_WAVEFRM_YCC_709, SCOPES_WAVEFRM_YCC_JPEG, Scopes::vecscope, Scopes::waveform_1, Scopes::waveform_2, Scopes::waveform_3, and Scopes::wavefrm_mode.
Referenced by scopes_update().
void scopes_free | ( | Scopes * | scopes | ) |
Definition at line 1071 of file colortools.c.
References MEM_freeN(), NULL, Scopes::vecscope, Scopes::waveform_1, Scopes::waveform_2, and Scopes::waveform_3.
Referenced by image_free().
void scopes_new | ( | Scopes * | scopes | ) |
Definition at line 1091 of file colortools.c.
References Scopes::accuracy, Histogram::height, Scopes::hist, HISTO_MODE_RGB, Histogram::mode, NULL, Scopes::ok, Scopes::vecscope, Scopes::vecscope_alpha, Scopes::vecscope_height, Scopes::waveform_1, Scopes::waveform_2, Scopes::waveform_3, Scopes::wavefrm_alpha, and Scopes::wavefrm_height.
Referenced by do_versions(), image_duplicate(), and image_new().
Definition at line 906 of file colortools.c.
References Scopes::accuracy, BLI_YCC_ITU_BT601, BLI_YCC_ITU_BT709, BLI_YCC_JFIF_0_255, ImBuf::channels, Histogram::channels, copy_v3_v3(), Histogram::data_b, Histogram::data_g, Histogram::data_luma, Histogram::data_r, div, ELEM, get_bin_float(), Scopes::hist, INV_255, linearrgb_to_srgb_v3_v3(), MEM_callocN(), MEM_freeN(), Scopes::minmax, NULL, Scopes::ok, ImBuf::rect, ImBuf::rect_float, rgb_to_luma(), rgb_to_ycc(), Scopes::sample_full, Scopes::sample_lines, save_sample_line(), SCOPES_WAVEFRM_LUMA, SCOPES_WAVEFRM_RGB, SCOPES_WAVEFRM_YCC_601, SCOPES_WAVEFRM_YCC_709, SCOPES_WAVEFRM_YCC_JPEG, Scopes::vecscope, Scopes::waveform_1, Scopes::waveform_2, Scopes::waveform_3, Scopes::waveform_tot, Scopes::wavefrm_mode, CurveMapPoint::x, ImBuf::x, Histogram::x_resolution, CurveMapPoint::y, ImBuf::y, and Histogram::ymax.
Referenced by image_scope_area_draw().
static int sort_curvepoints | ( | const void * | a1, |
const void * | a2 | ||
) | [static] |
Definition at line 601 of file colortools.c.
References CurveMapPoint::x.
Referenced by curvemapping_changed().