Regarding Correct Way to get/set SPObject Style Properties
Hello , This is regarding using the functions in style.h to change the fill color of the object currently selected on canvas. I used the following code:
void FillNStroke::funcRecolor() { g_printf("Fetching....\n"); SPDocument *document = sp_desktop_document(desktop);
Inkscape::Selection *selection = sp_desktop_selection(desktop);
GSList const *items = selection->itemList(); for (GSList const *i = items; i != NULL; i = i->next) { SPObject *obj=reinterpret_cast<SPObject *>(i->data); SPStyle *style = sp_style_new_from_object(obj); style->fill.setColor(1,0,0);
g_printf("%s",obj->getId()); } }
Nothing seemed to work. I found snippets like these in the code:
getRepr()->setAttribute(key, NULL, false);
On following these lines, I tried setting a red color to all selected objects using
getRepr()->setAttribute("style-fill", "#FF0000");
Again nothing works. Could you please gimme a reference to how to use these functions in the right way ? What should be the way if I need to change a specific property of the style of the object ?
An example would really be very helpful.
Thanks Arshdeep
participants (1)
-
Arshdeep Singh