From 41833cc6958c81ba111a1b429d0d503834bb58c2 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Fri, 23 Mar 2012 20:06:18 +0100 Subject: powerstroke: correct naming of join parameter. breaks earlier created powerstroke paths, sorry. hope it does not hurt too many testers... (bzr r11120) --- src/live_effects/lpe-powerstroke.cpp | 54 ++++++++++++++++++------------------ src/live_effects/lpe-powerstroke.h | 2 +- 2 files changed, 28 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/live_effects/lpe-powerstroke.cpp b/src/live_effects/lpe-powerstroke.cpp index 6cc2d2368..1f521da5d 100644 --- a/src/live_effects/lpe-powerstroke.cpp +++ b/src/live_effects/lpe-powerstroke.cpp @@ -125,19 +125,19 @@ static const Util::EnumData LineCapTypeData[] = { }; static const Util::EnumDataConverter LineCapTypeConverter(LineCapTypeData, sizeof(LineCapTypeData)/sizeof(*LineCapTypeData)); -enum LineCuspType { - LINECUSP_BEVEL, - LINECUSP_ROUND, - LINECUSP_EXTRP_MITER, - LINECUSP_MITER +enum LineJoinType { + LINEJOIN_BEVEL, + LINEJOIN_ROUND, + LINEJOIN_EXTRP_MITER, + LINEJOIN_MITER }; -static const Util::EnumData LineCuspTypeData[] = { - {LINECUSP_BEVEL, N_("Beveled"), "bevel"}, - {LINECUSP_ROUND, N_("Rounded"), "round"}, - {LINECUSP_EXTRP_MITER, N_("Extrapolated"), "extrapolated"}, - {LINECUSP_MITER, N_("Miter"), "miter"}, +static const Util::EnumData LineJoinTypeData[] = { + {LINEJOIN_BEVEL, N_("Beveled"), "bevel"}, + {LINEJOIN_ROUND, N_("Rounded"), "round"}, + {LINEJOIN_EXTRP_MITER, N_("Extrapolated"), "extrapolated"}, + {LINEJOIN_MITER, N_("Miter"), "miter"}, }; -static const Util::EnumDataConverter LineCuspTypeConverter(LineCuspTypeData, sizeof(LineCuspTypeData)/sizeof(*LineCuspTypeData)); +static const Util::EnumDataConverter LineJoinTypeConverter(LineJoinTypeData, sizeof(LineJoinTypeData)/sizeof(*LineJoinTypeData)); LPEPowerStroke::LPEPowerStroke(LivePathEffectObject *lpeobject) : Effect(lpeobject), @@ -146,7 +146,7 @@ LPEPowerStroke::LPEPowerStroke(LivePathEffectObject *lpeobject) : interpolator_type(_("Interpolator type"), _("Determines which kind of interpolator will be used to interpolate between stroke width along the path."), "interpolator_type", InterpolatorTypeConverter, &wr, this, Geom::Interpolate::INTERP_CUBICBEZIER_JOHAN), interpolator_beta(_("Smoothness"), _("Sets the smoothness for the CubicBezierJohan interpolator. 0 = linear interpolation, 1 = smooth"), "interpolator_beta", &wr, this, 0.2), start_linecap_type(_("Start cap"), _("Determines the shape of the path's start."), "start_linecap_type", LineCapTypeConverter, &wr, this, LINECAP_ROUND), - cusp_linecap_type(_("Join"), _("Specifies the shape of the path's corners."), "cusp_linecap_type", LineCuspTypeConverter, &wr, this, LINECUSP_ROUND), + linejoin_type(_("Join"), _("Specifies the shape of the path's corners."), "linejoin_type", LineJoinTypeConverter, &wr, this, LINEJOIN_ROUND), miter_limit(_("Miter limit"), _("Maximum length of the miter (in units of stroke width)"), "miter_limit", &wr, this, 4.), end_linecap_type(_("End cap"), _("Determines the shape of the path's end."), "end_linecap_type", LineCapTypeConverter, &wr, this, LINECAP_ROUND) { @@ -162,7 +162,7 @@ LPEPowerStroke::LPEPowerStroke(LivePathEffectObject *lpeobject) : registerParameter( dynamic_cast(&interpolator_type) ); registerParameter( dynamic_cast(&interpolator_beta) ); registerParameter( dynamic_cast(&start_linecap_type) ); - registerParameter( dynamic_cast(&cusp_linecap_type) ); + registerParameter( dynamic_cast(&linejoin_type) ); registerParameter( dynamic_cast(&miter_limit) ); registerParameter( dynamic_cast(&end_linecap_type) ); } @@ -204,9 +204,9 @@ static bool compare_offsets (Geom::Point first, Geom::Point second) // find discontinuities in input path struct discontinuity_data { - Geom::Point der0; // unit derivative of 'left' side of cusp - Geom::Point der1; // unit derivative of 'right' side of cusp - double width; // intended stroke width at cusp + Geom::Point der0; // unit derivative of 'left' side of join + Geom::Point der1; // unit derivative of 'right' side of join + double width; // intended stroke width at join }; std::vector find_discontinuities( Geom::Piecewise > const & der, Geom::Piecewise const & x, @@ -243,12 +243,12 @@ std::vector find_discontinuities( Geom::Piecewise > const & B, std::vector const & cusps, - LineCuspType cusp_linecap, + LineJoinType jointype, double miter_limit, bool forward_direction, double tol=Geom::EPSILON) { -/* per definition, each discontinuity should be fixed with a cusp-ending, as defined by cusp_linecap_type +/* per definition, each discontinuity should be fixed with a join-ending, as defined by linejoin_type */ Geom::PathBuilder pb; if (B.size() == 0) { @@ -272,8 +272,8 @@ Geom::Path path_from_piecewise_fix_cusps( Geom::Piecewise { // discontinuity found, so fix it :-) discontinuity_data cusp = cusps[cusp_i]; - switch (cusp_linecap) { - case LINECUSP_ROUND: { + switch (jointype) { + case LINEJOIN_ROUND: { if ( sign*cusp.width*angle_between(cusp.der0, cusp.der1) < 0.) { // we are on the outside: round corner /* for constant width paths, the rounding is a circular arc (rx == ry), @@ -303,7 +303,7 @@ Geom::Path path_from_piecewise_fix_cusps( Geom::Piecewise } break; } -/* case LINECUSP_NONE: { +/* case LINEJOIN_NONE: { if ( sign*cusp.width*angle_between(cusp.der0, cusp.der1) < 0.) { // we are on the outside Geom::Point der1 = unitTangentAt(B[prev_i],1); @@ -315,7 +315,7 @@ Geom::Path path_from_piecewise_fix_cusps( Geom::Piecewise pb.lineTo(B[i].at0()); // default to bevel for too shallow cusp angles } } */ - case LINECUSP_EXTRP_MITER: { + case LINEJOIN_EXTRP_MITER: { // first figure out whether we are on the outside or inside of the corner in the path if ( sign*cusp.width*angle_between(cusp.der0, cusp.der1) < 0.) { // we are on the outside, do something complicated to make it look good ;) @@ -354,7 +354,7 @@ Geom::Path path_from_piecewise_fix_cusps( Geom::Piecewise } break; } - case LINECUSP_MITER: { + case LINEJOIN_MITER: { // first figure out whether we are on the outside or inside of the corner in the path if ( sign*cusp.width*angle_between(cusp.der0, cusp.der1) < 0.) { // we are on the outside, do something complicated to make it look good ;) @@ -379,7 +379,7 @@ Geom::Path path_from_piecewise_fix_cusps( Geom::Piecewise } break; } - case LINECUSP_BEVEL: + case LINEJOIN_BEVEL: default: pb.lineTo(B[i].at0()); break; @@ -457,13 +457,13 @@ LPEPowerStroke::doEffect_path (std::vector const & path_in) } std::vector cusps = find_discontinuities(der, x, y); - LineCuspType cusp_linecap = static_cast(cusp_linecap_type.get_value()); + LineJoinType jointype = static_cast(linejoin_type.get_value()); Piecewise > pwd2_out = compose(pwd2_in,x) + y*compose(n,x); Piecewise > mirrorpath = reverse(compose(pwd2_in,x) - y*compose(n,x)); - Geom::Path fixed_path = path_from_piecewise_fix_cusps( pwd2_out, cusps, cusp_linecap, miter_limit, true, LPE_CONVERSION_TOLERANCE); - Geom::Path fixed_mirrorpath = path_from_piecewise_fix_cusps( mirrorpath, cusps, cusp_linecap, miter_limit, false, LPE_CONVERSION_TOLERANCE); + Geom::Path fixed_path = path_from_piecewise_fix_cusps( pwd2_out, cusps, jointype, miter_limit, true, LPE_CONVERSION_TOLERANCE); + Geom::Path fixed_mirrorpath = path_from_piecewise_fix_cusps( mirrorpath, cusps, jointype, miter_limit, false, LPE_CONVERSION_TOLERANCE); if (path_in[0].closed()) { fixed_path.close(true); diff --git a/src/live_effects/lpe-powerstroke.h b/src/live_effects/lpe-powerstroke.h index a5bb8c836..e6c915234 100644 --- a/src/live_effects/lpe-powerstroke.h +++ b/src/live_effects/lpe-powerstroke.h @@ -39,7 +39,7 @@ private: EnumParam interpolator_type; ScalarParam interpolator_beta; EnumParam start_linecap_type; - EnumParam cusp_linecap_type; + EnumParam linejoin_type; ScalarParam miter_limit; EnumParam end_linecap_type; -- cgit v1.2.3