本文整理汇总了C++中ofPath::getCommands方法的典型用法代码示例。如果您正苦于以下问题:C++ ofPath::getCommands方法的具体用法?C++ ofPath::getCommands怎么用?C++ ofPath::getCommands使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofPath
的用法示例。
在下文中一共展示了ofPath::getCommands方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: push
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;
}
示例2: pop
void ShapeContentShape::pop(ofPath& path)
{
vector<ofPath::Command>& command = path.getCommands();
while(command_count_-- > 0) {
command.pop_back();
}
}
示例3: append
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();
}
示例4: draw
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);
}
}