void RgbEffects::RenderMeteors(int MeteorType, int Count, int Length) { if (state == 0) meteors.clear(); int mspeed=state/4; state-=mspeed*4; // create new meteors MeteorClass m; wxImage::HSVValue hsv,hsv0,hsv1; palette.GetHSV(0,hsv0); palette.GetHSV(1,hsv1); size_t colorcnt=GetColorCount(); Count=BufferWi * Count / 100; int TailLength=(BufferHt < 10) ? Length / 10 : BufferHt * Length / 100; if (TailLength < 1) TailLength=1; int TailStart=BufferHt - TailLength; if (TailStart < 1) TailStart=1; for(int i=0; i<Count; i++) { m.x=rand() % BufferWi; m.y=BufferHt - 1 - rand() % TailStart; switch (MeteorType) { case 1: SetRangeColor(hsv0,hsv1,m.hsv); break; case 2: palette.GetHSV(rand()%colorcnt, m.hsv); break; } meteors.push_back(m); } // render meteors for (MeteorList::iterator it=meteors.begin(); it!=meteors.end(); ++it) { for(int ph=0; ph<TailLength; ph++) { switch (MeteorType) { case 0: hsv.hue=double(rand() % 1000) / 1000.0; hsv.saturation=1.0; hsv.value=1.0; break; default: hsv=it->hsv; break; } hsv.value*=1.0 - double(ph)/TailLength; SetPixel(it->x,it->y+ph,hsv); } it->y -= mspeed; } // delete old meteors meteors.remove_if(MeteorHasExpired(TailLength)); }
void RgbEffects::RenderSnowstorm(int Count, int Length) { // create new meteors wxImage::HSVValue hsv,hsv0,hsv1; palette.GetHSV(0,hsv0); palette.GetHSV(1,hsv1); size_t colorcnt=GetColorCount(); Count=BufferWi * BufferHt * Count / 2000 + 1; int TailLength=BufferWi * BufferHt * Length / 2000 + 2; SnowstormClass ssItem; wxPoint xy; int r; if (state == 0 || Count != LastSnowstormCount) { // create snowstorm elements LastSnowstormCount=Count; SnowstormItems.clear(); for(int i=0; i<Count; i++) { ssItem.idx=i; ssItem.ssDecay=0; ssItem.points.clear(); SetRangeColor(hsv0,hsv1,ssItem.hsv); // start in a random state r=rand() % (2*TailLength); if (r > 0) { xy.x=rand() % BufferWi; xy.y=rand() % BufferHt; ssItem.points.push_back(xy); } if (r >= TailLength) { ssItem.ssDecay = r - TailLength; r = TailLength; } for (int j=1; j < r; j++) { SnowstormAdvance(ssItem); } SnowstormItems.push_back(ssItem); } } // render Snowstorm Items int sz; int cnt=0; for (SnowstormList::iterator it=SnowstormItems.begin(); it!=SnowstormItems.end(); ++it) { if (it->points.size() > TailLength) { if (it->ssDecay > TailLength) { it->points.clear(); // start over it->ssDecay=0; } else if (rand() % 20 < speed) { it->ssDecay++; } } if (it->points.empty()) { xy.x=rand() % BufferWi; xy.y=rand() % BufferHt; it->points.push_back(xy); } else if (rand() % 20 < speed) { SnowstormAdvance(*it); } sz=it->points.size(); for(int pt=0; pt < sz; pt++) { hsv=it->hsv; hsv.value=1.0 - double(sz - pt + it->ssDecay)/TailLength; if (hsv.value < 0.0) hsv.value=0.0; SetPixel(it->points[pt].x,it->points[pt].y,hsv); } cnt++; } }
void CR823_TVolDetailQuery::CheckRange(record_item arg) { int tiny_priority = 0; int mid_priority = 0; int huge_priority = 0; int iron_priority = 0; // Handle the huge deficiency color if (arg.huge_deficency <= 0) { m_table_content.SetEntyColor(arg.line, ID_TABLE_CONTENT_COLUMN_HUGE, ID_COLOR_TEXT, ID_COLOR_BLANK); } else if (arg.huge_deficency < mConfigure.getHugeDeficiency()) { huge_priority = 1; m_table_content.SetEntyColor(arg.line, ID_TABLE_CONTENT_COLUMN_HUGE, ID_COLOR_TEXT, ID_COLOR_BASIC_LEVER); } else if (arg.huge_deficency < mConfigure.getHugeDeficiencyB()) { huge_priority = 2; m_table_content.SetEntyColor(arg.line, ID_TABLE_CONTENT_COLUMN_HUGE, ID_COLOR_TEXT, ID_COLOR_A_LEVER); } else if (arg.huge_deficency < mConfigure.getHugeDeficiencyC()) { huge_priority = 3; m_table_content.SetEntyColor(arg.line, ID_TABLE_CONTENT_COLUMN_HUGE, ID_COLOR_TEXT, ID_COLOR_B_LEVER); } else { huge_priority = 4; m_table_content.SetEntyColor(arg.line, ID_TABLE_CONTENT_COLUMN_HUGE, ID_COLOR_TEXT, ID_COLOR_C_LEVER); } // Handle the mid deficiency color if (arg.mid_deficency <= 0) { m_table_content.SetEntyColor(arg.line, ID_TABLE_CONTENT_COLUMN_MID, ID_COLOR_TEXT, ID_COLOR_BLANK); } else if (arg.mid_deficency < mConfigure.getMidDeficiency()) { mid_priority = 1; m_table_content.SetEntyColor(arg.line, ID_TABLE_CONTENT_COLUMN_MID, ID_COLOR_TEXT, ID_COLOR_BASIC_LEVER); } else if (arg.mid_deficency < mConfigure.getMidDeficiencyB()) { mid_priority = 2; m_table_content.SetEntyColor(arg.line, ID_TABLE_CONTENT_COLUMN_MID, ID_COLOR_TEXT, ID_COLOR_A_LEVER); } else if (arg.mid_deficency < mConfigure.getMidDeficiencyC()) { mid_priority = 3; m_table_content.SetEntyColor(arg.line, ID_TABLE_CONTENT_COLUMN_MID, ID_COLOR_TEXT, ID_COLOR_B_LEVER); } else { mid_priority = 4; m_table_content.SetEntyColor(arg.line, ID_TABLE_CONTENT_COLUMN_MID, ID_COLOR_TEXT, ID_COLOR_C_LEVER); } // Handle the tiny deficiency color if (arg.tiny_deficency <= 0) { m_table_content.SetEntyColor(arg.line, ID_TABLE_CONTENT_COLUMN_TINY, ID_COLOR_TEXT, ID_COLOR_BLANK); } else if (arg.tiny_deficency < mConfigure.getTinyDeficiency()) { tiny_priority = 1; m_table_content.SetEntyColor(arg.line, ID_TABLE_CONTENT_COLUMN_TINY, ID_COLOR_TEXT, ID_COLOR_BASIC_LEVER); } else if (arg.tiny_deficency < mConfigure.getTinyDeficiencyB()) { tiny_priority = 2; m_table_content.SetEntyColor(arg.line, ID_TABLE_CONTENT_COLUMN_TINY, ID_COLOR_TEXT, ID_COLOR_A_LEVER); } else if (arg.tiny_deficency < mConfigure.getTinyDeficiencyC()) { tiny_priority = 3; m_table_content.SetEntyColor(arg.line, ID_TABLE_CONTENT_COLUMN_TINY, ID_COLOR_TEXT, ID_COLOR_B_LEVER); } else { tiny_priority = 4; m_table_content.SetEntyColor(arg.line, ID_TABLE_CONTENT_COLUMN_TINY, ID_COLOR_TEXT, ID_COLOR_C_LEVER); } // Handle the iron tramp color if (arg.iron_tramp <= 0) { m_table_content.SetEntyColor(arg.line, ID_TABLE_CONTENT_COLUMN_IRON, ID_COLOR_TEXT, ID_COLOR_BLANK); } else if (arg.iron_tramp < mConfigure.getIronTramp()) { iron_priority = 1; m_table_content.SetEntyColor(arg.line, ID_TABLE_CONTENT_COLUMN_IRON, ID_COLOR_TEXT, ID_COLOR_BASIC_LEVER); } else if (arg.iron_tramp < mConfigure.getIronTrampB()) { iron_priority = 2; m_table_content.SetEntyColor(arg.line, ID_TABLE_CONTENT_COLUMN_IRON, ID_COLOR_TEXT, ID_COLOR_A_LEVER); } else if (arg.iron_tramp < mConfigure.getIronTrampC()) { iron_priority = 3; m_table_content.SetEntyColor(arg.line, ID_TABLE_CONTENT_COLUMN_IRON, ID_COLOR_TEXT, ID_COLOR_B_LEVER); } else { iron_priority = 4; m_table_content.SetEntyColor(arg.line, ID_TABLE_CONTENT_COLUMN_IRON, ID_COLOR_TEXT, ID_COLOR_C_LEVER); } if ((iron_priority >= mid_priority) && (iron_priority >= huge_priority) && (iron_priority >= tiny_priority) && (iron_priority != 0)) { m_table_content.SetItemText(arg.line, ID_TABLE_CONTENT_COLUMN_RANGE, ID_TABLE_IRON_TRAMP); SetRangeColor(arg, iron_priority); } else if ((huge_priority >= mid_priority) && (huge_priority >= tiny_priority) && (huge_priority >= iron_priority) && (huge_priority != 0)) { m_table_content.SetItemText(arg.line, ID_TABLE_CONTENT_COLUMN_RANGE, ID_TABLE_HUGE_DEFICIENCY); SetRangeColor(arg, huge_priority); } else if ((mid_priority >= tiny_priority) && (mid_priority >= huge_priority) && (mid_priority >= iron_priority) && (mid_priority != 0)) { m_table_content.SetItemText(arg.line, ID_TABLE_CONTENT_COLUMN_RANGE, ID_TABLE_MID_DEFICIENCY); SetRangeColor(arg, mid_priority); } else if ((tiny_priority >= mid_priority) && (tiny_priority >= huge_priority) && (tiny_priority >= iron_priority) && (tiny_priority != 0)) { m_table_content.SetItemText(arg.line, ID_TABLE_CONTENT_COLUMN_RANGE, ID_TABLE_TINY_DEFICIENCY); SetRangeColor(arg, tiny_priority); } else { m_table_content.SetItemText(arg.line, ID_TABLE_CONTENT_COLUMN_RANGE, ID_TABLE_EMPTY); SetRangeColor(arg, 0); } }