void draw(){ path.draw(); path2.draw(); ofPushMatrix(); ofTranslate(300, 0); for ( auto p : unioned ) { p.draw(); } ofPopMatrix(); ofPushMatrix(); ofTranslate(600, 0); for ( auto p : diffed ) { p.draw(); } ofPopMatrix(); }
void ShapeContentFill::pop(ofPath& path) { ofPushStyle(); path.setFilled(true); ofColor prev = path.getFillColor(); float opacity = prev.a/255.f*opacity_; path.setFillColor(ofColor(color_, opacity*255)); ofEnableBlendMode(blend_mode_); path.draw(); path.setFillColor(prev); ofPopStyle(); }
void ShapeContentStroke::pop(ofPath& path) { ofPushStyle(); path.setFilled(false); ofColor prev = path.getStrokeColor(); float opacity = prev.a/255.f*opacity_; path.setStrokeColor(ofColor(color_, opacity*255)); path.setStrokeWidth(stroke_width_); ofEnableBlendMode(blend_mode_); path.draw(); path.setStrokeColor(prev); ofPopStyle(); }
void drawBranch(float x, float y, float radius, int level) { path.clear(); path.setStrokeColor(ofColor::blueSteel); path.setStrokeWidth(level*2); path.arc(x,y, radius,radius, -180, 0); path.draw(); ofFill(); ofSetColor(56); ofCircle(x, y, level*3); if (level > 0 ){ drawBranch(x-radius, y+radius/2, radius/2, level-1); drawBranch(x+radius, y+radius/2, radius/2, level-1); } // return drawBranch(x, y, radius, level); }