示例#1
0
void SortRoutineGraphic::drawBackground()
{
	fill(pDarkGray);
	rect(fFrame.x, fFrame.y, fFrame.width, fFrame.height);

	fill(255);

		stroke(pWhite);
		strokeWeight(0.5);

		if (fAnimate) {
			// do a step in the sorter
			if (!fSorter->step()) {
				reset();
			}
		}

		// Draw the array of values scaled to fit the window
		for (int idx = 0; idx < nElems; idx++) {
			double mappedX = (int)MAP(idx, 0, nElems - 1, fFrame.x, fFrame.x + fFrame.width - 1);
			double mappedY = (int)MAP(fSorter->fElements[idx], 0, MAX_VALUE, fFrame.y + fFrame.height - 1, fFrame.y);

			point(mappedX, mappedY);

			if (fShowLines) {
				line(fFrame.x, fFrame.y + fFrame.height - 1, mappedX, mappedY);
			}
		
	}

	drawForeground();
}
示例#2
0
void draw()
{
	drawBackground();
	drawForeground();
	
	//drawEntireDeck();
}
示例#3
0
void GLRenderer::renderFrame()
{
#ifndef IOS
	if (GL_FALSE == eglMakeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext) ||
		EGL_SUCCESS != eglGetError())
	{
		return;
	}
#endif

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
    drawBackground();
    glDisable(GL_BLEND);

    glEnable(GL_DEPTH_TEST);
	glClear(GL_DEPTH_BUFFER_BIT);
	drawObjects();
    glDisable(GL_DEPTH_TEST);
    
    glEnable(GL_BLEND);
    glClear(GL_DEPTH_BUFFER_BIT);
    drawForeground();

#ifndef IOS
	eglSwapBuffers(m_eglDisplay, m_eglSurface);
#endif

#if defined( DISPLAY_FPS ) && defined( SHP )
    _displayFPS();
#endif
}
示例#4
0
void LedBase::paint( QPainter *p, const QStyleOptionGraphicsItem *option, QWidget *widget )
{
    Component::paint( p, option, widget );

    eLed::updateBright();

    QPen pen(Qt::black, 4, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);

    if( m_bright > 255+75 )  // Corriente sobrepasada
    {
        m_bright = 0;
        p->setBrush( Qt::white );
        pen.setColor( QColor( Qt::white ));
    }

    if( m_bright > 20 )
    {
        m_bright += 30;    // Set a minimun bright
        if( m_bright > 255 ) m_bright = 255;
    }

    p->setPen(pen);

    drawBackground( p );

    pen.setColor( QColor( m_bright, m_bright, 50 ));
    pen.setWidth(2.5);
    p->setPen(pen);
    p->setBrush( QColor( m_bright, m_bright, 50) );

    drawForeground( p );
}
void Renderer::render ()
{
	cairo_t *cr;

	cr = cairo_create (target);

	drawBackground (cr);
	drawForeground (cr);

	cairo_destroy (cr);
}
void Component::draw(Graphics* const TheGraphics, Real32 Opacity) const
{
    //If not visible then don't draw
    if (!getVisible())
        return;

    //Grab the initial transformation
    GLdouble InitMat[16];
    glGetDoublev(GL_MODELVIEW_MATRIX, InitMat);

    //Translate to my position
    glTranslatef(getPosition().x(), getPosition().y(), 0);

    if(setupClipping(TheGraphics))
    {

        //Activate My Border Drawing constraints
        Border* DrawnBorder = getDrawnBorder();
        if(DrawnBorder != NULL)
        {
            DrawnBorder->activateInternalDrawConstraints(TheGraphics,0,0,getSize().x(),getSize().y());
        }


        //Draw My Background
        drawBackground(TheGraphics, getDrawnBackground(), Opacity);

        //Draw Internal
        drawInternal(TheGraphics, Opacity);

        //Make sure the clipping is reset
        setupClipping(TheGraphics);

        //Draw My Foreground
        drawForeground(TheGraphics, getDrawnForeground(), Opacity);

        //Draw all parts that should not be clipped against
        drawUnclipped(TheGraphics, Opacity);
    }

    //Reset the transformation
    glLoadMatrixd(InitMat);
}
示例#7
0
void DhQGraphicsScene::DvhdrawForeground(QPainter* x1, const QRectF& x2) {
  return drawForeground(x1, x2);
}