Beispiel #1
0
void Color::applySettings(ResourceDescriptor settings) {

    std::vector<std::string> values = split(settings.getValue(), ',');
    if (values.size() == 3 || values.size() == 4) {
        setRed(std::stoi(values[0]));
        setGreen(std::stoi(values[1]));
        setBlue(std::stoi(values[2]));
    }
    if (values.size() == 4) {
        setAlpha(std::stoi(values[2]));
    }

    ResourceDescriptor sub = settings.getSubResource("Red");
    if (isNotEmpty(sub.getValue())) {
        setRed(std::stoi(sub.getValue()));
    }

    sub = settings.getSubResource("Green");
    if (isNotEmpty(sub.getValue())) {
        setGreen(std::stoi(sub.getValue()));
    }

    sub = settings.getSubResource("Blue");
    if (isNotEmpty(sub.getValue())) {
        setBlue(std::stoi(sub.getValue()));
    }

    sub = settings.getSubResource("Alpha");
    if (isNotEmpty(sub.getValue())) {
        setAlpha(std::stoi(sub.getValue()));
    }

}
Beispiel #2
0
void Color::set( Color c )
{
	setRed( c.getRed() );
	setGreen( c.getGreen() );
	setBlue( c.getBlue() );
	setAlpha( c.getAlpha() );
}
Beispiel #3
0
Color::Color( const Colorf& source )
{
	setRed( convertColorFloatToByte(source.red()) );
	setGreen( convertColorFloatToByte(source.green()) );
	setBlue( convertColorFloatToByte(source.blue()) );
	setAlpha( convertColorFloatToByte(source.alpha()) );
}
void CVX_Material::setColor(int red, int green, int blue, int alpha)
{
	setRed(red);
	setGreen(green);
	setBlue(blue);
	setAlpha(alpha);
}
Beispiel #5
0
void vTreeLEDControl::setBrightness(uint8_t bright)
{
    brightness = bright;
    setRed(red);
    setGreen(green);
    setBlue(blue);
}
Beispiel #6
0
int main(void)
{
	init();
    int red = 0,green = 0,blue = 255,delta = 5; //255 % delta == 0

	

    while (1) 
    {		
		if(red < 255 && green == 0 && blue > 0)
		{
			red += delta;
			green = 0;
			blue -= delta;
		}
		else if(red > 0 && green < 255 && blue == 0)
		{
			red -= delta;
			green += delta;
			blue = 0;
		}
		else if(red == 0 && green > 0 && blue < 255)
		{
			red = 0;
			green -= delta;
			blue += delta;
		}
		
		setRed(red);
		setGreen(green);
		setBlue(blue);
		wait(50);
    }
}
Beispiel #7
0
void Color::set( float r, float g, float b, float a )
{
	setRed( r );
	setGreen( g );
	setBlue( b );
	setAlpha( a );
}
bool Rgb::setSlotBlue(Number* const msg)
{
    LCreal value = msg->getReal();
    bool ok = setBlue( value );
    if (!ok) std::cerr << "Rgb::setBlue: invalid entry(" << value << "), valid range: 0 to 1" << std::endl;
    return ok;
}
Beispiel #9
0
void Color::setColor(Color color)
{
	setRed(color.getRed());
	setGreen(color.getGreen());
	setBlue(color.getBlue());
	setAlpha(color.getAlpha());
}
Beispiel #10
0
void Color::setColor(float red, float green, float blue, float alpha)
{
	setRed(red);
	setGreen(green);
	setBlue(blue);
	setAlpha(alpha);
}
Beispiel #11
0
inline Colour& Colour::operator*=(double t)
{
    setRed(_r*t);
    setGreen(_g*t);
    setBlue(_b*t);

    return *this;
}
Beispiel #12
0
inline Colour& Colour::operator*=(const Colour& c)
{
    setRed(this->_r*c._r);
    setGreen(this->_g*c._g);
    setBlue(this->_b*c._b);

    return *this;
}
Beispiel #13
0
TestBoxNode::TestBoxNode(const QString& label, QColor color, bool sizeDependsOnParent)
: Super{nullptr, TestBoxNode::getMetaData()}
{
	setRed(color.red());
	setGreen(color.green());
	setBlue(color.blue());
	setLabel(label);
	setSizeDependsOnParent(sizeDependsOnParent);
}
Beispiel #14
0
//This metod is used for plugins
void RS_Color::fromIntColor(int co) {
    if (co == -1)
        setFlags(RS2::FlagByLayer);
    else if (co == -2)
        setFlags(RS2::FlagByBlock);
    else {
        setRed((co >> 16) & 0xFF);
        setGreen((co >> 8) & 0xFF);
        setBlue(co & 0xFF);
    }

}
Beispiel #15
0
Color& Color::operator-=( const Color &n )
{
  int red = static_cast<int>( getRed() ) - static_cast<int>( n.getRed() );
  int green = static_cast<int>( getGreen() ) - static_cast<int>( n.getGreen() );
  int blue = static_cast<int>( getBlue() ) - static_cast<int>( n. getBlue() );
  red = ( red < 0 ? 0 : red );
  green = ( green < 0 ? 0 : green );
  blue = ( blue < 0 ? 0 : blue );
  setRed( static_cast<uint8_t>( red ) );
  setGreen( static_cast<uint8_t>( green ) );
  setBlue( static_cast<uint8_t>( blue ) );
  return *this;
}
bool ColorPicker::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: setColor((const QColor&)*((const QColor*)static_QUType_ptr.get(_o+1))); break;
    case 1: setRed((int)static_QUType_int.get(_o+1)); break;
    case 2: emitChange(); break;
    case 3: setGreen((int)static_QUType_int.get(_o+1)); break;
    case 4: setBlue((int)static_QUType_int.get(_o+1)); break;
    case 5: reset(); break;
    case 6: init(); break;
    default:
	return QGroupBox::qt_invoke( _id, _o );
    }
    return TRUE;
}
/*Arduino Methods*/
void doRGBPOST() {
	for (int i = 0; i < 5; i++) {
		setWhite();
		delay(500);
		setBlack();
		delay(500);
	}

	setRed();
	delay(1000);
	setGreen();
	delay(1000);
	setBlue();
	delay(1000);
	setWhite();
}
 void parse( const std::string& value )
 {
     if ( value.length() != 7 &&
          value.length() != 9 )
     {
         return; // bad input
     }
     auto c = value.cbegin();
     if ( *c != '#' )
     {
         return; // bad input
     }
     if ( value.substr( 1, value.length()-1).find_first_not_of( "ABCDEF0123456789" )
         != std::string::npos )
     {
         return; // bad input
     }
     Color::ColorType colortype = Color::ColorType::RGB;
     IntType alpha = 255;
     IntType red = 255;
     IntType green = 255;
     IntType blue = 255;
     if ( value.length() == 9 )
     {
         colortype = Color::ColorType::ARGB;
         alpha = getInt( value, 1 );
         red = getInt( value, 3 );
         green = getInt( value, 5 );
         blue = getInt( value, 7 );
     }
     else if ( value.length() == 7 )
     {
         colortype = Color::ColorType::RGB;
         alpha = 255;
         red = getInt( value, 1 );
         green = getInt( value, 3 );
         blue = getInt( value, 5 );
     }
     setAlpha( alpha );
     setRed( red );
     setGreen( green );
     setBlue( blue );
     setColorType( colortype );
 }
