diff options
| author | root <root@jtx.marker.es> | 2013-04-14 04:46:28 +0000 |
|---|---|---|
| committer | root <root@jtx.marker.es> | 2013-04-14 04:46:28 +0000 |
| commit | 329113c127323d603cdece99d3c5622d9a4864b0 (patch) | |
| tree | baf0f4ab99f48bd2e7627e9b053a532405838825 /src | |
| parent | testing halo (diff) | |
| parent | odg export: some work on gradients (diff) | |
| download | inkscape-329113c127323d603cdece99d3c5622d9a4864b0.tar.gz inkscape-329113c127323d603cdece99d3c5622d9a4864b0.zip | |
adding halos
(bzr r11950.1.91)
Diffstat (limited to 'src')
| -rw-r--r-- | src/display/cairo-utils.h | 2 | ||||
| -rw-r--r-- | src/display/canvas-bpath.cpp | 16 | ||||
| -rw-r--r-- | src/display/nr-style.cpp | 2 | ||||
| -rw-r--r-- | src/display/nr-style.h | 2 | ||||
| -rw-r--r-- | src/draw-context.cpp | 15 | ||||
| -rw-r--r-- | src/draw-context.h | 4 | ||||
| -rw-r--r-- | src/extension/internal/odf.cpp | 87 | ||||
| -rw-r--r-- | src/extension/internal/odf.h | 4 | ||||
| -rw-r--r-- | src/pen-context.cpp | 72 | ||||
| -rw-r--r-- | src/proofs | 2 | ||||
| -rw-r--r-- | src/sp-paint-server-reference.h | 2 | ||||
| -rw-r--r-- | src/sp-pattern.cpp | 2 |
12 files changed, 129 insertions, 81 deletions
diff --git a/src/display/cairo-utils.h b/src/display/cairo-utils.h index 2596cd969..016f72d00 100644 --- a/src/display/cairo-utils.h +++ b/src/display/cairo-utils.h @@ -203,4 +203,4 @@ inline guint AssembleARGB32(guint32 a, guint32 r, guint32 g, guint32 b) fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/canvas-bpath.cpp b/src/display/canvas-bpath.cpp index 061ff7676..6ac69a325 100644 --- a/src/display/canvas-bpath.cpp +++ b/src/display/canvas-bpath.cpp @@ -146,10 +146,9 @@ sp_canvas_bpath_render (SPCanvasItem *item, SPCanvasBuf *buf) cairo_set_tolerance(buf->ct, 0.5); cairo_new_path(buf->ct); - feed_pathvector_to_cairo (buf->ct, cbp->curve->get_pathvector(), cbp->affine, area, /* optimized_stroke = */ !dofill, 1); - cairo_save(buf->ct); + if (dofill) { // RGB / BGR @@ -161,18 +160,15 @@ sp_canvas_bpath_render (SPCanvasItem *item, SPCanvasBuf *buf) if (dostroke) { ink_cairo_set_source_rgba32(buf->ct, cbp->stroke_rgba); - cairo_set_line_width(buf->ct, 1); + if(cbp->stroke_rgba == 0xffffff10){ + cairo_set_line_width(buf->ct, 3); + }else{ + cairo_set_line_width(buf->ct, 1); + } if (cbp->dashes[0] != 0 && cbp->dashes[1] != 0) { cairo_set_dash (buf->ct, cbp->dashes, 2, 0); } cairo_stroke(buf->ct); - cairo_restore(buf->ct); - //feed_pathvector_to_cairo (buf->ct, cbp->curve->get_pathvector(), cbp->affine, area, - ///* optimized_stroke = */ !dofill, 1); - ink_cairo_set_source_rgba32(buf->ct, 0xffffff20); - cairo_set_line_width(buf->ct, 7); - cairo_set_line_cap(buf->ct,CAIRO_LINE_CAP_ROUND); - cairo_stroke(buf->ct); } else { cairo_new_path(buf->ct); } diff --git a/src/display/nr-style.cpp b/src/display/nr-style.cpp index ba2340074..26d70ad15 100644 --- a/src/display/nr-style.cpp +++ b/src/display/nr-style.cpp @@ -220,4 +220,4 @@ void NRStyle::update() fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/display/nr-style.h b/src/display/nr-style.h index 80547c43e..cd0bd208f 100644 --- a/src/display/nr-style.h +++ b/src/display/nr-style.h @@ -81,4 +81,4 @@ struct NRStyle { fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/draw-context.cpp b/src/draw-context.cpp index 356853e09..33e9b4a5d 100644 --- a/src/draw-context.cpp +++ b/src/draw-context.cpp @@ -99,6 +99,7 @@ static void sp_draw_context_init(SPDrawContext *dc) dc->red_color = 0xff00007f; dc->blue_color = 0x0000ff7f; dc->green_color = 0x00ff007f; + dc->halo_color = 0xffffff10; dc->red_curve_is_valid = false; dc->red_bpath = NULL; @@ -107,6 +108,8 @@ static void sp_draw_context_init(SPDrawContext *dc) dc->blue_bpath = NULL; dc->blue_curve = NULL; + dc->halo_bpath = NULL; + dc->green_bpaths = NULL; dc->green_curve = NULL; dc->green_anchor = NULL; @@ -176,6 +179,10 @@ static void sp_draw_context_setup(SPEventContext *ec) dc->blue_bpath = sp_canvas_bpath_new(sp_desktop_sketch(ec->desktop), NULL); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(dc->blue_bpath), dc->blue_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); + // Create halo bpath + dc->halo_bpath = sp_canvas_bpath_new(sp_desktop_sketch(ec->desktop), NULL); + sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(dc->halo_bpath), dc->halo_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); + // Create blue curve dc->blue_curve = new SPCurve(); @@ -532,6 +539,8 @@ void spdc_concat_colors_and_flush(SPDrawContext *dc, gboolean forceclosed) dc->red_curve->reset(); sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(dc->red_bpath), NULL); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(dc->halo_bpath), NULL); + if (c->is_empty()) { c->unref(); return; @@ -752,6 +761,12 @@ static void spdc_free_colors(SPDrawContext *dc) dc->blue_curve = dc->blue_curve->unref(); } + // Halo + if (dc->halo_bpath) { + sp_canvas_item_destroy(SP_CANVAS_ITEM(dc->halo_bpath)); + dc->halo_bpath = NULL; + } + // Green while (dc->green_bpaths) { sp_canvas_item_destroy(SP_CANVAS_ITEM(dc->green_bpaths->data)); diff --git a/src/draw-context.h b/src/draw-context.h index 98309c0cb..5a2db5ae0 100644 --- a/src/draw-context.h +++ b/src/draw-context.h @@ -44,6 +44,7 @@ struct SPDrawContext : public SPEventContext{ guint32 red_color; guint32 blue_color; guint32 green_color; + guint32 halo_color; // Red SPCanvasItem *red_bpath; @@ -53,6 +54,9 @@ struct SPDrawContext : public SPEventContext{ SPCanvasItem *blue_bpath; SPCurve *blue_curve; + // Halo + SPCanvasItem *halo_bpath; + // Green GSList *green_bpaths; SPCurve *green_curve; diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp index 9fc6ecfdb..70798099d 100644 --- a/src/extension/internal/odf.cpp +++ b/src/extension/internal/odf.cpp @@ -1315,7 +1315,7 @@ writePath(Writer &outs, Geom::PathVector const &pathv, return nrPoints; } -bool OdfOutput::processStyle(Writer &outs, SPItem *item, const Glib::ustring &id, const Glib::ustring &gradientNameFill)//, Glib::ustring &styleString) +bool OdfOutput::processStyle(Writer &outs, SPItem *item, const Glib::ustring &id, const Glib::ustring &gradientNameFill, const Glib::ustring &gradientNameStroke) { if (!item) { @@ -1409,8 +1409,7 @@ bool OdfOutput::processStyle(Writer &outs, SPItem *item, const Glib::ustring &id styleLookupTable[id] = styleName; Glib::ustring tmpstring = Glib::ustring::compose ("<style:style style:name=\"%1\" style:family=\"graphic\" style:parent-style-name=\"standard\">\n", si.name); - // Glib::ustring tmpstring; - tmpstring += "<style:graphic-properties "; + tmpstring += "<style:graphic-properties"; if (si.fill == "gradient") { tmpstring += Glib::ustring::compose (" draw:fill=\"gradient\" draw:fill-gradient-name=\"%1\"", gradientNameFill); @@ -1420,19 +1419,22 @@ bool OdfOutput::processStyle(Writer &outs, SPItem *item, const Glib::ustring &id tmpstring += Glib::ustring(" draw:fill=\"") + si.fill + "\""; if(si.fill != "none") { - tmpstring += Glib::ustring::compose(" draw:fill-color=\"%1\" draw:fill-opacity=\"%2\"", si.fillColor, si.fillOpacity); + // tmpstring += Glib::ustring::compose(" draw:fill-color=\"%1\" draw:fill-opacity=\"%2\"", si.fillColor, si.fillOpacity); + tmpstring += Glib::ustring::compose(" draw:fill-color=\"%1\"", si.fillColor); } } if (si.stroke == "gradient") { - tmpstring += Glib::ustring (" draw:stroke=\"gradient\" draw:stroke-gradient-name=\"NotYetProgrammedPleaseBePatient\""); + //does not seem to be supported by Open Office.org + tmpstring += Glib::ustring::compose (" draw:stroke=\"gradient\" draw:stroke-gradient-name=\"%1\"", gradientNameStroke); } else { tmpstring += Glib::ustring(" draw:stroke=\"") + si.stroke + "\""; if (si.stroke != "none") { - tmpstring += Glib::ustring::compose (" svg:stroke-width=\"%1\" svg:stroke-color=\"%2\" svg:stroke-opacity=\"%3\" ", si.strokeWidth, si.strokeColor, si.strokeOpacity); + tmpstring += Glib::ustring::compose (" svg:stroke-width=\"%1\" svg:stroke-color=\"%2\" ", si.strokeWidth, si.strokeColor); + // tmpstring += Glib::ustring::compose (" svg:stroke-width=\"%1\" svg:stroke-color=\"%2\" draw:stroke-opacity=\"%3\" ", si.strokeWidth, si.strokeColor, si.strokeOpacity); } } tmpstring += "/>\n</style:style>\n"; @@ -1441,7 +1443,7 @@ bool OdfOutput::processStyle(Writer &outs, SPItem *item, const Glib::ustring &id return true; } -bool OdfOutput::processGradient(Writer &outs, SPItem *item, +bool OdfOutput::processGradient(SPItem *item, const Glib::ustring &id, Geom::Affine &/*tf*/, Glib::ustring& gradientName, Glib::ustring& output, bool checkFillGradient) { @@ -1494,8 +1496,11 @@ bool OdfOutput::processGradient(Writer &outs, SPItem *item, { gi.style = "radial"; SPRadialGradient *radGrad = SP_RADIALGRADIENT(gradient); - gi.cx = radGrad->cx.computed * 100.0;//ODG cx is percentages - gi.cy = radGrad->cy.computed * 100.0; + SPRadialGradient tmpGrad = *radGrad; + tmpGrad.cx.unit= SVGLength::PERCENT; + tmpGrad.cy.unit= SVGLength::PERCENT; + gi.cx = tmpGrad.cx.computed;// * 100.0;//ODG cx is percentages + gi.cy = tmpGrad.cy.computed;// * 100.0; } else { @@ -1511,7 +1516,6 @@ bool OdfOutput::processGradient(Writer &outs, SPItem *item, if (gi.equals(*iter)) { //map to existing gradientTable entry - // Glib::ustring gradientName = iter->name; gradientName = iter->name; gradientLookupTable[id] = gradientName; gradientMatch = true; @@ -1525,7 +1529,6 @@ bool OdfOutput::processGradient(Writer &outs, SPItem *item, } // No match, let us write a new entry - // Glib::ustring gradientName = Glib::ustring::compose("gradient%1", gradientTable.size()); gradientName = Glib::ustring::compose("gradient%1", gradientTable.size()); gi.name = gradientName; gradientTable.push_back(gi); @@ -1552,16 +1555,12 @@ bool OdfOutput::processGradient(Writer &outs, SPItem *item, return false; } output += Glib::ustring::compose("<draw:gradient draw:name=\"%1\"", gi.name); - // "<draw:gradient id=\"%1\" draw:name=\"%2\"\n", gi.name, gi.name); output += Glib::ustring::compose(" draw:display-name=\"imported linear %1\"", gradientCount); output += " draw:style=\"linear\""; - // outs.writeUString (tmpstring); - // outs.printf(" draw:start-color=\"#%06lx\" draw:end-color=\"#%06lx\"\n", gi.stops[0].rgb, gi.stops[1].rgb); snprintf(buf, 127, " draw:start-color=\"#%06lx\" draw:end-color=\"#%06lx\"", gi.stops[0].rgb, gi.stops[1].rgb); output += buf; - output += Glib::ustring::compose(" draw:start-intensity=\"%1\" draw:end-intensity=\"%2\" draw:angle=\"0\" draw:border=\"0%%\"/>\n", - gi.stops[0].opacity * 100.0, gi.stops[1].opacity * 100.0); - // outs.writeUString (tmpstring); + output += Glib::ustring::compose(" draw:start-intensity=\"%1\" draw:end-intensity=\"%2\" draw:angle=\"0\"/>\n", + gi.stops[0].opacity * 100.0, gi.stops[1].opacity * 100.0);// draw:border=\"0%%\" } else if (gi.style == "radial") { @@ -1582,33 +1581,14 @@ bool OdfOutput::processGradient(Writer &outs, SPItem *item, g_warning("Need at least 2 stops for a radial gradient"); return false; } - /* - outs.printf("<svg:radialGradient "); - outs.printf("id=\"%s\" ", gi.name.c_str()); - outs.printf("draw:name=\"%s\"\n", gi.name.c_str()); - outs.printf(" draw:display-name=\"imported radial %d\"\n", - gradientCount); - outs.printf(" svg:gradientUnits=\"objectBoundingBox\"\n"); - outs.printf(" svg:cx=\"%05.3f\" svg:cy=\"%05.3f\"\n", - gi.cx, gi.cy); - outs.printf(" svg:fx=\"%05.3f\" svg:fy=\"%05.3f\"\n", - gi.fx, gi.fy); - outs.printf(" svg:r=\"%05.3f\">\n", - gi.r); - outs.printf(" <svg:stop\n"); - outs.printf(" svg:stop-color=\"#%06lx\"\n", - gi.stops[0].rgb); - outs.printf(" svg:stop-opacity=\"%f%%\"\n", - gi.stops[0].opacity * 100.0); - outs.printf(" svg:offset=\"0\"/>\n"); - outs.printf(" <svg:stop\n"); - outs.printf(" svg:stop-color=\"#%06lx\"\n", - gi.stops[1].rgb); - outs.printf(" svg:stop-opacity=\"%f%%\"\n", - gi.stops[1].opacity * 100.0); - outs.printf(" svg:offset=\"1\"/>\n"); - outs.printf("</svg:radialGradient>\n"); - */ + output += Glib::ustring::compose("<draw:gradient draw:name=\"%1\" draw:display-name=\"imported radial %2\" ", gi.name, gradientCount); + snprintf(buf, 127, "draw:cx=\"%05.3f\" draw:cy=\"%05.3f\" ", gi.cx, gi.cy); + output += Glib::ustring("draw:style=\"radial\" ") + buf; + snprintf(buf, 127, "draw:start-color=\"#%06lx\" draw:end-color=\"#%06lx\" ", gi.stops[0].rgb, gi.stops[1].rgb); + output += buf; + snprintf(buf, 127, "draw:start-intensity=\"%f%%\" draw:end-intensity=\"%f%%\" ", gi.stops[0].opacity*100.0, gi.stops[1].opacity*100.0); + output += buf; + output += "/>\n";//draw:border=\"0%\" } else { @@ -1709,13 +1689,14 @@ bool OdfOutput::writeTree(Writer &couts, Writer &souts, Glib::ustring gradientNameStroke; Glib::ustring outputFill; Glib::ustring outputStroke; - // Glib::ustring styleString; - - processGradient(souts, item, id, tf, gradientNameFill, outputFill, 1); + + processGradient(item, id, tf, gradientNameFill, outputFill, 1); + processGradient(item, id, tf, gradientNameStroke, outputStroke, 0); souts.writeUString(outputFill); + souts.writeUString(outputStroke); //# STYLE - processStyle(souts, item, id, gradientNameFill);//, styleString); + processStyle(souts, item, id, gradientNameFill, gradientNameStroke); //# ITEM DATA @@ -1806,7 +1787,7 @@ bool OdfOutput::writeTree(Writer &couts, Writer &souts, Glib::ustring styleName = siter->second; couts.printf("draw:style-name=\"%s\" ", styleName.c_str()); } - // couts.writeUString(styleString); + // couts.writeUString(styleString); // std::map<Glib::ustring, Glib::ustring>::iterator giter; // giter = gradientLookupTable.find(id); @@ -1821,10 +1802,10 @@ bool OdfOutput::writeTree(Writer &couts, Writer &souts, bbox_x, bbox_y); couts.printf("svg:width=\"%.3fcm\" svg:height=\"%.3fcm\" ", bbox_width, bbox_height); - couts.printf("svg:viewBox=\"0.0 0.0 %.3f %.3f\"\n", + couts.printf("svg:viewBox=\"0.0 0.0 %.3f %.3f\"", bbox_width * 1000.0, bbox_height * 1000.0); - couts.printf(" svg:d=\""); + couts.printf(" svg:d=\""); int nrPoints = writePath(couts, curve->get_pathvector(), tf, bbox_x, bbox_y); couts.writeString("\""); @@ -1915,9 +1896,9 @@ bool OdfOutput::writeStyleFooter(Writer &outs) outs.writeString("<!-- ####### 'Standard' styles ####### -->\n"); outs.writeString("<style:style style:name=\"dp1\" style:family=\"drawing-page\"/>\n"); outs.writeString("<style:style style:name=\"standard\" style:family=\"graphic\">\n"); - + ///TODO: add default document style here - + outs.writeString("</style:style>\n"); outs.writeString("<style:style style:name=\"gr1\" style:family=\"graphic\" style:parent-style-name=\"standard\">\n"); outs.writeString(" <style:graphic-properties draw:stroke=\"none\" draw:fill=\"none\"\n"); diff --git a/src/extension/internal/odf.h b/src/extension/internal/odf.h index 5fcad2630..7dfbf9786 100644 --- a/src/extension/internal/odf.h +++ b/src/extension/internal/odf.h @@ -313,9 +313,9 @@ private: bool writeStyle(ZipFile &zf); - bool processStyle(Writer &outs, SPItem *item, const Glib::ustring &id, const Glib::ustring &gradientNameFill);//, Glib::ustring &styleString); + bool processStyle(Writer &outs, SPItem *item, const Glib::ustring &id, const Glib::ustring &gradientNameFill, const Glib::ustring &gradientNameStroke); - bool processGradient(Writer &outs, SPItem *item, + bool processGradient(SPItem *item, const Glib::ustring &id, Geom::Affine &tf, Glib::ustring& gradientName, Glib::ustring& output, bool checkFillGradient = 1); bool writeStyleHeader(Writer &outs); diff --git a/src/pen-context.cpp b/src/pen-context.cpp index c5c54925e..70d9f8ae1 100644 --- a/src/pen-context.cpp +++ b/src/pen-context.cpp @@ -964,6 +964,16 @@ static gint pen_handle_2button_press(SPPenContext *const pc, GdkEventButton cons static void pen_redraw_all (SPPenContext *const pc) { + //halo + SPCurve *halo = new SPCurve(); + if(!pc->bspline && !pc->spiro){ + if(!pc->green_curve->is_empty()) + halo->append_continuous(pc->green_curve, 0.0625); + if(!pc->red_curve->is_empty()) + halo->append_continuous(pc->red_curve, 0.0625); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->halo_bpath), halo); + sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(pc->halo_bpath), pc->halo_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); + } // green if (pc->green_bpaths) { // remove old piecewise green canvasitems @@ -1400,6 +1410,8 @@ static void spdc_reset_colors(SPPenContext *pc) // Blue pc->blue_curve->reset(); sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->blue_bpath), NULL); + + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->halo_bpath), NULL); // Green while (pc->green_bpaths) { sp_canvas_item_destroy(SP_CANVAS_ITEM(pc->green_bpaths->data)); @@ -1424,6 +1436,7 @@ static void spdc_pen_set_initial_point(SPPenContext *const pc, Geom::Point const pc->p[1] = p; pc->npoints = 2; sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), NULL); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->halo_bpath), NULL); pc->desktop->canvas->forceFullRedrawAfterInterruptions(5); } @@ -1457,13 +1470,13 @@ static void spdc_pen_set_angle_distance_status_message(SPPenContext *const pc, G static void bspline_spiro_color(SPPenContext *const pc) { if(pc->spiro){ - pc->red_color = 0xc80000c8; - pc->green_color = 0xc80000c8; - pc->blue_color = 0x323296c8; + pc->red_color = 0xc8000000; + pc->green_color = 0xc8000000; + pc->blue_color = 0x963232c8; }else if (pc->bspline){ - pc->red_color = 0x963232c8; - pc->green_color = 0x963232c8; - pc->blue_color = 0x323296c8; + pc->red_color = 0x323296c8; + pc->green_color = 0x323296c8; + pc->blue_color = 0x963232c8; }else{ pc->red_color = 0xff0000c8; pc->green_color = 0x00ff00c8; @@ -1779,8 +1792,16 @@ static void bspline_spiro_end_anchor_off(SPPenContext *const pc) //preparates the curves for its trasformation into BSline curves. static void bspline_spiro_build(SPPenContext *const pc) { - if(!pc->spiro && !pc->bspline) + if(!pc->spiro && !pc->bspline){ + SPCurve *halo = new SPCurve(); + if(!pc->green_curve->is_empty()) + halo->append_continuous(pc->green_curve, 0.0625); + if(!pc->red_curve->is_empty()) + halo->append_continuous(pc->red_curve, 0.0625); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->halo_bpath), halo); + sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(pc->halo_bpath), pc->halo_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); return; + } //We create the base curve SPCurve *curve = new SPCurve(); @@ -1815,13 +1836,24 @@ static void bspline_spiro_build(SPPenContext *const pc) //LivePathEffectObject *lpeobj = static_cast<LivePathEffectObject*> (curve); //Effect *spr = static_cast<Effect*> ( new LPEbspline(lpeobj) ); //spr->doEffect(curve); - if(pc->bspline) + SPCurve *halo = new SPCurve(); + if(pc->bspline){ bspline_doEffect(curve); - else + if(!pc->green_curve->is_empty()) + halo->append_continuous(pc->green_curve, 0.0625); + if(!pc->red_curve->is_empty()) + halo->append_continuous(pc->red_curve, 0.0625); + halo->append(curve->copy(),false); + }else{ spiro_doEffect(curve); + halo = curve->copy(); + } + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->halo_bpath), halo); + sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(pc->halo_bpath), pc->halo_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->blue_bpath), curve); sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(pc->blue_bpath), pc->blue_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); - sp_canvas_item_show(pc->blue_bpath); + sp_canvas_item_show(pc->halo_bpath); + sp_canvas_item_show(pc->blue_bpath); curve->unref(); pc->blue_curve->reset(); //We hide the holders that doesn't contribute anything @@ -1836,6 +1868,7 @@ static void bspline_spiro_build(SPPenContext *const pc) }else{ //if the curve is empty sp_canvas_item_hide(pc->blue_bpath); + sp_canvas_item_hide(pc->halo_bpath); } } @@ -2163,7 +2196,17 @@ static void spdc_pen_set_subsequent_point(SPPenContext *const pc, Geom::Point co is_curve = false; } } + SPCurve *halo = new SPCurve(); + if(!pc->bspline && !pc->spiro){ + if(!pc->green_curve->is_empty()) + halo->append_continuous(pc->green_curve, 0.0625); + if(!pc->red_curve->is_empty()) + halo->append_continuous(pc->red_curve, 0.0625); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->halo_bpath), halo); + sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(pc->halo_bpath), pc->halo_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); + } sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), pc->red_curve); + if (statusbar) { gchar *message = is_curve ? _("<b>Curve segment</b>: angle %3.2f°, distance %s; with <b>Ctrl</b> to snap angle, <b>Enter</b> to finish the path" ): @@ -2204,6 +2247,15 @@ static void spdc_pen_set_ctrl(SPPenContext *const pc, Geom::Point const p, guint pc->red_curve->reset(); pc->red_curve->moveto(pc->p[0]); pc->red_curve->curveto(pc->p[1], pc->p[2], pc->p[3]); + SPCurve *halo = new SPCurve(); + if(!pc->bspline && !pc->spiro){ + if(!pc->green_curve->is_empty()) + halo->append_continuous(pc->green_curve, 0.0625); + if(!pc->red_curve->is_empty()) + halo->append_continuous(pc->red_curve, 0.0625); + sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->halo_bpath), halo); + sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(pc->halo_bpath), pc->halo_color, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT); + } sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH(pc->red_bpath), pc->red_curve); } SP_CTRL(pc->c0)->moveto(pc->p[2]); diff --git a/src/proofs b/src/proofs index a3a22733f..05f27daea 100644 --- a/src/proofs +++ b/src/proofs @@ -329,4 +329,4 @@ style.cpp caller: preceded by explicit test for NULL: # mode:indented-text # fill-column:99 # End: -# vim: filetype=text:tabstop=8:encoding=utf-8:textwidth=99 : +# vim: filetype=text:tabstop=8:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-paint-server-reference.h b/src/sp-paint-server-reference.h index 90d8979f8..5561af1a3 100644 --- a/src/sp-paint-server-reference.h +++ b/src/sp-paint-server-reference.h @@ -40,4 +40,4 @@ protected: fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/sp-pattern.cpp b/src/sp-pattern.cpp index 754a75e87..23cd3d32e 100644 --- a/src/sp-pattern.cpp +++ b/src/sp-pattern.cpp @@ -731,4 +731,4 @@ sp_pattern_create_pattern(SPPaintServer *ps, fill-column:99 End: */ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : |
