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 ShapeContentGroup::pop(ofPath& path) { if(transform_.isDirty()) { transform_.refreshMatrix(); } transform_.pushMatrix(); ofColor prev_st = path.getStrokeColor(); ofColor prev_fi = path.getFillColor(); float opacity_st = prev_st.a/255.f*opacity_; float opacity_fi = prev_fi.a/255.f*opacity_; path.setStrokeColor(ofColor(prev_st, opacity_st*255)); path.setFillColor(ofColor(prev_fi, opacity_fi*255)); for(vector<ShapeContent*>::reverse_iterator it = content_.rbegin(); it != content_.rend(); ++it) { (*it)->pop(path); } path.setStrokeColor(prev_st); path.setFillColor(prev_fi); transform_.popMatrix(); }
void handlePathDrawStyle(ofPath& p) { p.setFilled(m_hasFill); p.setFillColor(m_fillColor); p.setStrokeColor(m_strokeColor); if( m_hasStroke ) { p.setStrokeWidth(m_strokeWeight); } else { p.setStrokeWidth(0); } }
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); }