void SVGStylable::glTraverseStroke(svgl::Context * svglContext, svgl::GLInfo* glinfo, float sw) { if(sw==0) return; #if 1 draw(*strokeGlPoly); #else double scale = glinfo->getCurrentScale(); //if(scale*sw>2) { if(0) { draw(*strokeGlPoly); } else { // TODO : set up dash for contour // draw the contour, but it must be dashed as well !!! shape_type * gshape = new shape_type; agg::path_storage * ppath = new agg::path_storage; asBezier(svglContext, glinfo, ppath); shape_type::contour_type * pcontour = new shape_type::contour_type(*ppath); gshape->_path = ppath; gshape->_contour = pcontour; unsigned int cmd; bool begun=false; double x,y,lastx, lasty; vector<GLfloat> coords; #if 0 SVGElement * meAsElement = dynamic_cast<SVGElement*>(this); if(meAsElement) std::cerr << meAsElement->getId() << __FL__; #endif pcontour->rewind(0); do { cmd = pcontour->vertex(&x,&y); //std::cerr << std::hex << DBGVAR(cmd) << std::dec << DBGVAR(x) << DBGVAR(y) << std::endl; if(agg::is_move_to(cmd)) { if(begun) { glInterleavedArrays(GL_V3F, 0, &coords[0]); glDrawArrays(GL_LINE_STRIP, 0, coords.size()/3); begun=false; } lastx=x; lasty=y; } else if (agg::is_line_to(cmd)) { if(!begun) { coords.clear(); coords.push_back(lastx); coords.push_back(lasty); coords.push_back(0); begun=true; } coords.push_back(x); coords.push_back(y); coords.push_back(0); } else if (agg::is_end_poly(cmd)) { if(agg::is_close(cmd)) { coords.push_back(lastx); coords.push_back(lasty); coords.push_back(0); } glInterleavedArrays(GL_V3F, 0, &coords[0]); glDrawArrays(GL_LINE_STRIP, 0, coords.size()/3); begun=false; } else { //stop_cmd //std::cerr << "unexpected agg_path command " << std::hex << cmd << std::dec << std::endl; } } while(cmd != agg::path_cmd_stop); if(begun) { glInterleavedArrays(GL_V3F, 0, &coords[0]); glDrawArrays(GL_LINE_STRIP, 0, coords.size()/3); begun=false; } #if 0 const css::CSSStyle::FloatType& strokeMiterLimit = style.getStrokeMiterlimit(); const css::CSSStyle::StrokeDasharrayType& strokeDasharray = style.getStrokeDasharray(); css::CSSStyle::LengthType strokeDashoffset = style.getStrokeDashoffset(); float dashOffset = svglContext->computeWidthLength(strokeDashoffset); //std::cerr << DBGVAR(dashOffset) << __FL__; if(!strokeDasharray.empty()) { shape_type::dash_type * pdash = new shape_type::dash_type(*pcontour); shape_type::dash_type& dash = *pdash; for(css::CSSStyle::StrokeDasharrayType::const_iterator it = strokeDasharray.begin(); it != strokeDasharray.end(); ++it) { double a,b; a = *it++; b = *it; dash.add_dash(a,b); } dash.dash_start(dashOffset); } #endif } #endif }