Blender
V3.3
|
Go to the source code of this file.
Variables | |
float | BLI_color_from_srgb_table [256] |
unsigned short | BLI_color_to_srgb_table [0x10000] |
Definition at line 567 of file math_color.c.
References usdtokens::b(), BLI_color_from_srgb_table, BLI_color_to_srgb_table, hipart(), index_to_float(), initialized, linearrgb_to_srgb(), and srgb_to_linearrgb().
Referenced by colormanagement_init(), and blender::tests::TEST().
If the requested RGB shade contains a negative weight for one of the primaries, it lies outside the color gamut accessible from the given triple of primaries. Desaturate it by adding white, equal quantities of R, G, and B, enough to make RGB all positive. The function returns 1 if the components were modified, zero otherwise.
Definition at line 445 of file math_color.c.
References usdtokens::b(), usdtokens::g(), min_ffff(), r, and w().
Definition at line 369 of file math_color.c.
Referenced by BKE_palette_from_hash().
Definition at line 177 of file math_color.c.
References CLAMP, and float().
Referenced by BKE_gpencil_palette_ensure(), and ui_colorpicker_hex_rna_cb().
|
static |
Definition at line 520 of file math_color.c.
Referenced by BLI_init_srgb_conversion().
Definition at line 30 of file math_color.c.
References CLAMP, fabsf, and l.
Referenced by BKE_icon_geom_invert_lightness(), blender::nodes::get_multi_function(), hsl_to_rgb_v(), and svm_combine_color().
Definition at line 54 of file math_color.c.
References hsl_to_rgb().
Referenced by BKE_colorband_evaluate(), color_mul_hsl_v3(), colorfn(), blender::compositor::ConvertHSLToRGBOperation::execute_pixel_sampled(), TEST(), ui_color_picker_hsv_to_rgb(), ui_color_picker_to_rgb_HSVCUBE_v(), and blender::compositor::ConvertHSLToRGBOperation::update_memory_buffer_partial().
Clamp hsv
to usable values.
Definition at line 323 of file math_color.c.
We define a 'cpack' here as a (3 byte color code) number that can be expressed like 0xFFAA66 or so. For that reason it is sensitive for endianness... with this function it works correctly.
Definition at line 332 of file math_color.c.
References usdtokens::b(), col, usdtokens::g(), hsv_to_rgb(), r, and v.
Definition at line 13 of file math_color.c.
References CLAMP, fabsf, and v.
Referenced by BKE_paint_face_set_overlay_color_get(), blend_color_color_byte(), blend_color_color_float(), blend_color_hue_byte(), blend_color_hue_float(), blend_color_luminosity_byte(), blend_color_luminosity_float(), blend_color_saturation_byte(), blend_color_saturation_float(), CombineHSVNode::constant_fold(), do_hue_sat_fac(), blender::compositor::MixColorOperation::execute_pixel_sampled(), blender::compositor::MixHueOperation::execute_pixel_sampled(), blender::compositor::MixSaturationOperation::execute_pixel_sampled(), blender::compositor::MixValueOperation::execute_pixel_sampled(), blender::nodes::get_multi_function(), hsv_to_cpack(), hsv_to_rgb_v(), hue_correct_apply_threaded(), IMB_saturation(), blender::color::mix_color(), blender::color::mix_hue(), blender::color::mix_luminosity(), blender::color::mix_saturation(), ramp_blend(), rgb_float_set_hue_float_offset(), svm_combine_color(), svm_mix_color(), svm_mix_hue(), svm_mix_sat(), svm_mix_val(), svm_node_combine_hsv(), svm_node_hsv(), ui_draw_gradient(), blender::compositor::MixColorOperation::update_memory_buffer_row(), blender::compositor::MixHueOperation::update_memory_buffer_row(), blender::compositor::MixSaturationOperation::update_memory_buffer_row(), and blender::compositor::MixValueOperation::update_memory_buffer_row().
Definition at line 49 of file math_color.c.
References hsv_to_rgb().
Referenced by BKE_colorband_evaluate(), checker_board_color_fill(), Color_channel_hsv_set(), color_filter_task_cb(), Color_hsv_set(), colorfn(), deformStroke(), DRW_evaluate_weight_to_color(), blender::compositor::ConvertHSVToRGBOperation::execute_pixel_sampled(), getcolor_fcurve_rainbow(), gpencil_layer_random_color_get(), gpencil_sbuffer_vertex_color_random(), gpencil_vertexpaint_hsv_exec(), graph_refresh_fcurve_colors(), image_buf_fill_checker_slice(), rgb_tint(), TEST(), ui_color_picker_hsv_to_rgb(), ui_color_picker_to_rgb_HSVCUBE_v(), ui_do_but_COLOR(), ui_do_but_HSVCIRCLE(), blender::compositor::ConvertHSVToRGBOperation::update_memory_buffer_partial(), vertex_color_hsv_exec(), and workbench_material_ubo_data().
|
static |
Definition at line 536 of file math_color.c.
Referenced by BLI_init_srgb_conversion().
void lift_gamma_gain_to_asc_cdl | ( | const float * | lift, |
const float * | gamma, | ||
const float * | gain, | ||
float * | offset, | ||
float * | slope, | ||
float * | power | ||
) |
Definition at line 464 of file math_color.c.
References Freestyle::c, and offset.
Definition at line 412 of file math_color.c.
References Freestyle::c, and powf.
Referenced by BLI_init_srgb_conversion(), blender::compositor::colorbalance_lgg(), ibuftoimage(), imb_savepng(), imb_savetiff(), linearrgb_to_srgb_v3_v3(), studiolight_irradiance_preview(), studiolight_matcap_preview(), studiolight_radiance_preview(), and TEST().
void minmax_rgb | ( | short | c[3] | ) |
Definition at line 421 of file math_color.c.
References Freestyle::c.
Applies an HUE offset to a byte RGB color.
Definition at line 503 of file math_color.c.
References usdtokens::rgb(), rgb_float_set_hue_float_offset(), rgb_float_to_uchar(), and rgb_uchar_to_float().
Referenced by color3ubv_from_seq().
Applies an HUE offset to a float RGB color.
Definition at line 486 of file math_color.c.
References hsv_to_rgb(), usdtokens::rgb(), and rgb_to_hsv().
Referenced by rgb_byte_set_hue_float_offset().
Definition at line 391 of file math_color.c.
References unit_float_to_uchar_clamp_v3.
Referenced by apply_tangmat_callback(), BKE_icon_geom_invert_lightness(), brush_painter_imbuf_new(), color_mul_hsl_v3(), do_projectpaint_thread(), draw_channel_strips(), draw_color_strip_band(), draw_seq_background(), drawmeta_contents(), hue_correct_apply_threaded(), IMB_buffer_byte_from_float(), IMB_buffer_byte_from_float_mask(), IMB_saturation(), partial_buffer_update_rect(), project_paint_uvpixel_init(), rgb_byte_set_hue_float_offset(), ui_block_colorpicker(), ui_tooltip_region_draw_cb(), and ui_update_color_picker_buts_rgb().
Definition at line 348 of file math_color.c.
References usdtokens::b(), floorf, usdtokens::g(), max_ff(), and r.
Referenced by create_mono_icon_with_border(), gpencil_extract_palette_from_vertex(), palette_extract_img_exec(), studiolight_irradiance_preview(), studiolight_matcap_preview(), and studiolight_radiance_preview().
Definition at line 237 of file math_color.c.
References usdtokens::b(), usdtokens::g(), l, max_fff(), min_ff(), min_fff(), and r.
Referenced by blender::nodes::SeparateHSLAFunction::call(), rgb_to_hsl_compat(), rgb_to_hsl_v(), and svm_separate_color().
Definition at line 266 of file math_color.c.
References usdtokens::b(), usdtokens::g(), r, and rgb_to_hsl().
Referenced by rgb_to_hsl_compat_v().
Definition at line 287 of file math_color.c.
References usdtokens::rgb(), and rgb_to_hsl_compat().
Referenced by ui_color_picker_rgb_to_hsv_compat(), and ui_rgb_to_color_picker_HSVCUBE_compat_v().
Definition at line 292 of file math_color.c.
References usdtokens::rgb(), and rgb_to_hsl().
Referenced by apply_color_space(), BKE_colorband_evaluate(), BKE_icon_geom_invert_lightness(), color_mul_hsl_v3(), blender::compositor::ConvertRGBToHSLOperation::execute_pixel_sampled(), TEST(), ui_color_picker_rgb_to_hsv(), ui_draw_but_HSV_v(), ui_rgb_to_color_picker_HSVCUBE_v(), and blender::compositor::ConvertRGBToHSLOperation::update_memory_buffer_partial().
Definition at line 208 of file math_color.c.
References usdtokens::b(), fabsf, usdtokens::g(), min_ff(), r, and SWAP.
Referenced by BKE_palette_from_hash(), blend_color_color_byte(), blend_color_color_float(), blend_color_hue_byte(), blend_color_hue_float(), blend_color_luminosity_byte(), blend_color_luminosity_float(), blend_color_saturation_byte(), blend_color_saturation_float(), blender::nodes::SeparateHSVAFunction::call(), Color_channel_hsv_get(), Color_hsv_get(), SeparateHSVNode::constant_fold(), do_hue_sat_fac(), ED_image_draw_info(), blender::compositor::MixColorOperation::execute_pixel_sampled(), blender::compositor::MixHueOperation::execute_pixel_sampled(), blender::compositor::MixSaturationOperation::execute_pixel_sampled(), blender::compositor::MixValueOperation::execute_pixel_sampled(), hue_correct_apply_threaded(), blender::color::mix_color(), blender::color::mix_hue(), blender::color::mix_luminosity(), blender::color::mix_saturation(), palette_sort_exec(), ramp_blend(), rgb_float_set_hue_float_offset(), rgb_to_hsv_compat(), rgb_to_hsv_v(), svm_mix_color(), svm_mix_hue(), svm_mix_sat(), svm_mix_val(), svm_node_hsv(), svm_node_separate_hsv(), svm_separate_color(), blender::compositor::MixColorOperation::update_memory_buffer_row(), blender::compositor::MixHueOperation::update_memory_buffer_row(), blender::compositor::MixSaturationOperation::update_memory_buffer_row(), and blender::compositor::MixValueOperation::update_memory_buffer_row().
Definition at line 297 of file math_color.c.
References usdtokens::b(), e, usdtokens::g(), r, and rgb_to_hsv().
Referenced by rgb_to_hsv_compat_v().
Definition at line 318 of file math_color.c.
References usdtokens::rgb(), and rgb_to_hsv_compat().
Referenced by BKE_gpencil_merge_materials_table_get(), gpencil_select_vertex_color_exec(), gpencil_selected_hue_table(), ui_color_picker_rgb_to_hsv_compat(), ui_do_but_COLOR(), ui_draw_but_HSVCUBE(), and ui_rgb_to_color_picker_HSVCUBE_compat_v().
Definition at line 232 of file math_color.c.
References usdtokens::rgb(), and rgb_to_hsv().
Referenced by apply_color_space(), BKE_colorband_evaluate(), Color_channel_hsv_set(), color_filter_task_cb(), deformStroke(), blender::compositor::ConvertRGBToHSVOperation::execute_pixel_sampled(), gpencil_check_same_material_color(), gpencil_sbuffer_vertex_color_random(), gpencil_vertexpaint_hsv_exec(), graph_refresh_fcurve_colors(), IMB_saturation(), rgb_tint(), TEST(), ui_color_picker_rgb_to_hsv(), ui_draw_but_CURVE(), ui_draw_but_HSV_v(), ui_rgb_to_color_picker_HSVCUBE_v(), blender::compositor::ConvertRGBToHSVOperation::update_memory_buffer_partial(), vertex_color_hsv_exec(), and weightvg_do_mask().
void rgb_to_ycc | ( | float | r, |
float | g, | ||
float | b, | ||
float * | r_y, | ||
float * | r_cb, | ||
float * | r_cr, | ||
int | colorspace | ||
) |
The RGB inputs are supposed gamma corrected and in the range 0 - 1.0f
Output YCC have a range of 16-235 and 16-240 except with JFIF_0_255 where the range is 0-255.
Definition at line 107 of file math_color.c.
References usdtokens::b(), BLI_assert_msg, BLI_YCC_ITU_BT601, BLI_YCC_ITU_BT709, BLI_YCC_JFIF_0_255, usdtokens::g(), r, and y.
Referenced by blender::compositor::ConvertRGBToYCCOperation::execute_pixel_sampled(), scopes_update_cb(), TEST(), and blender::compositor::ConvertRGBToYCCOperation::update_memory_buffer_partial().
void rgb_to_yuv | ( | float | r, |
float | g, | ||
float | b, | ||
float * | r_y, | ||
float * | r_u, | ||
float * | r_v, | ||
int | colorspace | ||
) |
Definition at line 59 of file math_color.c.
References usdtokens::b(), BLI_assert, BLI_YUV_ITU_BT601, BLI_YUV_ITU_BT709, usdtokens::g(), r, v, and y.
Referenced by blender::compositor::CalculateMeanOperation::calculate_mean(), ED_image_draw_info(), blender::compositor::ConvertRGBToYUVOperation::execute_pixel_sampled(), blender::compositor::CalculateStandardDeviationOperation::initialize_tile_data(), save_sample_line(), blender::compositor::CalculateMeanOperation::set_setting(), TEST(), blender::compositor::ConvertRGBToYUVOperation::update_memory_buffer_partial(), and vectorscope_draw_target().
Definition at line 376 of file math_color.c.
References float().
Referenced by acf_generic_channel_color(), acf_group_color(), BKE_icon_geom_invert_lightness(), color_mul_hsl_v3(), curves_apply_threaded(), display_buffer_apply_get_linear_buffer(), ED_space_clip_color_sample(), ED_space_image_color_sample(), ED_space_node_color_sample(), gl_shaded_color_get_fl(), hue_correct_apply_threaded(), IMB_colormanagement_get_luminance_byte(), IMB_saturation(), paint_and_tex_color_alpha(), paint_sample_color(), pointdensity_cache_vertex_color(), rgb_byte_set_hue_float_offset(), set_pchan_color(), tonemapmodifier_apply_threaded_photoreceptor(), tonemapmodifier_apply_threaded_simple(), ui_draw_but_CURVE(), ui_draw_but_CURVEPROFILE(), ui_tooltip_region_draw_cb(), and whiteBalance_apply_threaded().
Definition at line 396 of file math_color.c.
References unit_float_to_uchar_clamp_v4.
Referenced by BKE_paint_face_set_overlay_color_get(), BLF_color4fv(), blf_draw_buffer__start(), BLF_shadow(), blender::BLI_color_convert_to_theme4b(), brush_painter_imbuf_update(), dynamic_paint_apply_surface_vpaint_cb(), blender::compositor::PreviewOperation::execute_region(), blender::bke::from_float(), image_buf_fill_color_slice(), IMB_buffer_byte_from_byte(), IMB_buffer_byte_from_float(), IMB_buffer_byte_from_float_mask(), IMB_colormanagement_processor_apply_byte(), mloopcol_from_float(), paint_2d_gradient_fill(), partial_buffer_update_rect(), snap_gizmo_setup(), UI_but_node_link_set(), ui_draw_widget_back_color(), uiTemplateNodeSocket(), blender::compositor::PreviewOperation::update_memory_buffer_partial(), widget_swatch(), and blender::ed::sculpt_paint::paint::image::ImageBufferByte4::write_pixel().
Definition at line 383 of file math_color.c.
References float().
Referenced by accessor_get_ibuf(), blender::BLI_color_convert_to_theme4f(), display_buffer_apply_get_linear_buffer(), draw_columnheader_columns(), dynamic_paint_set_init_color_vcol_to_imseq_cb(), dynamicPaint_setInitialColor(), eyedropper_draw_cursor_text_ex(), icon_draw_size(), image_sample_apply(), image_sample_pixel_color_ubyte(), IMB_buffer_byte_from_byte(), IMB_buffer_float_from_byte(), IMB_colormanagement_imbuf_to_float_texture(), IMB_colormanagement_processor_apply_byte(), IMB_sampleImageAtLocation(), knifetool_draw(), mask_draw_curve_type(), mloopcol_to_float(), paint_2d_bucket_fill(), paint_2d_fill_add_pixel_byte(), partial_buffer_update_rect(), project_paint_uvpixel_init(), blender::ed::sculpt_paint::paint::image::ImageBufferByte4::read_pixel(), blender::compositor::sample_image_at_location(), textview_draw_string(), blender::bke::to_float(), ui_draw_but_IMAGE(), widget_draw_node_link_socket(), widget_draw_submenu_tria(), wm_drop_operator_draw(), and wm_drop_redalert_draw().
Definition at line 403 of file math_color.c.
References Freestyle::c, and powf.
Referenced by BLI_init_srgb_conversion(), blender::compositor::KeyingScreenOperation::build_voronoi_triangulation(), blender::compositor::colorbalance_lgg(), image_buf_fill_checker_slice(), imb_save_openexr_half(), srgb_to_linearrgb_v3_v3(), and TEST().
void ycc_to_rgb | ( | float | y, |
float | cb, | ||
float | cr, | ||
float * | r_r, | ||
float * | r_g, | ||
float * | r_b, | ||
int | colorspace | ||
) |
Definition at line 142 of file math_color.c.
References usdtokens::b(), BLI_assert_unreachable, BLI_YCC_ITU_BT601, BLI_YCC_ITU_BT709, BLI_YCC_JFIF_0_255, usdtokens::g(), r, and y.
Referenced by blender::compositor::ConvertYCCToRGBOperation::execute_pixel_sampled(), imb_load_openexr(), TEST(), and blender::compositor::ConvertYCCToRGBOperation::update_memory_buffer_partial().
void yuv_to_rgb | ( | float | y, |
float | u, | ||
float | v, | ||
float * | r_r, | ||
float * | r_g, | ||
float * | r_b, | ||
int | colorspace | ||
) |
Definition at line 83 of file math_color.c.
References usdtokens::b(), BLI_assert, BLI_YUV_ITU_BT601, BLI_YUV_ITU_BT709, usdtokens::g(), r, v, and y.
Referenced by blender::compositor::ConvertYUVToRGBOperation::execute_pixel_sampled(), TEST(), and blender::compositor::ConvertYUVToRGBOperation::update_memory_buffer_partial().
float BLI_color_from_srgb_table[256] |
Definition at line 517 of file math_color.c.
Referenced by BLI_init_srgb_conversion(), blender::draw::AttributeTypeConverter< ColorGeometry4b, gpuMeshCol >::convert_value(), GPU_pbvh_mesh_buffers_update(), particle_pack_mcol(), and srgb_to_linearrgb_uchar4().
unsigned short BLI_color_to_srgb_table[0x10000] |
Definition at line 518 of file math_color.c.
Referenced by BLI_init_srgb_conversion(), and to_srgb_table_lookup().