summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 65109d2)
raw | patch | inline | side by side (parent: 65109d2)
author | acspike <acspike@users.sourceforge.net> | |
Thu, 18 May 2006 15:36:46 +0000 (15:36 +0000) | ||
committer | acspike <acspike@users.sourceforge.net> | |
Thu, 18 May 2006 15:36:46 +0000 (15:36 +0000) |
src/desktop-style.cpp | patch | blob | history | |
src/desktop-style.h | patch | blob | history | |
src/dyna-draw-context.cpp | patch | blob | history |
diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp
index cf8f67442d59941d824090486ee57d7e41af7b75..062607fbff2e561e97173c6ac0701d895ffb89e3 100644 (file)
--- a/src/desktop-style.cpp
+++ b/src/desktop-style.cpp
}
double
-sp_desktop_get_opacity_tool(SPDesktop *desktop, char const *tool)
+sp_desktop_get_master_opacity_tool(SPDesktop *desktop, char const *tool)
{
SPCSSAttr *css = NULL;
gfloat value = 1.0; // default if nothing else found
return value;
}
+double
+sp_desktop_get_opacity_tool(SPDesktop *desktop, char const *tool, bool is_fill)
+{
+ SPCSSAttr *css = NULL;
+ gfloat value = 1.0; // default if nothing else found
+ if (prefs_get_double_attribute(tool, "usecurrent", 0) != 0) {
+ css = sp_desktop_get_style(desktop, true);
+ } else {
+ Inkscape::XML::Node *tool_repr = inkscape_get_repr(INKSCAPE, tool);
+ css = sp_repr_css_attr_inherited(tool_repr, "style");
+ }
+
+ gchar const *property = css ? sp_repr_css_property(css, is_fill ? "fill-opacity": "stroke-opacity", "1.000") : 0;
+
+ if (desktop->current && property) { // if there is style and the property in it,
+ if ( !sp_svg_number_read_f(property, &value) ) {
+ value = 1.0; // things failed. set back to the default
+ }
+ }
+
+ if (css) {
+ sp_repr_css_attr_unref(css);
+ }
+
+ return value;
+}
guint32
sp_desktop_get_color_tool(SPDesktop *desktop, char const *tool, bool is_fill)
{
diff --git a/src/desktop-style.h b/src/desktop-style.h
index 5171ae627f49842e2770bb67c5bbe1ca5fd12868..8f8388289e8711a821ae7b5f566108b25bcb4a73 100644 (file)
--- a/src/desktop-style.h
+++ b/src/desktop-style.h
void sp_desktop_set_style(SPDesktop *desktop, SPCSSAttr *css, bool change = true, bool write_current = true);
SPCSSAttr *sp_desktop_get_style(SPDesktop *desktop, bool with_text);
guint32 sp_desktop_get_color (SPDesktop *desktop, bool is_fill);
-double sp_desktop_get_opacity_tool(SPDesktop *desktop, char const *tool);
+double sp_desktop_get_master_opacity_tool(SPDesktop *desktop, char const *tool);
+double sp_desktop_get_opacity_tool(SPDesktop *desktop, char const *tool, bool is_fill);
guint32 sp_desktop_get_color_tool(SPDesktop *desktop, char const *tool, bool is_fill);
double sp_desktop_get_font_size_tool (SPDesktop *desktop);
void sp_desktop_apply_style_tool(SPDesktop *desktop, Inkscape::XML::Node *repr, char const *tool, bool with_text);
index ff570fb62b7b6d355eb4803294fe9fb2dbdc760f..f1128c4921231c97edb09f19d83bdd9b55e484c9 100644 (file)
sp_curve_unref(curve);
guint32 fillColor = sp_desktop_get_color_tool (SP_ACTIVE_DESKTOP, "tools.calligraphic", true);
- double opacity = sp_desktop_get_opacity_tool (SP_ACTIVE_DESKTOP, "tools.calligraphic");
- sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(cbp), ((fillColor & 0xffffff00) | SP_COLOR_F_TO_U(opacity)), SP_WIND_RULE_EVENODD);
+ //guint32 strokeColor = sp_desktop_get_color_tool (SP_ACTIVE_DESKTOP, "tools.calligraphic", false);
+ double opacity = sp_desktop_get_master_opacity_tool (SP_ACTIVE_DESKTOP, "tools.calligraphic");
+ double fillOpacity = sp_desktop_get_opacity_tool (SP_ACTIVE_DESKTOP, "tools.calligraphic", true);
+ //double strokeOpacity = sp_desktop_get_opacity_tool (SP_ACTIVE_DESKTOP, "tools.calligraphic", false);
+ sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(cbp), ((fillColor & 0xffffff00) | SP_COLOR_F_TO_U(opacity*fillOpacity)), SP_WIND_RULE_EVENODD);
+ //on second thougtht don't do stroke yet because we don't have stoke-width yet and because stoke appears between segments while drawing
+ //sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(cbp), ((strokeColor & 0xffffff00) | SP_COLOR_F_TO_U(opacity*strokeOpacity)), 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
sp_canvas_bpath_set_stroke(SP_CANVAS_BPATH(cbp), 0x00000000, 1.0, SP_STROKE_LINEJOIN_MITER, SP_STROKE_LINECAP_BUTT);
/* fixme: Cannot we cascade it to root more clearly? */
g_signal_connect(G_OBJECT(cbp), "event", G_CALLBACK(sp_desktop_root_handler), SP_EVENT_CONTEXT(dc)->desktop);