summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 838f465)
raw | patch | inline | side by side (parent: 838f465)
author | verbalshadow <verbalshadow@users.sourceforge.net> | |
Wed, 17 May 2006 04:04:50 +0000 (04:04 +0000) | ||
committer | verbalshadow <verbalshadow@users.sourceforge.net> | |
Wed, 17 May 2006 04:04:50 +0000 (04:04 +0000) |
ChangeLog | patch | blob | history | |
src/desktop-style.cpp | patch | blob | history | |
src/desktop-style.h | patch | blob | history |
diff --git a/ChangeLog b/ChangeLog
index cd914d5a9bbaa8d6c24819d2386f7ecf87f6c90f..1d1362c01cbeebabdb4433138523cfbb73d188fe 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
+2006-05-16 verbalshadow <verbalshadow@gmail.com>
+
+ * src/desktop-style.h, src/desktop-style.cpp:
+ Fixes calligraphy tool so drawing now uses the the correct opacity.
+
2006-05-17 Jon A. Cruz <jon@joncruz.org>
* src/dialogs/layers-panel.cpp, src/dialogs/layers-panel.h:
Switched icons to stock generic.
diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp
index 58209aaa3c70d4eb41b440535fd5ae8ec2f7ed9b..afb3a104528f62dff82213ee53114ba488f13771 100644 (file)
--- a/src/desktop-style.cpp
+++ b/src/desktop-style.cpp
*
* Authors:
* bulia byak
+ * verbalshadow
*
- * Copyright (C) 2004 authors
+ * Copyright (C) 2004, 2006 authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include "desktop.h"
#include "color-rgba.h"
#include "svg/css-ostringstream.h"
+#include "svg/svg.h"
#include "svg/svg-color.h"
#include "selection.h"
#include "sp-tspan.h"
#include "xml/repr.h"
#include "libnrtype/font-style-to-pos.h"
+
#include "desktop-style.h"
/**
return r;
}
+double
+sp_desktop_get_opacity_tool(SPDesktop *desktop, char const *tool, bool op)
+{
+ 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);
+ } 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, "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
+ }
+ }
+ return value;
+}
guint32
sp_desktop_get_color_tool(SPDesktop *desktop, char const *tool, bool is_fill)
{
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);
} else {
r = sp_svg_read_color(property, r);
}
}
- return r | 0xff;
+ return r | SP_COLOR_F_TO_U( opacity ); // return RGBA color
}
/**
* Apply the desktop's current style or the tool style to repr.
diff --git a/src/desktop-style.h b/src/desktop-style.h
index 9f080648a2e5d5d9f92335a528184dcc64c83e5a..cec36aca523c73c2cdd1e4001344ed68ed3953d6 100644 (file)
--- a/src/desktop-style.h
+++ b/src/desktop-style.h
*
* Authors:
* bulia byak
+ * verbalshadow
*
- * Copyright (C) 2004 authors
+ * Copyright (C) 2004, 2006 authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
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);
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);