void ShapeContentRect::push(ofPath& path) { vector<ofPath::Command>& command = path.getCommands(); int command_count_prev = command.size(); path.rectRounded(pos_-size_/2.f, size_.x, size_.y, roundness_); command_count_ = command.size() - command_count_prev; }
void ShapeContentShape::pop(ofPath& path) { vector<ofPath::Command>& command = path.getCommands(); while(command_count_-- > 0) { command.pop_back(); } }
void ShapeContentEllipse::push(ofPath& path) { vector<ofPath::Command>& command = path.getCommands(); int command_count_prev = command.size(); path.ellipse(pos_.x, pos_.y, size_.x, size_.y); path.close(); command_count_ = command.size() - command_count_prev; }
void ShapeContentPoly::push(ofPath& path) { vector<ofPath::Command>& command = path.getCommands(); int command_count_prev = command.size(); command_count_ = command.size() - command_count_prev; }
void ShapeContentPath::push(ofPath& path) { vector<ofPath::Command>& command = path.getCommands(); int command_count_prev = command.size(); vector<ofPath::Command>& my_command = path_.getCommands(); for(vector<ofPath::Command>::iterator it = my_command.begin(); it != my_command.end(); ++it) { command.push_back(*it); } command_count_ = command.size() - command_count_prev; }
void ofPath::append(const ofPath & path){ if(mode==COMMANDS){ for(auto & command: path.getCommands()){ addCommand(command); } }else{ for(auto & poly: path.getOutline()){ polylines.push_back(poly); } } flagShapeChanged(); }
void ofCairoRenderer::draw(ofPath & shape){ cairo_new_path(cr); vector<ofPath::Command> & commands = shape.getCommands(); for(int i=0;i<(int)commands.size();i++){ draw(commands[i]); } cairo_fill_rule_t cairo_poly_mode; if(shape.getWindingMode()==OF_POLY_WINDING_ODD) cairo_poly_mode=CAIRO_FILL_RULE_EVEN_ODD; else cairo_poly_mode=CAIRO_FILL_RULE_WINDING; cairo_set_fill_rule(cr,cairo_poly_mode); ofColor prevColor; if(shape.getUseShapeColor()){ prevColor = ofGetStyle().color; } if(shape.isFilled()){ if(shape.getUseShapeColor()){ ofColor c = shape.getFillColor(); c.a = shape.getFillColor().a; cairo_set_source_rgba(cr, (float)c.r/255.0, (float)c.g/255.0, (float)c.b/255.0, (float)c.a/255.0); } if(shape.hasOutline()){ cairo_fill_preserve( cr ); }else{ cairo_fill(cr); } } if(shape.hasOutline()){ float lineWidth = ofGetStyle().lineWidth; if(shape.getUseShapeColor()){ ofColor c = shape.getStrokeColor(); c.a = shape.getStrokeColor().a; cairo_set_source_rgba(cr, (float)c.r/255.0, (float)c.g/255.0, (float)c.b/255.0, (float)c.a/255.0); } cairo_set_line_width( cr, shape.getStrokeWidth() ); cairo_stroke( cr ); cairo_set_line_width( cr, lineWidth ); } if(shape.getUseShapeColor()){ setColor(prevColor); } }