Code

implement rendering of clips/masks in outline mode; make all outline colors stored...
authorbuliabyak <buliabyak@users.sourceforge.net>
Wed, 25 Oct 2006 05:35:59 +0000 (05:35 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Wed, 25 Oct 2006 05:35:59 +0000 (05:35 +0000)
src/desktop.cpp
src/display/nr-arena-item.cpp
src/preferences-skeleton.h

index d7a081fafd14288e3c465f70176af263a79640b5..c0548a8d2065accd8b7c829e3e04a7b669e31d53 100644 (file)
@@ -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);
         }
     }
 }
index 12312c251652488c2e1fe206cd8b3c6d75361eb1..0657144eddbacdc17ceb4274e9d8c6d56c580eaa 100644 (file)
@@ -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);
index 27df30db08396183fbdeff23adc6c21d117bc54c..e833157ed3f438c2fd1f9f0202dfd946776bc191 100644 (file)
@@ -194,6 +194,11 @@ static char const preferences_skeleton[] =
 "    <group id=\"compassangledisplay\" value=\"0\"/>\n"
 "    <group id=\"maskobject\" topmost=\"1\" remove=\"1\"/>\n"
 "    <group id=\"blurquality\" value=\"0\"/>\n"
+"    <group id=\"wireframecolors\" "
+"           onlight=\"255\"" // 000000ff
+"           ondark=\"4294967295\"" //ffffffff
+"           clips=\"16711935\"" // 00ff00ff
+"           masks=\"65535\"/>\n" // 0x0000ffff
 "  </group>\n"
 "\n"
 "  <group id=\"extensions\">"