summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2013-04-14 20:54:08 +0000
committerJabiertxo Arraiza Zenotz <jtx@jtx.marker.es>2013-04-14 20:54:08 +0000
commit08acf66f4df391ff3289b59b80bc770397860343 (patch)
tree1961c00c1f5f59982dbe5e7a37f2ea00ef839a0f /src
parentadding halos (diff)
downloadinkscape-08acf66f4df391ff3289b59b80bc770397860343.tar.gz
inkscape-08acf66f4df391ff3289b59b80bc770397860343.zip
halo
(bzr r11950.1.92)
Diffstat (limited to 'src')
-rw-r--r--src/display/canvas-bpath.cpp42
-rw-r--r--src/draw-context.cpp3
-rw-r--r--src/draw-context.h1
-rw-r--r--src/pen-context.cpp70
4 files changed, 52 insertions, 64 deletions
diff --git a/src/display/canvas-bpath.cpp b/src/display/canvas-bpath.cpp
index 6ac69a325..defd95b45 100644
--- a/src/display/canvas-bpath.cpp
+++ b/src/display/canvas-bpath.cpp
@@ -16,8 +16,9 @@
#endif
#include <sstream>
#include <string.h>
-#include "desktop.h"
+#include "document.h"
+#include <2geom/pathvector.h>
#include "color.h"
#include "display/sp-canvas-group.h"
#include "display/sp-canvas-util.h"
@@ -146,10 +147,6 @@ 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);
-
-
if (dofill) {
// RGB / BGR
ink_cairo_set_source_rgba32(buf->ct, cbp->fill_rgba);
@@ -159,16 +156,37 @@ sp_canvas_bpath_render (SPCanvasItem *item, SPCanvasBuf *buf)
}
if (dostroke) {
- ink_cairo_set_source_rgba32(buf->ct, cbp->stroke_rgba);
- if(cbp->stroke_rgba == 0xffffff10){
- cairo_set_line_width(buf->ct, 3);
+ SPCurve* orig = new SPCurve(cbp->curve->get_pathvector());
+ Geom::Point origPoint(orig->first_path()->initialPoint());
+ if(cbp->stroke_rgba == 0x12345678){
+ cairo_save(buf->ct);
+ orig->moveto(origPoint[Geom::X]+1,origPoint[Geom::Y]+1);
+ feed_pathvector_to_cairo (buf->ct, cbp->curve->get_pathvector(), cbp->affine, area,
+ /* optimized_stroke = */ !dofill, 1);
+ ink_cairo_set_source_rgba32(buf->ct, 0x00000020);
+ cairo_set_line_width(buf->ct, 1);
+ cairo_move_to(buf->ct, origPoint[Geom::X] + 1, origPoint[Geom::Y] + 1);
+ cairo_stroke_preserve(buf->ct);
+ cairo_restore(buf->ct);
+ cairo_save(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, 1);
+ cairo_move_to(buf->ct, origPoint[Geom::X] - 1, origPoint[Geom::Y] - 1);
+ cairo_stroke_preserve(buf->ct);
+ cairo_restore(buf->ct);
}else{
+ feed_pathvector_to_cairo (buf->ct, cbp->curve->get_pathvector(), cbp->affine, area,
+ /* optimized_stroke = */ !dofill, 1);
+ ink_cairo_set_source_rgba32(buf->ct, cbp->stroke_rgba);
cairo_set_line_width(buf->ct, 1);
+ cairo_move_to(buf->ct, origPoint[Geom::X], origPoint[Geom::Y]);
+ if (cbp->dashes[0] != 0 && cbp->dashes[1] != 0) {
+ cairo_set_dash (buf->ct, cbp->dashes, 2, 0);
+ }
+ cairo_stroke(buf->ct);
}
- if (cbp->dashes[0] != 0 && cbp->dashes[1] != 0) {
- cairo_set_dash (buf->ct, cbp->dashes, 2, 0);
- }
- cairo_stroke(buf->ct);
} else {
cairo_new_path(buf->ct);
}
diff --git a/src/draw-context.cpp b/src/draw-context.cpp
index 33e9b4a5d..459137cc0 100644
--- a/src/draw-context.cpp
+++ b/src/draw-context.cpp
@@ -99,7 +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->halo_color = 0x12345678;
dc->red_curve_is_valid = false;
dc->red_bpath = NULL;
@@ -867,3 +867,4 @@ void spdc_create_single_dot(SPEventContext *ec, Geom::Point const &pt, char cons
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
+
diff --git a/src/draw-context.h b/src/draw-context.h
index 5a2db5ae0..1b4d04773 100644
--- a/src/draw-context.h
+++ b/src/draw-context.h
@@ -137,3 +137,4 @@ G_END_DECLS
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
+
diff --git a/src/pen-context.cpp b/src/pen-context.cpp
index 70d9f8ae1..4a1384657 100644
--- a/src/pen-context.cpp
+++ b/src/pen-context.cpp
@@ -48,7 +48,7 @@
#define INKSCAPE_LPE_SPIRO_C
#include "live_effects/lpe-spiro.h"
-#include "display/curve.h"
+
#include <typeinfo>
#include <2geom/pathvector.h>
#include <2geom/affine.h>
@@ -964,16 +964,6 @@ 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
@@ -1470,17 +1460,17 @@ 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 = 0xc8000000;
- pc->green_color = 0xc8000000;
- pc->blue_color = 0x963232c8;
+ pc->red_color = 0xdf202000;
+ pc->green_color = 0x21df2100;
+ pc->blue_color = 0x2020dfe6;
}else if (pc->bspline){
- pc->red_color = 0x323296c8;
- pc->green_color = 0x323296c8;
- pc->blue_color = 0x963232c8;
+ pc->red_color = 0xdf2020e6;
+ pc->green_color = 0xdf2020e6;
+ pc->blue_color = 0x2020dfe6;
}else{
- pc->red_color = 0xff0000c8;
- pc->green_color = 0x00ff00c8;
- pc->blue_color = 0x0000ffc8;
+ pc->red_color = 0xdf2020e6;
+ pc->green_color = 0x21df21e6;
+ pc->blue_color = 0x0000ffe6;
}
//we hide the spiro/bspline rests
if(!pc->bspline){
@@ -1792,16 +1782,8 @@ 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){
- 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);
+ if(!pc->spiro && !pc->bspline)
return;
- }
//We create the base curve
SPCurve *curve = new SPCurve();
@@ -1839,21 +1821,23 @@ static void bspline_spiro_build(SPPenContext *const pc)
SPCurve *halo = new SPCurve();
if(pc->bspline){
bspline_doEffect(curve);
+ halo = curve->copy()->create_reverse();
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);
+ if(Geom::are_near(halo->first_path()->initialPoint(), halo->last_path()->finalPoint())){
+ halo->closepath_current();
+ }
}else{
spiro_doEffect(curve);
halo = curve->copy();
}
+ sp_canvas_item_show(pc->blue_bpath);
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->halo_bpath);
- sp_canvas_item_show(pc->blue_bpath);
curve->unref();
pc->blue_curve->reset();
//We hide the holders that doesn't contribute anything
@@ -1868,7 +1852,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);
+
}
}
@@ -2196,15 +2180,7 @@ 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) {
@@ -2247,15 +2223,6 @@ 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]);
@@ -2430,3 +2397,4 @@ void pen_set_to_nearest_horiz_vert(const SPPenContext *const pc, Geom::Point &pt
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
+