Beispiel #19
0
void print_info_node(FILE *f, printinfo *p)
{
    fp = f;

    setGreen();
    fprintf(f, "%5s |", getCmdStr(p->cmd->instr.r.cmd));

    /*
    for(int i = 0; i < p.cycle_issued; ++i)
    //    fprintf(f, "%s", "          "[MAX_PRINTABLE_DIGITS]); //up to 10 printable spaces ;)
        fprintf(f, "%"MAX_PRINTABLE_DIGITS"s", "          ");
    fprintf(f, "%"MAX_PRINTABLE_DIGITS"s", "I  ");

    for(int i = 0; i < p.stalls_ex; ++i)
        fprintf(f, "%"MAX_PRINTABLE_DIGITS"s", "          ");
    fprintf(f, "%"MAX_PRINTABLE_DIGITS"s", "S  ");


    for(int i = 0; i < p.stalls_ex; ++i)
        fprintf(f, "%"MAX_PRINTABLE_DIGITS"s", "          ");
    for(int i = 0; i < get_instr_ex_cycles(p.cmd); ++i)
        fprintf(f, "%"MAX_PRINTABLE_DIGITS"s", "E  ");


    if (p.cmd.type != BEQZ){
        for(int i = 0; i < p.stalls_wb; ++i)
            fprintf(f, "%"MAX_PRINTABLE_DIGITS"s", "          ");
        fprintf(f, "%"MAX_PRINTABLE_DIGITS"s", "S  ");


        for(int i = 0; i < p.stalls_wb; ++i)
            fprintf(f, "%"MAX_PRINTABLE_DIGITS"s", "          ");
        fprintf(f, "%"MAX_PRINTABLE_DIGITS"s", "WB ");
    }
    */

    setBlue();
    for(int i = 1; i < p->cycle_issued; ++i)
        fprintf(f, "     ");
    fprintf(f, "%5s", "  I  ");

    setRed();
    for(int i = 0; i < p->stalls_ex; ++i)
        fprintf(f, "%5s", "  S  ");

    setLPurple();
    for(int i = 0; i < get_instr_ex_cycles(&p->cmd); ++i)
        fprintf(f, "%5s", "  E  ");

    setRed();
    if (p->cmd->type != BEQZ){
        for(int i = 0; i < p->stalls_wb; ++i)
            fprintf(f, "%5s", "  S  ");

        setLCyan();
        fprintf(f, "%5s", "  WB ");
    }


    fprintf(f, "\n");
}
Beispiel #20
0
Color::Color(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha) {
    setRed(red);
    setGreen(green);
    setBlue(blue);
    setAlpha(alpha);
}
Beispiel #21
0
void Color::setBlueF(float value) {

    setBlue(convertToUnsignedChar(value));
}
MTM_RGB::MTM_RGB(uint8_t r, uint8_t g, uint8_t b)
{
	setRed(r);
	setGreen(g);
	setBlue(b);
}
Beispiel #23
0
void Color::_init(uint8_t red, uint8_t green, uint8_t blue)
{
    setRed(red);
    setGreen(green);
    setBlue(blue);
}
Beispiel #24
0
 inline void setColor(const shared_ptr<ColorRGBA> color) { setRed(color->getRed()); setGreen(color->getGreen()); setBlue(color->getBlue()); setAlpha(color->getAlpha()); }
