void IntervalProgressDisplay::EllipticalPaintStrategy::paint(QPainter &p, const PaintContext &context, const PaintColors &colors) { qreal margin = context.elementsSize + 4; QRectF rect = createContextRect(context, margin); if (context.beatsPerInterval <= 32) { drawCircles(p, rect, context, colors, context.beatsPerInterval, 0, true);// draw a ellipse } else { int elementsInOuterEllipse = context.beatsPerInterval / 2; int elementsInNestedEllipse = context.beatsPerInterval - elementsInOuterEllipse; //draw the internal circles first, so external circles will appear in top qreal margin = context.elementsSize * 1.8; QMarginsF margins(margin, margin, margin, margin); bool drawPath = context.currentBeat >= elementsInOuterEllipse; drawCircles(p, rect.marginsRemoved(margins), context, colors, elementsInNestedEllipse, elementsInOuterEllipse, drawPath); //draw external circles if (context.currentBeat < elementsInOuterEllipse){ //only draw the external circles when playing the first part of interval drawCircles(p, rect, context, colors, elementsInOuterEllipse, 0, true); } } drawCurrentBeatValue(p, rect, context, colors); }
void ClockCircle :: draw () { if( false ) { ofxBox2dCircle :: draw(); return; } if ( tex != NULL ) { drawTexture(); if( texAnim != NULL ) { drawTextureAnim(); } } else { drawCircles(); } // drawTriangles(); }
void CubeAnalyzer::analyze(Mat cubeMat){ Mat display; Size imageSize = cubeMat.size(); int w = imageSize.width; this->cubeMat = cubeMat; medianBlur(cubeMat, cubeMat, 5); cubeMat.copyTo(display); Color sideColor = detectSide(); if (isPressed(lockChar)){ cube.lockWall(sideColor); }else if (isPressed(unlockChar)){ cube.unlockWall(sideColor); } if (w != 0 && sideColor != UNDEF){ int step = w / numberOfCellsInRow; int start = w * drawingPercentShift; int x, y, cellNumber; for (size_t horizontal = 0; horizontal < numberOfCellsInRow; horizontal++){ for (size_t vertical = 0; vertical < numberOfCellsInRow; vertical++){ x = start + step * horizontal; y = start + step * vertical; Color color = reconizeColor(x, y); drawCircles(display, Point(x,y), color); if (!cube.isWallLocked(sideColor)){ cellNumber = horizontal + vertical * numberOfCellsInRow; cube.setCell(sideColor, cellNumber, color); } } } imshow(windowName, display); } }
void ofApp::draw(){ world.draw(); if(gui->isDrawable) world.drawLines(); if(gui->isFieldEditable) fields.draw(); ofFill(); ofSetHexColor(0xFFFFFF); if(gui->isPlay) { drawCircles(); } }
void testApp::draw() { ofSetHexColor(0xffffff); grayImage.draw(0,0); // finally, a report: ofSetHexColor(0xffffff); char reportStr[1024]; sprintf(reportStr, "threshold %i (press: +/-)\nnum circs found %i, fps: %f", threshold, circCount,ofGetFrameRate()); ofDrawBitmapString(reportStr, 20, 600); drawCircles(); //tex.draw( 400,400,destWidth,destHeight); for ( int i=0 ; i<punched.size(); i++) { punched[i].draw(); } }
//-------------------------------------------------------------- void testApp::draw() { tileSaver.begin(); ofFill(); ofSetColor( 0x000000 ); ofRect( 0, 0, ofGetWidth(), ofGetHeight() ); ofSetColor( 0xFFFFFF ); if( bDrawGhost ) { ofEnableAlphaBlending(); ofSetColor( 255, 255, 255, 40 ); cameraGrayDiffImage.draw( logoCropRect.x, logoCropRect.y, logoCropRect.width, logoCropRect.height ); ofDisableAlphaBlending(); ofSetColor( 0xFFFFFF ); } // ofEnableAlphaBlending(); // logoAlpha.draw( 0, 0 ); // ofDisableAlphaBlending(); if( bDebug ) { drawDebug(); } drawCirclePacker(); drawCircles(); // floor.draw(); // box2d.draw(); tileSaver.end(); screenGrab.save(); ofSetColor( 0xFFFFFF ); ofDrawBitmapString( ofToString( ofGetFrameRate(), 0 ), 10, ofGetHeight() - 10 ); }
void GraphView::drawModel(sf::RenderWindow &rw) { drawEdges(rw); drawCircles(rw); }
/*! Draw the grid and axes \param painter Painter \param azimuthMap Maps azimuth values to values related to 0.0, M_2PI \param radialMap Maps radius values into painter coordinates. \param pole Position of the pole in painter coordinates \param radius Radius of the complete plot area in painter coordinates \param canvasRect Contents rect of the canvas in painter coordinates */ void QwtPolarGrid::draw( QPainter *painter, const QwtScaleMap &azimuthMap, const QwtScaleMap &radialMap, const QwtDoublePoint &pole, double radius, const QwtDoubleRect &canvasRect ) const { updateScaleDraws( azimuthMap, radialMap, pole, radius ); painter->save(); if ( testDisplayFlag( ClipAxisBackground ) ) { QRegion clipRegion( canvasRect.toRect() ); for ( int axisId = 0; axisId < QwtPolar::AxesCount; axisId++ ) { const AxisData &axis = d_data->axisData[axisId]; if ( axisId != QwtPolar::AxisAzimuth && axis.isVisible ) { QwtScaleDraw *scaleDraw = ( QwtScaleDraw * )axis.scaleDraw; if ( scaleDraw->hasComponent( QwtScaleDraw::Labels ) ) { const QwtValueList &ticks = scaleDraw->scaleDiv().ticks( QwtScaleDiv::MajorTick ); for ( int i = 0; i < int( ticks.size() ); i++ ) { QRect labelRect = scaleDraw->boundingLabelRect( axis.font, ticks[i] ); const int margin = 2; labelRect.setRect( labelRect.x() - margin, labelRect.y() - margin, labelRect.width() + 2 * margin, labelRect.height() + 2 * margin ); if ( labelRect.isValid() ) clipRegion -= QRegion( labelRect ); } } } } painter->setClipRegion( clipRegion ); } // draw radial grid const GridData &radialGrid = d_data->gridData[QwtPolar::Radius]; if ( radialGrid.isVisible && radialGrid.isMinorVisible ) { painter->setPen( radialGrid.minorPen ); drawCircles( painter, canvasRect, pole, radialMap, radialGrid.scaleDiv.ticks( QwtScaleDiv::MinorTick ) ); drawCircles( painter, canvasRect, pole, radialMap, radialGrid.scaleDiv.ticks( QwtScaleDiv::MediumTick ) ); } if ( radialGrid.isVisible ) { painter->setPen( radialGrid.majorPen ); drawCircles( painter, canvasRect, pole, radialMap, radialGrid.scaleDiv.ticks( QwtScaleDiv::MajorTick ) ); } // draw azimuth grid const GridData &azimuthGrid = d_data->gridData[QwtPolar::Azimuth]; if ( azimuthGrid.isVisible && azimuthGrid.isMinorVisible ) { painter->setPen( azimuthGrid.minorPen ); drawRays( painter, canvasRect, pole, radius, azimuthMap, azimuthGrid.scaleDiv.ticks( QwtScaleDiv::MinorTick ) ); drawRays( painter, canvasRect, pole, radius, azimuthMap, azimuthGrid.scaleDiv.ticks( QwtScaleDiv::MediumTick ) ); } if ( azimuthGrid.isVisible ) { painter->setPen( azimuthGrid.majorPen ); drawRays( painter, canvasRect, pole, radius, azimuthMap, azimuthGrid.scaleDiv.ticks( QwtScaleDiv::MajorTick ) ); } painter->restore(); for ( int axisId = 0; axisId < QwtPolar::AxesCount; axisId++ ) { const AxisData &axis = d_data->axisData[axisId]; if ( axis.isVisible ) { painter->save(); drawAxis( painter, axisId ); painter->restore(); } } }