// ---------------------------------------------------------------------------- // ScenePixelAnimator::ScenePixelAnimator( UID animation_uid, AnimationSignal signal, UIDArray actors, PixelEffect effect, RGBWAArray custom_colors, RGBWA empty_color, unsigned generations, unsigned num_pixels, bool color_fade, unsigned increment, bool combine_fixtures ) : SceneChannelAnimator( animation_uid, signal ), m_effect ( effect ), m_custom_colors ( custom_colors ), m_empty_color ( empty_color ), m_generations ( generations ), m_num_pixels ( num_pixels ), m_color_fade ( color_fade ), m_increment ( increment ), m_combine_fixtures ( combine_fixtures ) { m_actors = actors; // Setup the color progression for the animation if ( m_custom_colors.size() == 1 && m_custom_colors[1] == RGBWA(1,1,1) ) RGBWA::getRainbowColors( m_colors ); else if ( m_custom_colors.size() ) m_colors.assign( m_custom_colors.begin(), m_custom_colors.end() ); else RGBWA::getAllPredefinedColors( m_colors ); }
// ---------------------------------------------------------------------------- // void HttpRestServices::control_venue_whiteout_color( Venue* venue, DMXHttpSession* session, CString& response, LPCSTR data ) { ULONG rgbwa; if ( data[0] == '#' ) data++; if ( sscanf_s( data, "%lx", &rgbwa ) != 1 ) throw RestServiceException( "Invalid service arguments" ); venue->setWhiteoutColor( RGBWA(rgbwa) ); }
// ---------------------------------------------------------------------------- // bool ColorSelectField::setValue( LPCSTR value ) { CString key( value ); RGBWAArray colors; int curPos = 0; while ( true ) { CString resToken = key.Tokenize( _T(","), curPos ); if ( resToken.IsEmpty() ) break; resToken.Trim(); if ( resToken.GetLength() == 0 ) continue; bool found = false; RGBWA rgb; ULONG value; unsigned red, green, blue; if ( sscanf_s( resToken, "#%lx", &value ) == 1 ) { found = true; rgb = RGBWA( value ); } else if ( sscanf_s( resToken, "rgb(%u %u %u)", &red, &green, &blue ) == 3 ) { found = true; rgb = RGBWA( red, green, blue ); } else found = RGBWA::getColorByName( (LPCSTR)resToken, rgb ); if ( ! found ) throw FieldException( "Unknown color value '%s'", (LPCSTR)resToken ); colors.push_back( rgb ); } if ( colors.size() > 1 && !m_allow_multiple ) throw FieldException( "Select a single color" ); m_colors = colors; return InputField::setValue( value ); }
// ---------------------------------------------------------------------------- // bool HttpRestServices::control_venue_whiteout_color( CString& response, LPCSTR data ) { if ( !studio.getVenue() || !studio.getVenue()->isRunning() ) return false; ULONG rgbwa; if ( data[0] == '#' ) data++; if ( sscanf_s( data, "%lx", &rgbwa ) != 1 ) return false; studio.getVenue()->setWhiteoutColor( RGBWA(rgbwa) ); if ( studio.getVenue()->getWhiteout() != WHITEOUT_OFF ) studio.getVenue()->loadScene(); return true; }
// ---------------------------------------------------------------------------- // void RGBWA::getRainbowColors( RGBWAArray& colors ) { for ( int index=0; index < sizeof(RAINBOW)/sizeof(ULONG); ++index ) colors.push_back( RGBWA(RAINBOW[index]) ); }