本文整理汇总了C++中ofPath::setStrokeWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ ofPath::setStrokeWidth方法的具体用法?C++ ofPath::setStrokeWidth怎么用?C++ ofPath::setStrokeWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofPath
的用法示例。
在下文中一共展示了ofPath::setStrokeWidth方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
示例2: setupShape
void ofxSVG::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);
ofColor color = path.getFillColor();
color.a = shape->opacity*255;
path.setColor(color);
path.setPolyWindingMode(OF_POLY_WINDING_ODD);
}
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("ofxSVG") << "setupShape(): SVG parse error";
i += 1;
}
}
ofRectangle pathBoundingBox = getBoundingBoxOfPath(path);
if(pathBoundingBox.getArea() != 0.0){
if(boundingBox.getArea() == 0.0){
boundingBox = pathBoundingBox;
}
else{
boundingBox.growToInclude(pathBoundingBox);
}
}
}
示例3: pop
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();
}
示例4: setup
void setup(){
ofBackground(0);
path.moveTo(0,0);
path.lineTo(120, 150);
path.lineTo(180, 100);
path.lineTo(300, 300);
path.lineTo(300, 400);
path.close();
path.setFilled(false);
path.setStrokeWidth(1);
path2.moveTo(100,50);
path2.lineTo(200, 250);
path2.lineTo(150, 500);
path2.close();
path2.setFilled(false);
path2.setStrokeWidth(1);
unioned = ofxGPC::getPolygonClip(ofxGPC::UNION, path, path2);
diffed = ofxGPC::getPolygonClip(ofxGPC::DIFF, path, path2);
}
示例5: 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;
}
}
}
示例6: drawBranch
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);
}