summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 965f982)
raw | patch | inline | side by side (parent: 965f982)
author | buliabyak <buliabyak@users.sourceforge.net> | |
Wed, 17 May 2006 06:57:31 +0000 (06:57 +0000) | ||
committer | buliabyak <buliabyak@users.sourceforge.net> | |
Wed, 17 May 2006 06:57:31 +0000 (06:57 +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 afb3a104528f62dff82213ee53114ba488f13771..cf8f67442d59941d824090486ee57d7e41af7b75 100644 (file)
--- a/src/desktop-style.cpp
+++ b/src/desktop-style.cpp
}
double
-sp_desktop_get_opacity_tool(SPDesktop *desktop, char const *tool, bool op)
+sp_desktop_get_opacity_tool(SPDesktop *desktop, char const *tool)
{
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, op);
+ 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");
value = 1.0; // things failed. set back to the default
}
}
+
+ if (css) {
+ sp_repr_css_attr_unref(css);
+ }
+
return value;
}
guint32
{
SPCSSAttr *css = NULL;
guint32 r = 0; // if there's no color, return black
- bool op = true;
- double opacity = sp_desktop_get_opacity_tool(SP_ACTIVE_DESKTOP, "tools.calligraphic", op);
if (prefs_get_int_attribute(tool, "usecurrent", 0) != 0) {
- css = sp_desktop_get_style(desktop, is_fill);
+ 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");
r = sp_svg_read_color(property, r);
}
}
- return r | SP_COLOR_F_TO_U( opacity ); // return RGBA color
+
+ if (css) {
+ sp_repr_css_attr_unref(css);
+ }
+
+ return r | 0xff;
}
/**
* Apply the desktop's current style or the tool style to repr.
sp_repr_css_attr_unref(css);
}
}
- if (css_current) {sp_repr_css_attr_unref(css_current);
+ if (css_current) {
+ sp_repr_css_attr_unref(css_current);
}
}
diff --git a/src/desktop-style.h b/src/desktop-style.h
index cec36aca523c73c2cdd1e4001344ed68ed3953d6..5171ae627f49842e2770bb67c5bbe1ca5fd12868 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, bool op);
+double sp_desktop_get_opacity_tool(SPDesktop *desktop, char const *tool);
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 ebabeef317eb06b74271a86c246a88b55480fdd7..ff570fb62b7b6d355eb4803294fe9fb2dbdc760f 100644 (file)
#include "context-fns.h"
#include "sp-item.h"
#include "inkscape.h"
+#include "color.h"
#define DDC_RED_RGBA 0xff0000ff
SPCurve *curve = sp_curve_copy(dc->currentcurve);
sp_canvas_bpath_set_bpath(SP_CANVAS_BPATH (cbp), curve);
sp_curve_unref(curve);
- guint32 fillColor = sp_desktop_get_color_tool(SP_ACTIVE_DESKTOP, "tools.calligraphic", true);
- sp_canvas_bpath_set_fill(SP_CANVAS_BPATH(cbp), fillColor , SP_WIND_RULE_EVENODD);
+ 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);
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);