void Branch::draw( cairo::Context ctx ) { if ( mLaunchDelay > 0 ) return; if( ( mLifespan > 0 ) && ( ! mIsRoot ) ) { float ageLerp = 1.0 - mLifespan / (float)mTotalLifespan; float radius = lerp( mStartEllipseRadius, mEndEllipseRadius, ageLerp ); ColorA drawColor = lerp( mStartColor, mEndColor, ageLerp ); ctx.setSourceRgba( drawColor.r, drawColor.g, drawColor.b, 0.075f ); ctx.circle( mPos, ( 5.0f * mScale + radius * 1.3f ) / 2 ); ctx.fill(); ctx.setSource( drawColor ); ctx.circle( mPos, radius / 2 ); ctx.fill(); } for( vector<Branch>::iterator blossomIt = mBranches.begin(); blossomIt != mBranches.end(); ++blossomIt ) { blossomIt->draw( ctx ); } }
void ContinuousPathApp::drawCircle(cairo::Context &ctx, Vec2f const &pt, double diameter, Color col, bool outline) { ctx.setLineWidth(1); ctx.setSource( col ); ctx.newSubPath(); ctx.circle( pt.x, pt.y, diameter ); ctx.closePath(); if(outline){ ctx.stroke(); }else{ ctx.fill(); } }