Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenlib/intern/math_color_blend_inline.c
| Context not available. | |||||
| int temp; | int temp; | ||||
| if (src2[i] == 255) { | if (src2[i] == 255) { | ||||
| temp = 255; | temp = (src1[i] == 0) ? 127 : 255; | ||||
| } | } | ||||
| else if (src2[i] == 0) { | else if (src2[i] == 0) { | ||||
| temp = 0; | temp = (src1[i] == 255) ? 127 : 0; | ||||
| } | } | ||||
| else if (src2[i] > 127) { | else if (src2[i] > 127) { | ||||
| temp = min_ii(((src1[i]) * 255) / (2 * (255 - src2[i])), 255); | temp = min_ii(((src1[i]) * 255) / (2 * (255 - src2[i])), 255); | ||||
| Context not available. | |||||
| MINLINE void blend_color_overlay_float(float dst[4], const float src1[4], const float src2[4]) | MINLINE void blend_color_overlay_float(float dst[4], const float src1[4], const float src2[4]) | ||||
| { | { | ||||
| const float fac = src2[3]; | const float fac = src2[3]; | ||||
| if (fac != 0.0f && fac < 1.0f) { | if (fac != 0.0f) { | ||||
| const float mfac = 1.0f - fac; | const float mfac = 1.0f - fac; | ||||
| int i = 3; | int i = 3; | ||||
| Context not available. | |||||
| MINLINE void blend_color_hardlight_float(float dst[4], const float src1[4], const float src2[4]) | MINLINE void blend_color_hardlight_float(float dst[4], const float src1[4], const float src2[4]) | ||||
| { | { | ||||
| const float fac = src2[3]; | const float fac = src2[3]; | ||||
| if (fac != 0.0f && fac < 1.0f) { | if (fac != 0.0f) { | ||||
| const float mfac = 1.0f - fac; | const float mfac = 1.0f - fac; | ||||
| int i = 3; | int i = 3; | ||||
| Context not available. | |||||
| MINLINE void blend_color_burn_float(float dst[4], const float src1[4], const float src2[4]) | MINLINE void blend_color_burn_float(float dst[4], const float src1[4], const float src2[4]) | ||||
| { | { | ||||
| const float fac = src2[3]; | const float fac = src2[3]; | ||||
| if (fac != 0.0f && fac < 1.0f) { | if (fac != 0.0f) { | ||||
| const float mfac = 1.0f - fac; | const float mfac = 1.0f - fac; | ||||
| int i = 3; | int i = 3; | ||||
| Context not available. | |||||
| MINLINE void blend_color_linearburn_float(float dst[4], const float src1[4], const float src2[4]) | MINLINE void blend_color_linearburn_float(float dst[4], const float src1[4], const float src2[4]) | ||||
| { | { | ||||
| const float fac = src2[3]; | const float fac = src2[3]; | ||||
| if (fac != 0.0f && fac < 1.0f) { | if (fac != 0.0f) { | ||||
| const float mfac = 1.0f - fac; | const float mfac = 1.0f - fac; | ||||
| int i = 3; | int i = 3; | ||||
| Context not available. | |||||
| MINLINE void blend_color_dodge_float(float dst[4], const float src1[4], const float src2[4]) | MINLINE void blend_color_dodge_float(float dst[4], const float src1[4], const float src2[4]) | ||||
| { | { | ||||
| const float fac = src2[3]; | const float fac = src2[3]; | ||||
| if (fac != 0.0f && fac < 1.0f) { | if (fac != 0.0f) { | ||||
| const float mfac = 1.0f - fac; | const float mfac = 1.0f - fac; | ||||
| int i = 3; | int i = 3; | ||||
| Context not available. | |||||
| MINLINE void blend_color_screen_float(float dst[4], const float src1[4], const float src2[4]) | MINLINE void blend_color_screen_float(float dst[4], const float src1[4], const float src2[4]) | ||||
| { | { | ||||
| const float fac = src2[3]; | const float fac = src2[3]; | ||||
| if (fac != 0.0f && fac < 1.0f) { | if (fac != 0.0f) { | ||||
| const float mfac = 1.0f - fac; | const float mfac = 1.0f - fac; | ||||
| int i = 3; | int i = 3; | ||||
| Context not available. | |||||
| MINLINE void blend_color_softlight_float(float dst[4], const float src1[4], const float src2[4]) | MINLINE void blend_color_softlight_float(float dst[4], const float src1[4], const float src2[4]) | ||||
| { | { | ||||
| const float fac = src2[3]; | const float fac = src2[3]; | ||||
| if (fac != 0.0f && fac < 1.0f) { | if (fac != 0.0f) { | ||||
| const float mfac = 1.0f - fac; | const float mfac = 1.0f - fac; | ||||
| int i = 3; | int i = 3; | ||||
| Context not available. | |||||
| MINLINE void blend_color_pinlight_float(float dst[4], const float src1[4], const float src2[4]) | MINLINE void blend_color_pinlight_float(float dst[4], const float src1[4], const float src2[4]) | ||||
| { | { | ||||
| const float fac = src2[3]; | const float fac = src2[3]; | ||||
| if (fac != 0.0f && fac < 1.0f) { | if (fac != 0.0f) { | ||||
| const float mfac = 1.0f - fac; | const float mfac = 1.0f - fac; | ||||
| int i = 3; | int i = 3; | ||||
| Context not available. | |||||
| MINLINE void blend_color_linearlight_float(float dst[4], const float src1[4], const float src2[4]) | MINLINE void blend_color_linearlight_float(float dst[4], const float src1[4], const float src2[4]) | ||||
| { | { | ||||
| const float fac = src2[3]; | const float fac = src2[3]; | ||||
| if (fac != 0.0f && fac < 1.0f) { | if (fac != 0.0f) { | ||||
| const float mfac = 1.0f - fac; | const float mfac = 1.0f - fac; | ||||
| int i = 3; | int i = 3; | ||||
| Context not available. | |||||
| MINLINE void blend_color_vividlight_float(float dst[4], const float src1[4], const float src2[4]) | MINLINE void blend_color_vividlight_float(float dst[4], const float src1[4], const float src2[4]) | ||||
| { | { | ||||
| const float fac = src2[3]; | const float fac = src2[3]; | ||||
| if (fac != 0.0f && fac < 1.0f) { | if (fac != 0.0f) { | ||||
| const float mfac = 1.0f - fac; | const float mfac = 1.0f - fac; | ||||
| int i = 3; | int i = 3; | ||||
| Context not available. | |||||
| float temp; | float temp; | ||||
| if (src2[i] == 1.0f) { | if (src2[i] == 1.0f) { | ||||
| temp = 1.0f; | temp = (src1[i] == 0.0f) ? 0.5f : 1.0f; | ||||
| } | } | ||||
| else if (src2[i] == 0.0f) { | else if (src2[i] == 0.0f) { | ||||
| temp = 0.0f; | temp = (src1[i] == 1.0f) ? 0.5f : 0.0f; | ||||
| } | } | ||||
| else if (src2[i] > 0.5f) { | else if (src2[i] > 0.5f) { | ||||
| temp = min_ff(((src1[i]) * 1.0f) / (2.0f * (1.0f - src2[i])), 1.0f); | temp = min_ff(((src1[i]) * 1.0f) / (2.0f * (1.0f - src2[i])), 1.0f); | ||||
| Context not available. | |||||
| MINLINE void blend_color_difference_float(float dst[4], const float src1[4], const float src2[4]) | MINLINE void blend_color_difference_float(float dst[4], const float src1[4], const float src2[4]) | ||||
| { | { | ||||
| const float fac = src2[3]; | const float fac = src2[3]; | ||||
| if (fac != 0.0f && fac < 1.0f) { | if (fac != 0.0f) { | ||||
| const float mfac = 1.0f - fac; | const float mfac = 1.0f - fac; | ||||
| int i = 3; | int i = 3; | ||||
| Context not available. | |||||
| MINLINE void blend_color_exclusion_float(float dst[4], const float src1[4], const float src2[4]) | MINLINE void blend_color_exclusion_float(float dst[4], const float src1[4], const float src2[4]) | ||||
| { | { | ||||
| const float fac = src2[3]; | const float fac = src2[3]; | ||||
| if (fac != 0.0f && fac < 1.0f) { | if (fac != 0.0f) { | ||||
| const float mfac = 1.0f - fac; | const float mfac = 1.0f - fac; | ||||
| int i = 3; | int i = 3; | ||||
| Context not available. | |||||
| MINLINE void blend_color_color_float(float dst[4], const float src1[4], const float src2[4]) | MINLINE void blend_color_color_float(float dst[4], const float src1[4], const float src2[4]) | ||||
| { | { | ||||
| const float fac = src2[3]; | const float fac = src2[3]; | ||||
| if (fac != 0.0f && fac < 1.0f) { | if (fac != 0.0f) { | ||||
| const float mfac = 1.0f - fac; | const float mfac = 1.0f - fac; | ||||
| float h1, s1, v1; | float h1, s1, v1; | ||||
| float h2, s2, v2; | float h2, s2, v2; | ||||
| Context not available. | |||||
| MINLINE void blend_color_hue_float(float dst[4], const float src1[4], const float src2[4]) | MINLINE void blend_color_hue_float(float dst[4], const float src1[4], const float src2[4]) | ||||
| { | { | ||||
| const float fac = src2[3]; | const float fac = src2[3]; | ||||
| if (fac != 0.0f && fac < 1.0f) { | if (fac != 0.0f) { | ||||
| const float mfac = 1.0f - fac; | const float mfac = 1.0f - fac; | ||||
| float h1, s1, v1; | float h1, s1, v1; | ||||
| float h2, s2, v2; | float h2, s2, v2; | ||||
| Context not available. | |||||
| MINLINE void blend_color_saturation_float(float dst[4], const float src1[4], const float src2[4]) | MINLINE void blend_color_saturation_float(float dst[4], const float src1[4], const float src2[4]) | ||||
| { | { | ||||
| const float fac = src2[3]; | const float fac = src2[3]; | ||||
| if (fac != 0.0f && fac < 1.0f) { | if (fac != 0.0f) { | ||||
| const float mfac = 1.0f - fac; | const float mfac = 1.0f - fac; | ||||
| float h1, s1, v1; | float h1, s1, v1; | ||||
| float h2, s2, v2; | float h2, s2, v2; | ||||
| Context not available. | |||||
| MINLINE void blend_color_luminosity_float(float dst[4], const float src1[4], const float src2[4]) | MINLINE void blend_color_luminosity_float(float dst[4], const float src1[4], const float src2[4]) | ||||
| { | { | ||||
| const float fac = src2[3]; | const float fac = src2[3]; | ||||
| if (fac != 0.0f && fac < 1.0f) { | if (fac != 0.0f) { | ||||
| const float mfac = 1.0f - fac; | const float mfac = 1.0f - fac; | ||||
| float h1, s1, v1; | float h1, s1, v1; | ||||
| float h2, s2, v2; | float h2, s2, v2; | ||||
| Context not available. | |||||