Ejemplo n.º 1
0
void testApp :: drawContoursSmall ()
{
	float scale;
	scale = debugRect.width / (float)noiseRect.width;
	
	ofFill();
	ofSetColor( 0x000000 );
	ofRect( 0, 0, debugRect.width, debugRect.height );
	
	glScalef( scale, scale, 0 );
	
	ofNoFill();
	ofSetColor( 0xDD00CC );
	drawContourBoundingBoxes( contourBlobs );
	
	ofNoFill();
	ofSetColor( 0x00FFFF );
	drawContourLines( contourBlobs );
}
Ejemplo n.º 2
0
/*!
  \brief Draw the spectrogram

  \param painter Painter
  \param xMap Maps x-values into pixel coordinates.
  \param yMap Maps y-values into pixel coordinates.
  \param canvasRect Contents rectangle of the canvas in painter coordinates

  \sa setDisplayMode(), renderImage(),
      QwtPlotRasterItem::draw(), drawContourLines()
*/
void QwtPlotSpectrogram::draw( QPainter *painter,
    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
    const QRectF &canvasRect ) const
{
    if ( d_data->displayMode & ImageMode )
        QwtPlotRasterItem::draw( painter, xMap, yMap, canvasRect );

    if ( d_data->displayMode & ContourMode )
    {
        // Add some pixels at the borders
        const int margin = 2;
        QRectF rasterRect( canvasRect.x() - margin, canvasRect.y() - margin,
            canvasRect.width() + 2 * margin, canvasRect.height() + 2 * margin );

        QRectF area = QwtScaleMap::invTransform( xMap, yMap, rasterRect );

        const QRectF br = boundingRect();
        if ( br.isValid() )
        {
            area &= br;
            if ( area.isEmpty() )
                return;

            rasterRect = QwtScaleMap::transform( xMap, yMap, area );
        }

        QSize raster = contourRasterSize( area, rasterRect.toRect() );
        raster = raster.boundedTo( rasterRect.toRect().size() );
        if ( raster.isValid() )
        {
            const QwtRasterData::ContourLines lines =
                renderContourLines( area, raster );

            drawContourLines( painter, xMap, yMap, lines );
        }
    }
}
Ejemplo n.º 3
0
//--------------------------------------------------------------
void testApp::draw()
{
	tileSaver.begin();
	
	//-- background.
	
	ofFill();
	ofSetColor( 0x000000 );
	ofRect( 0, 0, ofGetWidth(), ofGetHeight() );
	
	//-- large.
	
	if( bDrawColor )
	{
		ofColor c0 = colorPicker0.getColor();
		
		ofFill();
		ofSetColor( c0.r, c0.g, c0.b );
		ofRect( 0, 0, ofGetWidth(), ofGetHeight() );
		
		drawContourLines( contourBlobsSimplified, true );
	}
	
	if( bDrawLines )
	{
		ofNoFill();
		ofSetColor( 0xFFFFFF );
		drawContourLines( contourBlobsScaled );
	}
	
	if( bDrawSimplified )
	{
		ofNoFill();
		ofSetColor( 0xFFFFFF );
		drawContourLines( contourBlobsSimplified );
	}
	
	if( bDrawCurves )
	{
		ofNoFill();
		ofSetColor( 0xFFFFFF );
		drawContourCurveLines( contourBlobsScaled );
	}
	
	if( bDrawPoints )
	{
		ofFill();
		ofSetColor( 0xFF0000 );
		drawContourPoints( contourBlobsScaled );
	}
	
	tileSaver.end();
	
	if( screenGrabUtil.isRecording() )
		screenGrabUtil.save();
	
	//-- debug.
	
	if( !bDebug )
		return;
	
	int pad;
	pad = 10;
	
	glPushMatrix();
	glTranslatef( ofGetWidth() - debugRect.width - pad, pad, 0 );
	
	drawBorder( debugRect );
	drawNoiseImage();
	
	glTranslatef( 0, debugRect.height + pad, 0 );
	
	drawBorder( debugRect );
	drawNoiseBand();

	glTranslatef( 0, debugRect.height + pad, 0 );
	
	drawBorder( debugRect );
	drawNoiseBandSum();

	glTranslatef( 0, debugRect.height + pad, 0 );
	
	drawBorder( debugRect );
	drawContoursSmall();
	
	glPopMatrix();
	
	gui.draw();
}