void TupItemTweener::addStep(const TupTweenerStep &step) { int counter = step.index(); #ifdef K_DEBUG #ifdef Q_OS_WIN qWarning() << "TupItemTweener::addStep() - counter: " << counter; #else VERIFY_STEP(counter); #endif #endif if (step.has(TupTweenerStep::Position)) setPosAt(counter, step.position()); if (step.has(TupTweenerStep::Rotation)) setRotationAt(counter, step.rotation()); if (step.has(TupTweenerStep::Scale)) setScaleAt(counter, step.horizontalScale(), step.verticalScale()); if (step.has(TupTweenerStep::Shear)) setShearAt(counter, step.horizontalShear(), step.verticalShear()); if (step.has(TupTweenerStep::Opacity)) setOpacityAt(counter, step.opacity()); if (step.has(TupTweenerStep::Coloring)) setColorAt(counter, step.color()); }
/** * \par Function * setColor * \par Description * Set the LED color for any LED. * \param[in] * index - The LED index number you want to set its color * \param[in] * red - Red values * \param[in] * green - green values * \param[in] * blue - blue values * \par Output * None * \return * TRUE: Successful implementation * FALSE: Wrong execution * \par Others * The index value from 1 to the max, if you set the index 0, all the LED will be lit */ bool MeRGBLed::setColor(uint8_t index, uint8_t red, uint8_t green, uint8_t blue) { if(index == 0) { for(int16_t i = 0; i < count_led; i++) { setColorAt(i,red,green,blue); } return(true); } else { setColorAt(index-1,red,green,blue); } return(false); }
bool MeRGBLed::setColor(uint8_t index, uint8_t red,uint8_t green,uint8_t blue) { if(index==0){ for(int i=0;i<count_led;i++) { setColorAt(i,red,green,blue); } return true; }else if(index < count_led) { uint8_t tmp = (index-1) * 3; pixels[tmp] = green; pixels[tmp+1] = red; pixels[tmp+2] = blue; return true; } return false; }
void TupItemTweener::addStep(const TupTweenerStep &step) { int counter = step.index(); VERIFY_STEP(counter); if (step.has(TupTweenerStep::Position)) setPosAt(counter, step.position()); if (step.has(TupTweenerStep::Rotation)) setRotationAt(counter, step.rotation()); if (step.has(TupTweenerStep::Scale)) setScaleAt(counter, step.horizontalScale(), step.verticalScale()); if (step.has(TupTweenerStep::Shear)) setShearAt(counter, step.horizontalShear(), step.verticalShear()); if (step.has(TupTweenerStep::Opacity)) setOpacityAt(counter, step.opacity()); if (step.has(TupTweenerStep::Coloring)) setColorAt(counter, step.color()); }
void KColorCombo2::setRainbowPreset(int colorColumnCount, int lightRowCount, int darkRowCount, bool withGray) { // At least one row and one column: if (colorColumnCount < 1 - (withGray ? 1 : 0)) colorColumnCount = 1 - (withGray ? 1 : 0); if (lightRowCount < 0) lightRowCount = 0; if (darkRowCount < 0) darkRowCount = 0; // Create the array: int columnCount = colorColumnCount + (withGray ? 1 : 0); int rowCount = lightRowCount + 1 + darkRowCount; newColorArray(columnCount, rowCount); // Fill the array: for (int i = 0; i < colorColumnCount; ++i) { int hue = i * 360 / colorColumnCount; // With light colors: for (int j = 1; j <= lightRowCount; ++j) { // Start to 1 because we don't want a row full of white! int saturation = j * 255 / (lightRowCount + 1); setColorAt(i, j - 1, QColor(hue, saturation, 255, QColor::Hsv)); } // With pure colors: setColorAt(i, lightRowCount, QColor(hue, 255, 255, QColor::Hsv)); // With dark colors: for (int j = 1; j <= darkRowCount; ++j) { int value = 255 - j * 255 / (darkRowCount + 1); setColorAt(i, lightRowCount + j, QColor(hue, 255, value, QColor::Hsv)); } } // Fill the gray column: if (withGray) { for (int i = 0; i < rowCount; ++i) { int gray = ( rowCount == 1 ? 128 : 255 - (i * 255 / (rowCount - 1)) ); setColorAt(columnCount-1, i, QColor(gray, gray, gray)); } } #ifdef DEBUG_COLOR_ARRAY kDebug() << "KColorCombo2::setColorPreset"; for (int j = 0; j < rowCount; ++j) { for (int i = 0; i < columnCount; ++i) { int h, s, v; m_colorArray[i][j].getHsv(h, s, v); kDebug() << QString("(%1,%2,%3)").arg(h, 3).arg(s, 3).arg(v, 3); //kDebug() << colorArray[i][j].name() << " "; } kDebug(); } #endif #ifdef OUTPUT_GIMP_PALETTE kDebug() << "GIMP Palette"; for (int j = 0; j < rowCount; ++j) { for (int i = 0; i < columnCount; ++i) { kDebug() << QString("(%1,%2,%3)") .arg(m_colorArray[i][j].red(), 3) .arg(m_colorArray[i][j].green(), 3) .arg(m_colorArray[i][j].blue(), 3); } } #endif }
bool MeRGBLed::setColor(uint8_t red,uint8_t green,uint8_t blue) { for(uint8_t i=0;i<count_led;i++){ setColorAt(i,red,green,blue); } return true; }