Beispiel #25
0
 inline void setColor(const float& red, const float& green, const float& blue, const float& alpha) { setRed(red); setGreen(green); setBlue(blue); setAlpha(alpha); }
Beispiel #26
0
RGB::RGB(uint8_t red, uint8_t green, uint8_t blue)
{
	setRed(red);
	setGreen(green);
	setBlue(blue);
}
Beispiel #27
0
RGB::RGB(const RGB &color)
{
	setRed(color.red);
	setGreen(color.green);
	setBlue(color.blue);
}
MTM_RGB::MTM_RGB()
{
	setRed(0);
	setGreen(0);
	setBlue(0);
}
void setLED(uint8_t red, uint8_t green, uint8_t blue) {
	setRed(red);
	setGreen(green);
	setBlue(blue);
}
// Main program: Counting on T1
int main( void )
{
	DDRB = 0xFF;					// set PORTB for compare output 
	timer1Init();
	wait(100);

	while (1)
	{
		int delta = 1;
		setRed (0);

		// change some colors
		// RED
		for (int red = 0; red<=255; red+=delta)
		{
			setRed( red );
			setBlue(255-red);				// 8-bits PWM on pin OCR1a 
			delta += 2;					// progressive steps up
			wait(100);					// delay of 100 ms (busy waiting)
		}
		for (int red = 255; red>=0; red-=delta)
		{
			setRed( red );				// 8-bits PWM on pin OCR1a 
			setGreen(255-red);
			delta -= 2;					// progressive steps down
			wait(100);					// delay of 100 ms (busy waiting)
		}
		for (int green = 0; green<=255; green+=delta)
		{
			setGreen( 255-green );
			setBlue(green);				// 8-bits PWM on pin OCR1a
			delta += 2;					// progressive steps up
			wait(100);					// delay of 100 ms (busy waiting)
		}
		setRed( 0 );
		delta = 1;
		wait(100);


		// RED
		for (int red = 0; red<=255; red+=delta)
		{
			setRed( red );				// 8-bits PWM on pin OCR1a
p
			wait(100);					// delay of 100 ms (busy waiting)
		}
		for (int red = 255; red>=0; red-=delta)
		{
			setRed( red );				// 8-bits PWM on pin OCR1a
			setGreen(255-red);
			delta -= 2;					// progressive steps down
			wait(100);					// delay of 100 ms (busy waiting)
		}
		// GREEN
		for (int gr = 0; gr<=255; gr+=delta) {
			setGreen(gr);
			wait(100);	 
		}
		for (int gr = 255; gr>=0; gr-=delta) {
			setGreen(gr);
			wait(100);
		}
		// BLUE
		for (int blue = 0; blue<=255; blue+=delta) {
			setBlue(blue);
			wait(100);
		}
		for (int blue = 255; blue>=0; blue-=delta) {
			setBlue(blue);
			wait(100);
		}


		// YELLOW
		// for (int yellow= 0; yellow<=255; yellow += delta)
		// . . .


		// WHITE
		// for (int white = 0; white<=255; white += delta)
		// . . .
	} 
}