Skip to content

cf_softlight

Category: graphics
GitHub: cute_color.h


Returns a softlight blend, where the colors are darkened or lightened depending on the blend color.

float cf_softlight(float base, float blend) { if (blend <= 0.5f) return base - (1-2*blend)*base*(1-base); else return base + (2*blend-1) * (((base <= 0.25f) ? ((16*base-12) * base+4) * base : CF_SQRTF(base)) - base); }
Parameters Description
base The original color.
blend The blend color to apply a softlight effect with.

Remarks

This function attempts to mimic the Softlight Photoshop blend-layer mode. The blend color is used to adjust colors in the base, while still preserving shadows and highlights of the base.

CF_Color
cf_hue
cf_overlay_color
cf_softlight_color
cf_overlay