467
Inkscape::XML::Document *xml_doc;
468
xml_doc = SP_OBJECT_REPR(gradient)->document();
469
sp_svg_write_color (c, 64, 0x00000000);
472
sp_svg_write_color (c, sizeof(c), 0x00000000);
471
474
Inkscape::CSSOStringStream os;
472
475
os << "stop-color:" << c << ";stop-opacity:" << 1.0 << ";";
474
477
Inkscape::XML::Node *child;
476
child = sp_repr_new ("svg:stop");
479
child = xml_doc->createElement("svg:stop");
477
480
sp_repr_set_css_double(child, "offset", 0.0);
478
481
child->setAttribute("style", os.str().c_str());
479
482
SP_OBJECT_REPR (gradient)->addChild(child, NULL);
481
child = sp_repr_new ("svg:stop");
484
child = xml_doc->createElement("svg:stop");
482
485
sp_repr_set_css_double(child, "offset", 1.0);
483
486
child->setAttribute("style", os.str().c_str());
484
487
SP_OBJECT_REPR (gradient)->addChild(child, NULL);
487
490
sp_repr_set_css_double(SP_OBJECT_REPR(stop), "offset", 0.0);
488
Inkscape::XML::Node *child = SP_OBJECT_REPR(stop)->duplicate();
491
Inkscape::XML::Node *child = SP_OBJECT_REPR(stop)->duplicate(SP_OBJECT_REPR(gradient)->document());
489
492
sp_repr_set_css_double(child, "offset", 1.0);
490
493
SP_OBJECT_REPR(gradient)->addChild(child, SP_OBJECT_REPR (stop));
592
595
SPColorSelector *csel = (SPColorSelector*)g_object_get_data (G_OBJECT (tbl), "cselector");
593
596
guint32 const c = sp_stop_get_rgba32(stop);
594
597
csel->base->setAlpha(SP_RGBA32_A_F (c));
596
sp_color_set_rgb_float (&color, SP_RGBA32_R_F (c), SP_RGBA32_G_F (c), SP_RGBA32_B_F (c));
598
SPColor color( SP_RGBA32_R_F (c), SP_RGBA32_G_F (c), SP_RGBA32_B_F (c) );
597
599
// set its color, from the stored array
598
600
csel->base->setColor( color );
599
601
GtkWidget *offspin = GTK_WIDGET (g_object_get_data (G_OBJECT (tbl), "offspn"));
700
702
if (next != NULL) {
701
new_stop_repr = SP_OBJECT_REPR(stop)->duplicate();
703
new_stop_repr = SP_OBJECT_REPR(stop)->duplicate(SP_OBJECT_REPR(gradient)->document());
702
704
SP_OBJECT_REPR(gradient)->addChild(new_stop_repr, SP_OBJECT_REPR(stop));
705
new_stop_repr = SP_OBJECT_REPR(sp_prev_stop(stop, gradient))->duplicate();
707
new_stop_repr = SP_OBJECT_REPR(sp_prev_stop(stop, gradient))->duplicate(SP_OBJECT_REPR(gradient)->document());
706
708
SP_OBJECT_REPR(gradient)->addChild(new_stop_repr, SP_OBJECT_REPR(sp_prev_stop(stop, gradient)));
717
719
Inkscape::CSSOStringStream os;
719
sp_svg_write_color (c, 64, cnew);
721
sp_svg_write_color (c, sizeof(c), cnew);
720
722
gdouble opacity = (gdouble) SP_RGBA32_A_F (cnew);
721
723
os << "stop-color:" << c << ";stop-opacity:" << opacity <<";";
722
724
SP_OBJECT_REPR (newstop)->setAttribute("style", os.str().c_str());
865
867
f = gtk_frame_new (_("Stop Color"));
866
868
gtk_widget_show (f);
867
869
gtk_box_pack_start (GTK_BOX (vb), f, TRUE, TRUE, PAD);
868
csel = (GtkWidget*)sp_color_selector_new (SP_TYPE_COLOR_NOTEBOOK, SP_COLORSPACE_TYPE_NONE);
870
csel = (GtkWidget*)sp_color_selector_new (SP_TYPE_COLOR_NOTEBOOK);
869
871
g_object_set_data (G_OBJECT (vb), "cselector", csel);
870
872
gtk_widget_show (csel);
871
873
gtk_container_add (GTK_CONTAINER (f), csel);
1011
1013
SPColorSelector *csel = SP_COLOR_SELECTOR(g_object_get_data (G_OBJECT (widget), "cselector"));
1013
1015
csel->base->setAlpha(SP_RGBA32_A_F (c));
1015
sp_color_set_rgb_float (&color, SP_RGBA32_R_F (c), SP_RGBA32_G_F (c), SP_RGBA32_B_F (c));
1016
SPColor color( SP_RGBA32_R_F (c), SP_RGBA32_G_F (c), SP_RGBA32_B_F (c) );
1017
1018
csel->base->setColor( color );
1156
1157
csel = (SPColorSelector*)g_object_get_data (G_OBJECT (object), "cselector");
1157
1158
csel->base->getColorAlpha( color, &alpha );
1158
rgb = sp_color_get_rgba32_ualpha (&color, 0x00);
1159
rgb = color.toRGBA32( 0x00 );
1160
1161
sp_repr_set_css_double (SP_OBJECT_REPR (stop), "offset", stop->offset);
1161
1162
Inkscape::CSSOStringStream os;
1163
sp_svg_write_color (c, 64, rgb);
1164
sp_svg_write_color (c, sizeof(c), rgb);
1164
1165
os << "stop-color:" << c << ";stop-opacity:" << (gdouble) alpha <<";";
1165
1166
SP_OBJECT_REPR (stop)->setAttribute("style", os.str().c_str());
1166
1167
// g_snprintf (c, 256, "stop-color:#%06x;stop-opacity:%g;", rgb >> 8, (gdouble) alpha);