void QueueSystem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { painter->setPen(QPen(getColorFrame())); painter->setBrush(QBrush(getColorBackground())); drawBackground(painter); drawInputs(painter); drawName(painter); drawNameType(painter); drawCountsRequests(painter); }
//-------------------------------------------------------------- void testApp::draw() { /**************************************** /* START TO DRAW IN THE FBO /****************************************/ rm.startOffscreenDraw(); glPushMatrix(); glScalef((float)2048/640,(float)768/240,0); switch (debugOutput) { //DRAW THE REAL OUTPUT case 0: for (int i = 0; i < blobs.size(); i++) { ofEnableAlphaBlending(); ofEnableSmoothing(); ofFill(); ofSetColor(255,255,255,blobs[i].alpha-200); ofSetLineWidth(7); for (int j = 0; j < blobs.size(); j++) { if(blobs[i].state == ALIVE && blobs[j].state == ALIVE) { ofLine(blobs[i].x+7.5, blobs[i].y+7.5, blobs[j].x+7.5, blobs[j].y+7.5); } } ofSetLineWidth(1); ofSetColor(255,255,255,blobs[i].alpha); ofCircle(blobs[i].x+7.5,blobs[i].y+7.5,15); ofDisableAlphaBlending(); ofDisableSmoothing(); } break; //DRAW OUTPUT WITH BLOBS case 1: for (int i = 0; i < blobs.size(); i++) { ofSetHexColor(0xdd00cc); ofNoFill(); ofRect( blobs[i].boundingRect.x, blobs[i].boundingRect.y, blobs[i].boundingRect.width, blobs[i].boundingRect.height ); ofSetHexColor(0x00ffff); ofNoFill(); ofBeginShape(); for( int j=0; j<blobs[i].nPts; j++ ) { ofVertex( blobs[i].pts[j].x, blobs[i].pts[j].y ); } ofEndShape(); ofEnableAlphaBlending(); ofFill(); ofSetColor(255,255,255,blobs[i].alpha); ofLine(blobs[i].x,blobs[i].y,blobs[i].pX,blobs[i].pY); float size = sqrt( pow(blobs[i].boundingRect.width,2) + pow(blobs[i].boundingRect.height,2) ) / 2 * 0.8; ofCircle(blobs[i].x,blobs[i].y,size); ofDisableAlphaBlending(); } break; //DRAW GL BOXES case 2: ofSetHexColor(0xFFFFFF); ofRect(0, 0, 640, 240); ofSetHexColor(0x323232); ofRect(10, 10, 620, 220); ofSetHexColor(0xFF0000); ofRect(0, 0, 100, 240); ofSetHexColor(0x0000FF); ofRect(310, 120, 20, 120); ofSetHexColor(0x00FF00); ofRect(540, 0, 100, 240); ofSetHexColor(0xFFFF00); ofRect(310, 0, 20, 120); ofSetHexColor(0xFF00FF); ofRect(0,50,1024,20); ofSetHexColor(0xFFFFFF); ofCircle(160,120,80); ofSetHexColor(0x000000); ofCircle(480,120,80); break; //DRAW AN IMAGE case 3: twoScreenImage.draw(0,0); break; } glPopMatrix(); rm.endOffscreenDraw(); /**************************************** /* END TO DRAW IN THE FBO /****************************************/ if(!debug) { /**************************************** /* DRAW THE REAL OUTPUT /****************************************/ glPushMatrix(); ofRect(0,0,2048,768); //glTranslatef(0, 0, 0); //glScalef(2,1,0); ofSetHexColor(0xffffff); rm.drawScreen(0); //glPushMatrix(); //glTranslatef(-480,-500,0); //ofRotate(45); rm.drawScreen(1); //glPopMatrix(); glPopMatrix(); } else { /**************************************** /* DRAW THE DEBUG OUTPUT /****************************************/ ofSetHexColor(0xffffff); char reportStr[1024]; sprintf(reportStr, "bg subtraction and blob detection\npress ' ' to capture bg\nthreshold %i (press: +/-)\ntracked Blob count: %i\nfps: %f", threshold, blobs.size(), ofGetFrameRate()); ofDrawBitmapString(reportStr, 10, 295); rm.drawInputDiagnostically(guiIn.x, guiIn.y, guiIn.width, guiIn.height); rm.drawOutputDiagnostically(guiOut.x, guiOut.y, guiOut.width, guiOut.height); glPushMatrix(); glTranslatef(320, 525, 0); glScalef(0.3,0.3,0); rm.drawScreen(0); rm.drawScreen(1); glPopMatrix(); ofDrawBitmapString("internal texture points", 320, 290); ofDrawBitmapString("texture warping points", 850, 290); ofDrawBitmapString("screen 1", 10, 290); ofDrawBitmapString("screen 2", 710, 290); ofDrawBitmapString("s - to save to xml r - to reload from xml c - reset coordinates g - draw open gl shapes\n", 10, 275); drawInputs(); drawDebugTable(); gui.draw(); } }