void MLMultiSlider::paint (Graphics& g) { MLLookAndFeel* myLookAndFeel = (&(getRootViewResources(this).mLookAndFeel)); if (isOpaque()) myLookAndFeel->drawBackground(g, this); float outlineThickness = myLookAndFeel->getGridUnitSize() / 64.f; MLRect r = mPos.getLocalOutline(); const Colour outlineColor (findColour(MLLookAndFeel::outlineColor).withAlpha (isEnabled() ? 1.f : 0.5f)); // draw fills // vertical only Path full, empty; Colour fullColor, emptyColor; MLRect fullRect, emptyRect; float dialY; MLRange drawRange(mRange); drawRange.convertTo(MLRange(r.height(), 0.)); for (int i=0; i<mNumSliders; ++i) { MLRect sr = (mPos.getElementBounds(i)); dialY = drawRange(getFloatProperty(ml::textUtils::addFinalNumber(ml::Symbol("value"), i))); fullRect = sr; emptyRect = sr; fullRect.setTop(dialY); fullColor = findColour(trackFullDarkColor); emptyColor = findColour(trackEmptyDarkColor); // groups of 4 if (!(i&4)) { emptyColor = emptyColor.brighter(0.10f); fullColor = fullColor.brighter(0.20f); } empty.clear(); empty.addRectangle(MLToJuceRect(emptyRect)); g.setColour(emptyColor); g.fillPath(empty); full.clear(); full.addRectangle(MLToJuceRect(fullRect)); g.setColour(fullColor); g.fillPath(full); g.setColour(outlineColor); g.strokePath(empty, PathStrokeType (outlineThickness)); } }
void Thermometer::paintEvent(QPaintEvent *) { painter.begin(this); drawTitle(); drawUnit(); drawLabel(); drawDisplay(); drawScale(); drawMeter(); drawRange(); drawPointer(); painter.end(); }
void XftTextRenderer::drawRun(const WebCoreTextRun *run, const WebCoreTextStyle *style, int x, int y) { assert(run); assert(style); assert(style->families); if (run->length == 0) return; XRenderColor xrc; XftColor c; getXRenderColorFromGdkColor(&style->textColor, &xrc); XftColorAllocValue(xdisplay, xvisual, xcmap, &xrc, &c); x -= gdkxoff; y -= gdkyoff; const int wordBufSz = 10; // size of scan buffer WordRange words[wordBufSz]; // scan buffer int nWords; // number of words in scan buffer int totWords = 0; // total word count // needs always totWords because wordSpacing is applied only to spaces in the middle, not // for the last word. Is this correct practice? scanRunForWords(run, run->from, words, wordBufSz, &nWords, &totWords); if (totWords == 0) return; float wordPadding = style->padding / totWords; float wordWidth = 0.0f; int wordsDrawn = 0; int wordIndex; while (1) { // iterate over scan buffer for (wordIndex = 0; wordIndex < nWords; wordIndex++) { wordWidth = drawRange(run, style, words[wordIndex].start, words[wordIndex].stop, x, y, &c, true); // not last word wordWidth += wordPadding; wordWidth += font->spaceWidth + style->wordSpacing; x += (int)wordWidth; ++wordsDrawn; } if (nWords > 0 && words[nWords-1].stop+1 < run->to) { // update scan buffer (will happen if number of spaces > wordBufSz) scanRunForWords(run, words[nWords-1].stop+1, words, wordBufSz, &nWords, NULL); } else break; } XftColorFree(xdisplay, xvisual, xcmap, &c); if (style->rtl){ g_warning("RTL painting not implemented"); // FIXME:: Handle right-to-left text } }
void wySpriteBatchNode::drawFromMarker(int count) { if(drawRange(m_marker, count)) m_marker += count; }
void HudGaugeRadarOrb::render(float frametime) { float sensors_str; int ok_to_blit_radar; //WMC - This strikes me as a bit hackish bool g3_yourself = !g3_in_frame(); if(g3_yourself) g3_start_frame(1); ok_to_blit_radar = 1; sensors_str = ship_get_subsystem_strength( Player_ship, SUBSYSTEM_SENSORS ); if ( ship_subsys_disrupted(Player_ship, SUBSYSTEM_SENSORS) ) { sensors_str = MIN_SENSOR_STR_TO_RADAR-1; } // note that on lowest skill level, there is no radar effects due to sensors damage if ( (Game_skill_level == 0) || (sensors_str > SENSOR_STR_RADAR_NO_EFFECTS) ) { Radar_static_playing = 0; Radar_static_next = 0; Radar_death_timer = 0; Radar_avail_prev_frame = 1; } else if ( sensors_str < MIN_SENSOR_STR_TO_RADAR ) { if ( Radar_avail_prev_frame ) { Radar_death_timer = timestamp(2000); Radar_static_next = 1; } Radar_avail_prev_frame = 0; } else { Radar_death_timer = 0; if ( Radar_static_next == 0 ) Radar_static_next = 1; } if ( timestamp_elapsed(Radar_death_timer) ) { ok_to_blit_radar = 0; } setGaugeColor(); blitGauge(); drawRange(); setupViewHtl(); drawOutlinesHtl(); if ( timestamp_elapsed(Radar_static_next) ) { Radar_static_playing ^= 1; Radar_static_next = timestamp_rand(50, 750); } // if the emp effect is active, always draw the radar wackily if(emp_active_local()) { Radar_static_playing = 1; } if ( ok_to_blit_radar ) { if ( Radar_static_playing ) { drawBlipsSorted(1); // passing 1 means to draw distorted if ( Radar_static_looping == -1 ) { Radar_static_looping = snd_play_looping(&Snds[SND_STATIC]); } } else { drawBlipsSorted(0); if ( Radar_static_looping != -1 ) { snd_stop(Radar_static_looping); Radar_static_looping = -1; } } } else { if ( Radar_static_looping != -1 ) { snd_stop(Radar_static_looping); Radar_static_looping = -1; } } doneDrawingHtl(); if(g3_yourself) g3_end_frame(); }
void drawItem() { if (item) { drawRange((*item)); drawTower((*item)); } }