summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 871d807)
raw | patch | inline | side by side (parent: 871d807)
author | Jon A. Cruz <jon@joncruz.org> | |
Sun, 18 Jul 2010 00:24:31 +0000 (17:24 -0700) | ||
committer | Jon A. Cruz <jon@joncruz.org> | |
Sun, 18 Jul 2010 00:24:31 +0000 (17:24 -0700) |
index a4d34894033c5ccbe65673ec06b747fed41ce969..c635f7b2d03a2a9af7fa8d9382b7afe6db86bb21 100644 (file)
/**
* Fill
*/
- SPIPaint fill = style->fill;
+ SPIPaint const &fill = style->fill;
if (fill.isColor())
{
// see color.h for how to parse SPColor
*/
if (style->stroke_opacity.value > 0)
{
- SPIPaint stroke = style->stroke;
+ SPIPaint const &stroke = style->stroke;
out(" stroke: %s\n",
rgba(stroke.value.color, SP_SCALE24_TO_FLOAT(style->stroke_opacity.value)).c_str());
double strokewidth = style->stroke_width.value;
diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp
index 1492e900851def296c83a7e302040a6e55dfdb49..e7536a86ae35684816d05e6f5d86e3d31b074c29 100644 (file)
--- a/src/gradient-drag.cpp
+++ b/src/gradient-drag.cpp
}
}
+Glib::ustring GrDrag::makeStopSafeColor( gchar const *str, bool &isNull )
+{
+ Glib::ustring colorStr;
+ if ( str ) {
+ isNull = false;
+ colorStr = str;
+ Glib::ustring::size_type pos = colorStr.find("url(#");
+ if ( pos != Glib::ustring::npos ) {
+ Glib::ustring targetName = colorStr.substr(pos + 5, colorStr.length() - 6);
+ const GSList *gradients = sp_document_get_resource_list(desktop->doc(), "gradient");
+ for (const GSList *item = gradients; item; item = item->next) {
+ SPGradient* grad = SP_GRADIENT(item->data);
+ if ( targetName == grad->getId() ) {
+ SPGradient *vect = grad->getVector();
+ SPStop *firstStop = (vect) ? vect->getFirstStop() : grad->getFirstStop();
+ if (firstStop) {
+ Glib::ustring stopColorStr;
+ if (firstStop->currentColor) {
+ stopColorStr = sp_object_get_style_property(firstStop, "color", NULL);
+ } else {
+ stopColorStr = firstStop->specified_color.toString();
+ }
+ if ( !stopColorStr.empty() ) {
+ colorStr = stopColorStr;
+ }
+ }
+ break;
+ }
+ }
+ }
+ } else {
+ isNull = true;
+ }
+
+ return colorStr;
+}
+
bool GrDrag::styleSet( const SPCSSAttr *css )
{
if (!selected) {
// Make sure the style is allowed for gradient stops.
if ( !sp_repr_css_property_is_unset( stop, "stop-color") ) {
- Glib::ustring tmp = sp_repr_css_property( stop, "stop-color", "" );
- Glib::ustring::size_type pos = tmp.find("url(#");
- if ( pos != Glib::ustring::npos ) {
- Glib::ustring targetName = tmp.substr(pos + 5, tmp.length() - 6);
- const GSList *gradients = sp_document_get_resource_list(desktop->doc(), "gradient");
- for (const GSList *item = gradients; item; item = item->next) {
- SPGradient* grad = SP_GRADIENT(item->data);
- if ( targetName == grad->getId() ) {
- SPGradient *vect = grad->getVector();
- SPStop *firstStop = (vect) ? vect->getFirstStop() : grad->getFirstStop();
- if (firstStop) {
- Glib::ustring stopColorStr;
- if (firstStop->currentColor) {
- stopColorStr = sp_object_get_style_property(firstStop, "color", NULL);
- } else {
- stopColorStr = firstStop->specified_color.toString();
- }
- if ( !stopColorStr.empty() ) {
- sp_repr_css_set_property( stop, "stop-color", stopColorStr.c_str() );
- }
- }
- break;
- }
- }
+ bool stopIsNull = false;
+ Glib::ustring tmp = makeStopSafeColor( sp_repr_css_property( stop, "stop-color", "" ), stopIsNull );
+ if ( !stopIsNull && !tmp.empty() ) {
+ sp_repr_css_set_property( stop, "stop-color", tmp.c_str() );
}
}
@@ -393,14 +410,18 @@ GrDrag::addStopNearPoint (SPItem *item, Geom::Point mouse_p, double tolerance)
bool
GrDrag::dropColor(SPItem */*item*/, gchar const *c, Geom::Point p)
{
+ // Note: not sure if a null pointer can come in for the style, but handle that just in case
+ bool stopIsNull = false;
+ Glib::ustring toUse = makeStopSafeColor( c, stopIsNull );
+
// first, see if we can drop onto one of the existing draggers
for (GList *i = draggers; i != NULL; i = i->next) { // for all draggables of dragger
GrDragger *d = (GrDragger *) i->data;
if (Geom::L2(p - d->point)*desktop->current_zoom() < 5) {
SPCSSAttr *stop = sp_repr_css_attr_new ();
- sp_repr_css_set_property (stop, "stop-color", c);
- sp_repr_css_set_property (stop, "stop-opacity", "1");
+ sp_repr_css_set_property( stop, "stop-color", stopIsNull ? 0 : toUse.c_str() );
+ sp_repr_css_set_property( stop, "stop-opacity", "1" );
for (GSList *j = d->draggables; j != NULL; j = j->next) { // for all draggables of dragger
GrDraggable *draggable = (GrDraggable *) j->data;
local_change = true;
SPStop *stop = addStopNearPoint (line->item, p, 5/desktop->current_zoom());
if (stop) {
SPCSSAttr *css = sp_repr_css_attr_new ();
- sp_repr_css_set_property (css, "stop-color", c);
- sp_repr_css_set_property (css, "stop-opacity", "1");
+ sp_repr_css_set_property( css, "stop-color", stopIsNull ? 0 : toUse.c_str() );
+ sp_repr_css_set_property( css, "stop-opacity", "1" );
sp_repr_css_change (SP_OBJECT_REPR (stop), css, "style");
return true;
}
diff --git a/src/gradient-drag.h b/src/gradient-drag.h
index 22c0dbfb69cb58db91e5d7feba3872905ee32ca6..8cbe9f3052f51e7e58f96211149f1f81e1631e70 100644 (file)
--- a/src/gradient-drag.h
+++ b/src/gradient-drag.h
bool styleSet( const SPCSSAttr *css );
+ Glib::ustring makeStopSafeColor( gchar const *str, bool &isNull );
+
Inkscape::Selection *selection;
sigc::connection sel_changed_connection;
sigc::connection sel_modified_connection;
diff --git a/src/sp-gradient.cpp b/src/sp-gradient.cpp
index 34912d1dafc11b0dccb1f9f78d0c7b93161327d7..68efd08322e2990a5bbdbde7638ca9bdce17d7bd 100644 (file)
--- a/src/sp-gradient.cpp
+++ b/src/sp-gradient.cpp
#include "streq.h"
#include "uri.h"
#include "xml/repr.h"
+#include "style.h"
#define SP_MACROS_SILENT
#include "macros.h"
if (streq(p, "currentColor")) {
stop->currentColor = true;
} else {
- // TODO need to properly read full color, including icc
- guint32 const color = sp_svg_read_color(p, 0);
- stop->specified_color.set( color );
+ stop->specified_color = SPStop::readStopColor( p );
}
}
{
stop->currentColor = true;
} else {
stop->currentColor = false;
- guint32 const color = sp_svg_read_color(p, 0);
- stop->specified_color.set( color );
+ stop->specified_color = SPStop::readStopColor( p );
}
}
object->requestModified(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG);
@@ -233,11 +231,12 @@ sp_stop_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML:
repr = xml_doc->createElement("svg:stop");
}
- guint32 specifiedcolor = stop->specified_color.toRGBA32( 255 );
+ Glib::ustring colorStr = stop->specified_color.toString();
gfloat opacity = stop->opacity;
- if (((SPObjectClass *) stop_parent_class)->write)
+ if (((SPObjectClass *) stop_parent_class)->write) {
(* ((SPObjectClass *) stop_parent_class)->write)(object, xml_doc, repr, flags);
+ }
// Since we do a hackish style setting here (because SPStyle does not support stop-color and
// stop-opacity), we must do it AFTER calling the parent write method; otherwise
@@ -248,9 +247,7 @@ sp_stop_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML:
if (stop->currentColor) {
os << "currentColor";
} else {
- gchar c[64];
- sp_svg_write_color(c, sizeof(c), specifiedcolor);
- os << c;
+ os << colorStr;
}
os << ";stop-opacity:" << opacity;
repr->setAttribute("style", os.str().c_str());
}
}
-/**
- * Return stop's color as SPColor.
- */
-static SPColor
-sp_stop_get_color(SPStop const *const stop)
-{
- if (stop->currentColor) {
- char const *str = sp_object_get_style_property(stop, "color", NULL);
- guint32 const dfl = 0;
- /* Default value: arbitrarily black. (SVG1.1 and CSS2 both say that the initial
- * value depends on user agent, and don't give any further restrictions that I can
- * see.) */
- guint32 color = dfl;
- if (str) {
- color = sp_svg_read_color(str, dfl);
- }
- SPColor ret( color );
- return ret;
- } else {
- return stop->specified_color;
- }
-}
-
/*
* Gradient
*/
}
if ( gr->getStopCount() == 0 ) {
- g_message("Check on remove");
gchar const * attr = gr->repr->attribute("osb:paint");
if ( attr && strcmp(attr, "solid") ) {
sp_object_setAttribute( gr, "osb:paint", "solid", 0 );
sp_repr_set_css_double(child, "offset", gr->vector.stops[i].offset);
/* strictly speaking, offset an SVG <number> rather than a CSS one, but exponents make no
* sense for offset proportions. */
- gchar c[64];
- sp_svg_write_color(c, sizeof(c), gr->vector.stops[i].color.toRGBA32( 0x00 ));
- os << "stop-color:" << c << ";stop-opacity:" << gr->vector.stops[i].opacity;
+ os << "stop-color:" << gr->vector.stops[i].color.toString() << ";stop-opacity:" << gr->vector.stops[i].opacity;
child->setAttribute("style", os.str().c_str());
/* Order will be reversed here */
cl = g_slist_prepend(cl, child);
// down to 100%."
gstop.offset = CLAMP(gstop.offset, 0, 1);
- gstop.color = sp_stop_get_color(stop);
+ gstop.color = stop->getEffectiveColor();
gstop.opacity = stop->opacity;
vector.stops.push_back(gstop);
diff --git a/src/sp-gradient.h b/src/sp-gradient.h
index b05cb5fb82f4dbb2fffa00f6014bbd91f1434935..97ea78fca4d773f2b7307f26ad299c2816a3ee3d 100644 (file)
--- a/src/sp-gradient.h
+++ b/src/sp-gradient.h
*/
#include <gdk/gdktypes.h>
+#include <glibmm/ustring.h>
#include "libnr/nr-matrix.h"
#include "sp-paint-server.h"
#include "sp-gradient-spread.h"
diff --git a/src/sp-stop.cpp b/src/sp-stop.cpp
index 740cfef7853e49dc0eedf63a13ea247ccb08d388..71f937927b2a3b62c6531b8fd3ea5eb39943abe6 100644 (file)
--- a/src/sp-stop.cpp
+++ b/src/sp-stop.cpp
#include "sp-stop.h"
-
+#include "style.h"
// A stop might have some non-stop siblings
SPStop* SPStop::getNextStop()
return result;
}
+SPColor SPStop::readStopColor( Glib::ustring const &styleStr, guint32 dfl )
+{
+ SPColor color(dfl);
+ SPStyle* style = sp_style_new(0);
+ SPIPaint paint;
+ paint.read( styleStr.c_str(), *style );
+ if ( paint.isColor() ) {
+ color = paint.value.color;
+ }
+ sp_style_unref(style);
+ return color;
+}
+
+SPColor SPStop::getEffectiveColor() const
+{
+ SPColor ret;
+ if (currentColor) {
+ char const *str = sp_object_get_style_property(this, "color", NULL);
+ /* Default value: arbitrarily black. (SVG1.1 and CSS2 both say that the initial
+ * value depends on user agent, and don't give any further restrictions that I can
+ * see.) */
+ ret = readStopColor( str, 0 );
+ } else {
+ ret = specified_color;
+ }
+ return ret;
+}
+
/*
diff --git a/src/sp-stop.h b/src/sp-stop.h
index bf6893db1262920a1dc84d8f373d30e68ef21108..2cf8ad6901aa034856508f54e3ccb6cf04079206 100644 (file)
--- a/src/sp-stop.h
+++ b/src/sp-stop.h
*/
#include <glib/gtypes.h>
+#include <glibmm/ustring.h>
#include "sp-object.h"
#include "color.h"
gfloat opacity;
+ static SPColor readStopColor( Glib::ustring const &styleStr, guint32 dfl = 0 );
+
SPStop* getNextStop();
SPStop* getPrevStop();
+
+ SPColor getEffectiveColor() const;
};
/// The SPStop vtable.
diff --git a/src/style.cpp b/src/style.cpp
index ffc1fb0aeaf9eb6681eb8e352c851cc5f03e4ca5..a4094621f8d9712abc32bf5f7d551f0513b27ee6 100644 (file)
--- a/src/style.cpp
+++ b/src/style.cpp
-#define __SP_STYLE_C__
-
/** @file
* @brief SVG stylesheets implementation.
*/
static void sp_style_read_ilengthornormal(SPILengthOrNormal *val, gchar const *str);
static void sp_style_read_itextdecoration(SPITextDecoration *val, gchar const *str);
static void sp_style_read_icolor(SPIPaint *paint, gchar const *str, SPStyle *style, SPDocument *document);
-static void sp_style_read_ipaint(SPIPaint *paint, gchar const *str, SPStyle *style, SPDocument *document);
static void sp_style_read_ifontsize(SPIFontSize *val, gchar const *str);
static void sp_style_read_ibaselineshift(SPIBaselineShift *val, gchar const *str);
static void sp_style_read_ifilter(gchar const *str, SPStyle *style, SPDocument *document);
g_return_val_if_fail(object != NULL, NULL);
g_return_val_if_fail(SP_IS_OBJECT(object), NULL);
- SPStyle *style = sp_style_new(SP_OBJECT_DOCUMENT(object));
+ SPStyle *style = sp_style_new( object->document );
style->object = object;
style->release_connection = object->connectRelease(sigc::bind<1>(sigc::ptr_fun(&sp_style_object_release), style));
- if (object && SP_OBJECT_IS_CLONED(object)) {
+ if (object && object->cloned) {
style->cloned = true;
}
sp_style_clear(style);
- if (object && SP_OBJECT_IS_CLONED(object)) {
+ if (object && object->cloned) {
style->cloned = true;
}
if (!style->fill.set) {
val = repr->attribute("fill");
if (val) {
- sp_style_read_ipaint(&style->fill, val, style, (object) ? SP_OBJECT_DOCUMENT(object) : NULL);
+ style->fill.read( val, *style, (object) ? SP_OBJECT_DOCUMENT(object) : NULL );
}
}
/* fill-opacity */
if (!style->stroke.set) {
val = repr->attribute("stroke");
if (val) {
- sp_style_read_ipaint(&style->stroke, val, style, (object) ? SP_OBJECT_DOCUMENT(object) : NULL);
+ style->stroke.read( val, *style, (object) ? SP_OBJECT_DOCUMENT(object) : NULL );
}
}
SPS_READ_PLENGTH_IF_UNSET(&style->stroke_width, repr, "stroke-width");
}
case SP_PROP_FILL:
if (!style->fill.set) {
- sp_style_read_ipaint(&style->fill, val, style, (style->object) ? SP_OBJECT_DOCUMENT(style->object) : NULL);
+ style->fill.read( val, *style, (style->object) ? SP_OBJECT_DOCUMENT(style->object) : NULL );
}
break;
case SP_PROP_FILL_OPACITY:
case SP_PROP_STROKE:
if (!style->stroke.set) {
- sp_style_read_ipaint(&style->stroke, val, style, (style->object) ? SP_OBJECT_DOCUMENT(style->object) : NULL);
+ style->stroke.read( val, *style, (style->object) ? SP_OBJECT_DOCUMENT(style->object) : NULL );
}
break;
case SP_PROP_STROKE_WIDTH:
@@ -3200,18 +3197,17 @@ sp_style_read_icolor(SPIPaint *paint, gchar const *str, SPStyle *style, SPDocume
*
* \pre paint == \&style.fill || paint == \&style.stroke.
*/
-static void
-sp_style_read_ipaint(SPIPaint *paint, gchar const *str, SPStyle *style, SPDocument *document)
+void SPIPaint::read( gchar const *str, SPStyle &style, SPDocument *document )
{
while (g_ascii_isspace(*str)) {
++str;
}
- paint->clear();
+ clear();
if (streq(str, "inherit")) {
- paint->set = TRUE;
- paint->inherit = TRUE;
+ set = TRUE;
+ inherit = TRUE;
} else {
if ( strneq(str, "url", 3) ) {
gchar *uri = extract_uri( str, &str );
@@ -3219,33 +3215,33 @@ sp_style_read_ipaint(SPIPaint *paint, gchar const *str, SPStyle *style, SPDocume
++str;
}
// TODO check on and comment the comparrison "paint != &style->color".
- if ( uri && *uri && (paint != &style->color) ) {
- paint->set = TRUE;
+ if ( uri && *uri && (this != &style.color) ) {
+ set = TRUE;
// it may be that this style's SPIPaint has not yet created its URIReference;
// now that we have a document, we can create it here
- if (!paint->value.href && document) {
- paint->value.href = new SPPaintServerReference(document);
- paint->value.href->changedSignal().connect(sigc::bind(sigc::ptr_fun((paint == &style->fill)? sp_style_fill_paint_server_ref_changed : sp_style_stroke_paint_server_ref_changed), style));
+ if (!value.href && document) {
+ value.href = new SPPaintServerReference(document);
+ value.href->changedSignal().connect(sigc::bind(sigc::ptr_fun((this == &style.fill)? sp_style_fill_paint_server_ref_changed : sp_style_stroke_paint_server_ref_changed), &style));
}
// TODO check what this does in light of move away from union
- sp_style_set_ipaint_to_uri_string (style, paint, uri);
+ sp_style_set_ipaint_to_uri_string (&style, this, uri);
}
g_free( uri );
}
- if (streq(str, "currentColor") && paint != &style->color) {
- paint->set = TRUE;
- paint->currentcolor = TRUE;
- } else if (streq(str, "none") && paint != &style->color) {
- paint->set = TRUE;
- paint->noneSet = TRUE;
+ if (streq(str, "currentColor") && (this != &style.color)) {
+ set = TRUE;
+ currentcolor = TRUE;
+ } else if (streq(str, "none") && (this != &style.color)) {
+ set = TRUE;
+ noneSet = TRUE;
} else {
guint32 const rgb0 = sp_svg_read_color(str, &str, 0xff);
if (rgb0 != 0xff) {
- paint->setColor( rgb0 );
- paint->set = TRUE;
+ setColor( rgb0 );
+ set = TRUE;
while (g_ascii_isspace(*str)) {
++str;
@@ -3256,7 +3252,7 @@ sp_style_read_ipaint(SPIPaint *paint, gchar const *str, SPStyle *style, SPDocume
delete tmp;
tmp = 0;
}
- paint->value.color.icc = tmp;
+ value.color.icc = tmp;
}
}
}
return 0;
}
+SPIPaint::SPIPaint() :
+ set(0),
+ inherit(0),
+ currentcolor(0),
+ colorSet(0),
+ noneSet(0),
+ value()
+{
+ value.color.set( 0 );
+ value.href = 0;
+}
void SPIPaint::clear()
{
diff --git a/src/style.h b/src/style.h
index 8102ce0ea6834d199c1429bf33414f6d85111604..b38df2532cfc01ff6c1d6a3b790513961ceb046d 100644 (file)
--- a/src/style.h
+++ b/src/style.h
SPColor color;
} value;
+ SPIPaint();
bool isSet() const { return true; /* set || colorSet*/}
bool isSameType( SPIPaint const & other ) const {return (isPaintserver() == other.isPaintserver()) && (colorSet == other.colorSet) && (currentcolor == other.currentcolor);}
void setColor( float r, float g, float b ) {value.color.set( r, g, b ); colorSet = true;}
void setColor( guint32 val ) {value.color.set( val ); colorSet = true;}
void setColor( SPColor const& color ) {value.color = color; colorSet = true;}
+
+ void read( gchar const *str, SPStyle &tyle, SPDocument *document = 0);
+
+private:
+ SPIPaint(SPIPaint const&);
+ SPIPaint &operator=(SPIPaint const &);
};
/// Filter type internal to SPStyle
index c49d9e06f0685427023ec6d585f5927c7d65a8a0..7f02566653374ee4a5d66eb4d99135a57ffff706 100644 (file)
xml_doc = SP_OBJECT_REPR(gradient)->document();
if (i < 1) {
- gchar c[64];
- sp_svg_write_color(c, sizeof(c), 0x00000000);
-
Inkscape::CSSOStringStream os;
- os << "stop-color:" << c << ";stop-opacity:" << 1.0 << ";";
+ os << "stop-color: #000000;stop-opacity:" << 1.0 << ";";
Inkscape::XML::Node *child;
@@ -555,11 +552,9 @@ static void update_stop_list( GtkWidget *mnu, SPGradient *gradient, SPStop *new_
} else {
for (; sl != NULL; sl = sl->next){
- SPStop *stop;
- GtkWidget *i;
if (SP_IS_STOP(sl->data)){
- stop = SP_STOP(sl->data);
- i = gtk_menu_item_new();
+ SPStop *stop = SP_STOP(sl->data);
+ GtkWidget *i = gtk_menu_item_new();
gtk_widget_show(i);
g_object_set_data(G_OBJECT(i), "stop", stop);
GtkWidget *hb = gtk_hbox_new(FALSE, 4);
blocked = TRUE;
SPColorSelector *csel = (SPColorSelector*)g_object_get_data(G_OBJECT(tbl), "cselector");
- guint32 const c = sp_stop_get_rgba32(stop);
- csel->base->setAlpha(SP_RGBA32_A_F(c));
- SPColor color( SP_RGBA32_R_F(c), SP_RGBA32_G_F(c), SP_RGBA32_B_F(c) );
// set its color, from the stored array
- csel->base->setColor( color );
+ csel->base->setColorAlpha( stop->getEffectiveColor(), stop->opacity );
GtkWidget *offspin = GTK_WIDGET(g_object_get_data(G_OBJECT(tbl), "offspn"));
GtkWidget *offslide =GTK_WIDGET(g_object_get_data(G_OBJECT(tbl), "offslide"));
@@ -1026,15 +1018,11 @@ static void sp_gradient_vector_widget_load_gradient(GtkWidget *widget, SPGradien
GtkOptionMenu *mnu = static_cast<GtkOptionMenu *>(g_object_get_data(G_OBJECT(widget), "stopmenu"));
SPStop *stop = SP_STOP(g_object_get_data(G_OBJECT(gtk_menu_get_active(GTK_MENU(gtk_option_menu_get_menu(mnu)))), "stop"));
- guint32 const c = sp_stop_get_rgba32(stop);
- /// get the color selector
+ // get the color selector
SPColorSelector *csel = SP_COLOR_SELECTOR(g_object_get_data(G_OBJECT(widget), "cselector"));
- // set alpha
- csel->base->setAlpha(SP_RGBA32_A_F(c));
- SPColor color( SP_RGBA32_R_F(c), SP_RGBA32_G_F(c), SP_RGBA32_B_F(c) );
- // set color
- csel->base->setColor( color );
+
+ csel->base->setColorAlpha( stop->getEffectiveColor(), stop->opacity );
/* Fill preview */
GtkWidget *w = static_cast<GtkWidget *>(g_object_get_data(G_OBJECT(widget), "preview"));
@@ -1159,10 +1147,6 @@ static void sp_gradient_vector_color_dragged(SPColorSelector *csel, GtkObject *o
static void sp_gradient_vector_color_changed(SPColorSelector *csel, GtkObject *object)
{
- SPColor color;
- float alpha;
- guint32 rgb;
-
if (blocked) {
return;
}
@@ -1190,14 +1174,13 @@ static void sp_gradient_vector_color_changed(SPColorSelector *csel, GtkObject *o
SPStop *stop = SP_STOP(g_object_get_data(G_OBJECT(gtk_menu_get_active(GTK_MENU(gtk_option_menu_get_menu(mnu)))), "stop"));
csel = static_cast<SPColorSelector*>(g_object_get_data(G_OBJECT(object), "cselector"));
+ SPColor color;
+ float alpha = 0;
csel->base->getColorAlpha( color, alpha );
- rgb = color.toRGBA32( 0x00 );
sp_repr_set_css_double(SP_OBJECT_REPR(stop), "offset", stop->offset);
Inkscape::CSSOStringStream os;
- gchar c[64];
- sp_svg_write_color(c, sizeof(c), rgb);
- os << "stop-color:" << c << ";stop-opacity:" << static_cast<gdouble>(alpha) <<";";
+ os << "stop-color:" << color.toString() << ";stop-opacity:" << static_cast<gdouble>(alpha) <<";";
SP_OBJECT_REPR(stop)->setAttribute("style", os.str().c_str());
// g_snprintf(c, 256, "stop-color:#%06x;stop-opacity:%g;", rgb >> 8, static_cast<gdouble>(alpha));
//SP_OBJECT_REPR(stop)->setAttribute("style", c);