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


C++ ofPath类代码示例

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


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

示例1: mousePointerStraight

void pathFactory::mousePointerStraight(ofPath &p, float x_dim, float y_dim, float t_size){

    vector<ofPoint> tpoints;

    float tw = 0.3;
    float sw = 0.074;
    float cl = 1;
    float al = 0.74;
    float bl = 0.55;

    tpoints.push_back(ofPoint(0,0));
    tpoints.push_back(ofPoint(-tw,al));//a1
    tpoints.push_back(ofPoint(-sw,bl)); // b1
    tpoints.push_back(ofPoint(-sw,cl)); //c1
    tpoints.push_back(ofPoint(sw,cl));//c2
    tpoints.push_back(ofPoint(sw,bl)); // b2
    tpoints.push_back(ofPoint(tw,al)); //a2
    tpoints.push_back(ofPoint(0,0));


    for(int i = 0; i < tpoints.size(); i++){
        tpoints[i] *= ofVec2f(x_dim, y_dim);
        tpoints[i] *= t_size;
        p.lineTo(tpoints[i]);
    }

    p.close();

}
开发者ID:kimon-satan,项目名称:clamourMedia,代码行数:29,代码来源:pathFactory.cpp

示例2: 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;
}
开发者ID:N3TWORK,项目名称:ofxAE,代码行数:7,代码来源:ofxAEShapeCap.cpp

示例3: rectangle

// Temporary fix until OF 0.8.0
static void rectangle(ofPath & path, const ofRectangle & r){
	path.moveTo(r.getTopLeft());
	path.lineTo(r.getTopRight());
	path.lineTo(r.getBottomRight());
	path.lineTo(r.getBottomLeft());
	path.close();
}
开发者ID:NickHardeman,项目名称:ofxBox2d,代码行数:8,代码来源:ofxBox2dRect.cpp

示例4: ofxGetBoundingBox

ofRectangle ofxGetBoundingBox(ofPath &path) {
  ofRectangle rect;
  for (int i=0; i<path.getOutline().size(); i++) {
    ofRectangle b = path.getOutline().at(i).getBoundingBox();
    if (i==0) rect = b;
    else rect.growToInclude(b);
  }
  return rect;
}
开发者ID:companje,项目名称:ofxExtras,代码行数:9,代码来源:ofxExtras.cpp

示例5: 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();
}
开发者ID:IglooVision,项目名称:openFrameworks,代码行数:12,代码来源:ofPath.cpp

示例6: pop

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();
}
开发者ID:N3TWORK,项目名称:ofxAE,代码行数:12,代码来源:ofxAEShapeCap.cpp

示例7: handlePathDrawStyle

 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);
     }
 }
开发者ID:JosephLaurino,项目名称:ofx-experiments,代码行数:14,代码来源:processing.cpp

示例8: ofSetCurrentRenderer

void ofSetCurrentRenderer(ofPtr<ofBaseRenderer> renderer_){
	renderer = renderer_;
	renderer->setupGraphicDefaults();

	if(renderer->rendersPathPrimitives()){
		shape.setMode(ofPath::PATHS);
	}else{
		shape.setMode(ofPath::POLYLINES);
	}

	shape.setUseShapeColor(false);

	ofSetStyle(currentStyle);
}
开发者ID:jasonlevine,项目名称:body-controlled-instrument,代码行数:14,代码来源:ofGraphics.cpp

示例9: 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

示例10: roundedRect

void pathFactory::roundedRect(ofPath &p, float x_dim, float y_dim, float t_size){

    ofRectangle r;
    r.setFromCenter(0,0, x_dim * t_size, y_dim * t_size);
    p.rectRounded(r, t_size/10);

}
开发者ID:kimon-satan,项目名称:clamourMedia,代码行数:7,代码来源:pathFactory.cpp

示例11: ofSetCurrentRenderer

void ofSetCurrentRenderer(ofPtr<ofBaseRenderer> renderer_,bool setDefaults){
	renderer = renderer_;
	if(renderer->rendersPathPrimitives()){
		shape.setMode(ofPath::COMMANDS);
	}else{
		shape.setMode(ofPath::POLYLINES);
	}

	shape.setUseShapeColor(false);

	if(setDefaults){
		renderer->setupGraphicDefaults();
		ofSetStyle(currentStyle);
		ofBackground(currentStyle.bgColor);
	}
}
开发者ID:B-IT,项目名称:openFrameworks,代码行数:16,代码来源:ofGraphics.cpp

示例12: addPath

bool Clipper::addPath(const ofPath& paths,
                      ClipperLib::PolyType PolyTyp,
                      bool autoClose,
                      ClipperLib::cInt scale)
{
    return addPolylines(paths.getOutline(), PolyTyp, autoClose, scale);
}
开发者ID:bakercp,项目名称:ofxClipper,代码行数:7,代码来源:Clipper.cpp

示例13: 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

示例14: setupShape

void Svg::setupShape(struct svgtiny_shape * shape, ofPath & path){

	float* p = shape->path;

	path.setFilled(false);

	if(shape->fill != svgtiny_TRANSPARENT){
		path.setFilled(true);
		path.setFillHexColor(shape->fill);
		path.setPolyWindingMode(OF_POLY_WINDING_NONZERO);
    }

	if(shape->stroke != svgtiny_TRANSPARENT){
		path.setStrokeWidth(shape->stroke_width);
		path.setStrokeHexColor(shape->stroke);
	}

	for(int i = 0; i < (int)shape->path_length;){
		if(p[i] == svgtiny_PATH_MOVE){
			path.moveTo(p[i + 1], p[i + 2]);
			i += 3;
		}
		else if(p[i] == svgtiny_PATH_CLOSE){
			path.close();

			i += 1;
		}
		else if(p[i] == svgtiny_PATH_LINE){
			path.lineTo(p[i + 1], p[i + 2]);
			i += 3;
		}
		else if(p[i] == svgtiny_PATH_BEZIER){
			path.bezierTo(p[i + 1], p[i + 2],
						   p[i + 3], p[i + 4],
						   p[i + 5], p[i + 6]);
			i += 7;
		}
		else{
			ofLogError("Svg") << "setupShape(): SVG parse error";
			i += 1;
		}
	}
}
开发者ID:cviejo,项目名称:mPD,代码行数:43,代码来源:Svg.cpp

示例15: 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


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