当前位置: 首页>>代码示例>>C++>>正文


C++ ofPath::getSubPaths方法代码示例

本文整理汇总了C++中ofPath::getSubPaths方法的典型用法代码示例。如果您正苦于以下问题:C++ ofPath::getSubPaths方法的具体用法?C++ ofPath::getSubPaths怎么用?C++ ofPath::getSubPaths使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ofPath的用法示例。


在下文中一共展示了ofPath::getSubPaths方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ofxGetPointsFromPath

vector<ofPoint*> ofxGetPointsFromPath(ofPath &path) {
    vector<ofPoint*> points;
    vector<ofSubPath> &subpaths = path.getSubPaths();
    for (int i=0; i<subpaths.size(); i++) {
        vector<ofSubPath::Command> &commands = subpaths[i].getCommands();
        for (int j=0; j<commands.size(); j++) {
            points.push_back(&commands[j].to);
        }
    }
    return points;
}
开发者ID:Bicicletorama,项目名称:Game,代码行数:11,代码来源:ofxExtras.cpp

示例2: draw

//-----------------------------------------------------------------------------------
void ofxCairoTexture::draw(ofPath & shape){
	cairo_new_path(cr);
	vector<ofSubPath> & paths = shape.getSubPaths();
	for(int i=0;i<(int)paths.size();i++){
		draw(paths[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()){
		//printf("using color!\n");
		prevColor = ofGetStyle().color;
	}
	
	if(shape.isFilled()){
		if(shape.getUseShapeColor()){
			ofColor c = shape.getFillColor() * ofGetStyle().color;
			c.a = shape.getFillColor().a/255. * ofGetStyle().color.a;
			//printf("color %i %i %i %i!\n", shape.getFillColor().r, shape.getFillColor().g, shape.getFillColor().b, shape.getFillColor().a);
			//printf("style %f %f %f %f!\n", (float)ofGetStyle().color.r/255.0, (float)ofGetStyle().color.g/255.0, (float)ofGetStyle().color.b/255.0, (float)ofGetStyle().color.a/255.0);
			//printf("alpha %f %f!\n", (float)c.a, ofGetStyle().color.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.getFillColor() * ofGetStyle().color;
			c.a = shape.getFillColor().a/255. * ofGetStyle().color.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);
	}
	ofPopStyle();
}
开发者ID:Kaftan777ski,项目名称:mapinect,代码行数:54,代码来源:ofxCairoTexture.cpp

示例3: ofxGetPolylinesFromPath

vector<ofPolyline> ofxGetPolylinesFromPath(ofPath path) {
    vector<ofPolyline> polylines;
    vector<ofSubPath> &subpaths = path.getSubPaths();
    for (int i=0; i<subpaths.size(); i++) {
        ofPolyline poly;
        vector<ofSubPath::Command> &commands = subpaths[i].getCommands();
        for (int j=0; j<commands.size()-1; j++) {
            poly.addVertex(commands[i].to);
        }
        polylines.push_back(poly);
    }
    return polylines;
}
开发者ID:Bicicletorama,项目名称:Game,代码行数:13,代码来源:ofxExtras.cpp

示例4: ofxSimplifyPath

void ofxSimplifyPath(ofPath &path, int iterations, float amount, float distance) { //wat doet amount?? should be distance???
    for (int iteration=0; iteration<iterations; iteration++) {
        vector<ofSubPath> &subpaths = path.getSubPaths();
        for (int i=0; i<subpaths.size(); i++) {
            vector<ofSubPath::Command> &commands = subpaths[i].getCommands();
            if (commands.size()<amount) continue;
            for (int j=1; j<commands.size()-2; j++) { //laat eerste en laatste punt met rust
                if (commands[j].to.distance(commands[j+1].to)<distance) {
                    commands[j].to = (commands[j].to+commands[j+1].to)/2;
                    commands.erase(commands.begin()+j+1);
                }
            }
        }
    }
    path.flagShapeChanged();
}
开发者ID:Bicicletorama,项目名称:Game,代码行数:16,代码来源:ofxExtras.cpp

示例5: ofxSimplifyPath

void ofxSimplifyPath(ofPath &path, int iterations, float amount) {
    for (int iteration=0; iteration<iterations; iteration++) {
        vector<ofSubPath> &subpaths = path.getSubPaths();
        for (int i=0; i<subpaths.size(); i++) {
            vector<ofSubPath::Command> &commands = subpaths[i].getCommands();
            if (commands.size()<amount) continue;
            for (int j=0; j<commands.size()-1; j++) {
                if (commands[j].to.distance(commands[j+1].to)<3) {
                    commands[j].to = (commands[j].to+commands[j+1].to)/2;
                    commands.erase(commands.begin()+j+1);
                }
            }
        }
    }
    path.flagShapeChanged();
}
开发者ID:minusplusminus,项目名称:ofxExtras,代码行数:16,代码来源:ofxExtras.cpp


注:本文中的ofPath::getSubPaths方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。