Example #1
0
//------------------------------------------------------------------------------
// setQ() -- set the Q value
//------------------------------------------------------------------------------
bool Yiq::setQ(Number* const msg)
{
    if (msg == 0) return false;
    LCreal value = msg->getReal();
    bool ok = (value >= -0.52 && value <= 0.52);
    if (ok) { yiq[Q] = value; yiq2rgb(color,yiq); }
    else std::cerr << "Yiq::setQ: invalid entry(" << value << "), valid range: -0.52 to 0.52" << std::endl;
    return ok;
}
Example #2
0
//------------------------------------------------------------------------------
// setY() -- set the Y value
//------------------------------------------------------------------------------
bool Yiq::setY(Number* const msg)
{
    if (msg == 0) return false;
    LCreal value = msg->getReal();
    bool ok = (value >= 0 && value <= 1);
    if (ok) { yiq[Y] = value; yiq2rgb(color,yiq); }
    else std::cerr << "Yiq::setY: invalid entry(" << value << "), valid range: 0 to 1" << std::endl;
    return ok;
}
Example #3
0
//------------------------------------------------------------------------------
// setI() -- set the I value
//------------------------------------------------------------------------------
bool Yiq::setI(Number* const msg)
{
    if (msg == nullptr) return false;
    const double value = msg->getReal();
    const bool ok = (value >= -0.6 && value <= 0.6);
    if (ok) { yiq[I] = value; yiq2rgb(color,yiq); }
    else std::cerr << "Yiq::setI: invalid entry(" << value << "), valid range: -0.6 to 0.6" << std::endl;
    return ok;
}
Example #4
0
// BANG - calculate and output
void cs_bang(t_cs *x)
{
	if(x->attr_mode == ps_rgb2hsl) rgb2hsl(x, x->val1, x->val2, x->val3); // first for speed
	else if(x->attr_mode == ps_hsl2rgb) hsl2rgb(x, x->val1, x->val2, x->val3);
	
	else if(x->attr_mode == ps_no_transform) no_transform(x);
	else if(x->attr_mode == ps_rgb2cmy) rgb2cmy(x, x->val1, x->val2, x->val3);
	else if(x->attr_mode == ps_cmy2rgb) cmy2rgb(x, x->val1, x->val2, x->val3);
	else if(x->attr_mode == ps_rgb2hsv) rgb2hsv(x, x->val1, x->val2, x->val3);
	else if(x->attr_mode == ps_hsv2rgb) hsv2rgb(x, x->val1, x->val2, x->val3);
	else if(x->attr_mode == ps_rgb2xyz) rgb2xyz(x, x->val1, x->val2, x->val3);
	else if(x->attr_mode == ps_xyz2rgb) xyz2rgb(x, x->val1, x->val2, x->val3);
	else if(x->attr_mode == ps_rgb2uvw) rgb2uvw(x, x->val1, x->val2, x->val3);
	else if(x->attr_mode == ps_uvw2rgb) uvw2rgb(x, x->val1, x->val2, x->val3);
	else if(x->attr_mode == ps_rgb2retinalcone) rgb2cone(x, x->val1, x->val2, x->val3);
	else if(x->attr_mode == ps_retinalcone2rgb) cone2rgb(x, x->val1, x->val2, x->val3);
	else if(x->attr_mode == ps_rgb2lab) rgb2lab(x, x->val1, x->val2, x->val3);
	else if(x->attr_mode == ps_lab2rgb) lab2rgb(x, x->val1, x->val2, x->val3);
	else if(x->attr_mode == ps_rgb2yiq) rgb2yiq(x, x->val1, x->val2, x->val3);
	else if(x->attr_mode == ps_yiq2rgb) yiq2rgb(x, x->val1, x->val2, x->val3);
	else if(x->attr_mode == ps_rgb2hls) rgb2hls(x, x->val1, x->val2, x->val3);
	else if(x->attr_mode == ps_hls2rgb) hls2rgb(x, x->val1, x->val2, x->val3);
	else if(x->attr_mode == ps_rgb2rgbcie) rgb2rgbcie(x, x->val1, x->val2, x->val3);
	else if(x->attr_mode == ps_rgbcie2rgb) rgbcie2rgb(x, x->val1, x->val2, x->val3);
	else if(x->attr_mode == ps_rgb2rgbsmpte) rgb2rgbsmpte(x, x->val1, x->val2, x->val3);
	else if(x->attr_mode == ps_rgbsmpte2rgb) rgbsmpte2rgb(x, x->val1, x->val2, x->val3);

	if(x->attr_outputtype == ps_packed){
		Atom temp_list[3];
		atom_setlong(temp_list+0, x->calc1);
		atom_setlong(temp_list+1, x->calc2);
		atom_setlong(temp_list+2, x->calc3);
		outlet_list(x->out1, 0L, 3, temp_list);	// output the result
	}	
	else{
		outlet_int(x->out3, x->calc3);	// output the result	
		outlet_int(x->out2, x->calc2);	// output the result	
		outlet_int(x->out1, x->calc1);	// output the result
	}	
}