virtual void onDraw(SkCanvas* canvas) { this->drawBG(canvas); fSweep = SampleCode::GetAnimScalar(SkIntToScalar(360)/24, SkIntToScalar(360)); // fSweep = SkFloatToScalar(359.99f); SkRect r; SkPaint paint; paint.setAntiAlias(true); paint.setStrokeWidth(SkIntToScalar(2)); paint.setStyle(SkPaint::kStroke_Style); r.set(0, 0, SkIntToScalar(200), SkIntToScalar(200)); r.offset(SkIntToScalar(20), SkIntToScalar(20)); if (false) { const SkScalar d = SkIntToScalar(3); const SkScalar rad[] = { d, d, d, d, d, d, d, d }; SkPath path; path.addRoundRect(r, rad); canvas->drawPath(path, paint); return; } drawRectWithLines(canvas, r, paint); // printf("----- sweep %g %X\n", SkScalarToFloat(fSweep), SkDegreesToRadians(fSweep)); paint.setStyle(SkPaint::kFill_Style); paint.setColor(0x800000FF); canvas->drawArc(r, 0, fSweep, true, paint); paint.setColor(0x800FF000); canvas->drawArc(r, 0, fSweep, false, paint); paint.setStyle(SkPaint::kStroke_Style); paint.setColor(SK_ColorRED); canvas->drawArc(r, 0, fSweep, true, paint); paint.setStrokeWidth(0); paint.setColor(SK_ColorBLUE); canvas->drawArc(r, 0, fSweep, false, paint); drawArcs(canvas); this->inval(NULL); }
//-------------------------------------------------------------- void ofApp::draw(){ ofSetColor(0); drawArcs(); bool drawDebugInfo = true; if(drawDebugInfo) { //ofSetColor(0); stringstream debugInfo; debugInfo << "fps: " << ofToString(ofGetFrameRate(),0) << endl; debugInfo << "shader: " << useShader << endl; debugInfo << "eeg theta: " << ofToString(eegTheta,1) << endl; debugInfo << "eeg alpha: " << ofToString(eegAlpha,1) << endl; debugInfo << "accelerometer: " << ofToString(accelerometer.x,0) << ", " << ofToString(accelerometer.y,0) << ", " << ofToString(accelerometer.z,0) << endl; debugInfo << "arc width: " << arcWidth << endl; debugInfo << "arc res: " << arcResolution << endl; debugInfo << "arc thick: " << arcThickness;// << endl; ofDrawBitmapStringHighlight(debugInfo.str(), 20,20); } }