static void node_composit_exec_curve_rgb(void *UNUSED(data), bNode *node, bNodeStack **in, bNodeStack **out) { /* stack order input: fac, image, black level, white level */ /* stack order output: image */ if (out[0]->hasoutput==0) return; curvemapping_initialize(node->storage); /* input no image? then only color operation */ if (in[1]->data==NULL) { curvemapping_evaluateRGBF(node->storage, out[0]->vec, in[1]->vec); } else { /* make output size of input image */ CompBuf *cbuf= in[1]->data; CompBuf *stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); /* allocs */ curvemapping_set_black_white(node->storage, in[2]->vec, in[3]->vec); if (in[0]->data==NULL && in[0]->vec[0] == 1.0f) composit1_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, do_curves, CB_RGBA); else composit2_pixel_processor(node, stackbuf, in[1]->data, in[1]->vec, in[0]->data, in[0]->vec, do_curves_fac, CB_RGBA, CB_VAL); out[0]->data= stackbuf; } }
static void rna_CurveMapping_black_level_set(PointerRNA *ptr, const float *values) { CurveMapping *cumap = (CurveMapping *)ptr->data; cumap->black[0] = values[0]; cumap->black[1] = values[1]; cumap->black[2] = values[2]; curvemapping_set_black_white(cumap, NULL, NULL); }
static void curves_apply(struct SequenceModifierData *smd, ImBuf *ibuf, ImBuf *mask) { CurvesModifierData *cmd = (CurvesModifierData *) smd; float black[3] = {0.0f, 0.0f, 0.0f}; float white[3] = {1.0f, 1.0f, 1.0f}; curvemapping_initialize(&cmd->curve_mapping); curvemapping_premultiply(&cmd->curve_mapping, 0); curvemapping_set_black_white(&cmd->curve_mapping, black, white); modifier_apply_threaded(ibuf, mask, curves_apply_threaded, &cmd->curve_mapping); curvemapping_premultiply(&cmd->curve_mapping, 1); }