bool renderArrow( float s = 8.0f, float lw = 2.0f, const osgWidget::Color& lc = osgWidget::Color(0.0f, 0.0f, 0.0f, 1.0f), const osgWidget::Color& fc = osgWidget::Color(1.0f, 1.0f, 1.0f, 1.0f) ) { if(!allocateSurface(s * 2.0f, s)) return false; if(!createContext()) return false; // Fill the background. setSourceRGBA(fc); rectangle(0.0f, 0.0f, s * 2.0f, s); fill(); setLineWidth(lw); setSourceRGBA(lc); // Draw our "vertical line." moveTo(s / 4.0f, 0.0f); lineTo(s / 4.0f, s); stroke(); // Draw the arrow. setLineWidth(0.0f); moveTo(s, 0.0f); lineTo(s, s); lineTo(s + (s / 2.0f), s / 2.0f); lineTo(s, 0.0f); fill(); return true; }
void _finalizeCorner( float x, float y, const osgWidget::Color& lc, const osgWidget::Color& fc ) { setSourceRGBA(lc); strokePreserve(); setSourceRGBA(fc); lineTo(x, y); fill(); }
void _drawBorder( float x1, float y1, float x2, float y2, float xoff, float size, const osgWidget::Color& lc, const osgWidget::Color& fc ) { setSourceRGBA(lc); moveTo(x1 + xoff, 0.0f); lineTo(x1 + xoff, size); stroke(); rectangle(x1, y1, x2, y2); setSourceRGBA(fc); fill(); }
void TTGraphicsContext::setColor(TTGraphicsColor& color) { setSourceRGBA(color.red, color.green, color.blue, color.alpha); }