From a1dd38d30990bd7b1ceb96b95454d86f5ba27d60 Mon Sep 17 00:00:00 2001 From: buliabyak Date: Wed, 25 Oct 2006 05:35:59 +0000 Subject: [PATCH] implement rendering of clips/masks in outline mode; make all outline colors stored in the prefs --- src/desktop.cpp | 4 ++-- src/display/nr-arena-item.cpp | 29 ++++++++++++++++++++++++++++- src/preferences-skeleton.h | 5 +++++ 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/src/desktop.cpp b/src/desktop.cpp index d7a081faf..c0548a8d2 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -1344,9 +1344,9 @@ _namedview_modified (SPObject *obj, guint flags, SPDesktop *desktop) SP_RGBA32_G_U(nv->pagecolor) + SP_RGBA32_B_U(nv->pagecolor)) >= 384) { // the background color is light or transparent, use black outline - SP_CANVAS_ARENA (desktop->drawing)->arena->outlinecolor = 0xff; + SP_CANVAS_ARENA (desktop->drawing)->arena->outlinecolor = prefs_get_int_attribute("options.wireframecolors", "onlight", 0xff); } else { // use white outline - SP_CANVAS_ARENA (desktop->drawing)->arena->outlinecolor = 0xffffffff; + SP_CANVAS_ARENA (desktop->drawing)->arena->outlinecolor = prefs_get_int_attribute("options.wireframecolors", "ondark", 0xffffffff); } } } diff --git a/src/display/nr-arena-item.cpp b/src/display/nr-arena-item.cpp index 12312c251..0657144ed 100644 --- a/src/display/nr-arena-item.cpp +++ b/src/display/nr-arena-item.cpp @@ -402,7 +402,7 @@ nr_arena_item_invoke_render (NRArenaItem *item, NRRectL const *area, item->filter->render (item, &ipb); } - if (item->clip || item->mask) { + if ((item->clip || item->mask) && !outline) { /* Setup mask pixblock */ NRPixBlock mpb; nr_pixblock_setup_fast (&mpb, NR_PIXBLOCK_MODE_A8, carea.x0, @@ -508,6 +508,33 @@ nr_arena_item_invoke_render (NRArenaItem *item, NRRectL const *area, nr_pixblock_release (&mpb); /* This pointer wouldn't be valid outside this block, so clear it */ item->background_pb = NULL; + + } else if ((item->clip || item->mask) && outline) { + // Render clipped or masked object in outline mode: + + // First, render the object itself + unsigned int state = NR_ARENA_ITEM_VIRTUAL (item, render) (item, &carea, dpb, flags); + if (state & NR_ARENA_ITEM_STATE_INVALID) { + /* Clean up and return error */ + if (dpb != pb) + nr_pixblock_release (dpb); + item->state |= NR_ARENA_ITEM_STATE_INVALID; + return item->state; + } + + guint32 saved_rgba = item->arena->outlinecolor; // save current outline color + // render clippath as an object, using a different color + if (item->clip) { + item->arena->outlinecolor = prefs_get_int_attribute("options.wireframecolors", "clips", 0x00ff00ff); // green clips + NR_ARENA_ITEM_VIRTUAL (item->clip, render) (item->clip, &carea, dpb, flags); + } + // render mask as an object, using a different color + if (item->mask) { + item->arena->outlinecolor = prefs_get_int_attribute("options.wireframecolors", "masks", 0x0000ffff); // blue masks + NR_ARENA_ITEM_VIRTUAL (item->mask, render) (item->mask, &carea, dpb, flags); + } + item->arena->outlinecolor = saved_rgba; // restore outline color + } else { if (item->render_opacity) { // opacity was already rendered in, just copy to dpb here nr_blit_pixblock_pixblock(dpb, &ipb); diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h index 27df30db0..e833157ed 100644 --- a/src/preferences-skeleton.h +++ b/src/preferences-skeleton.h @@ -194,6 +194,11 @@ static char const preferences_skeleton[] = " \n" " \n" " \n" +" \n" // 0x0000ffff " \n" "\n" " " -- 2.30.2