"Swap fill and stroke" doesn't work for multiple objects

Bug #367360 reported by Krzysztof Kosinski on 2009-04-26
6
Affects Status Importance Assigned to Milestone
Inkscape
Low
Alexandru Roman

Bug Description

When right-clicking on the selected style swatch, there's an action called "swap fill and stroke". However, it works incorrectly when more than one object is selected: instead of swapping the fill and stroke on each object, it averages the fills and strokes of all objects and then swaps them.

An example use case where this could be useful is for jittering the colors of strokes: the jitter color tool works on fills only.

Krzysztof Kosinski (tweenk) wrote :

Confirming and assigning Bulia as requested in e-mail.

Changed in inkscape:
assignee: nobody → buliabyak
status: New → Confirmed
jazzynico (jazzynico) on 2011-02-01
Changed in inkscape:
importance: Undecided → Low
tags: added: color
Beluga (buovjaga) wrote :

Still repro.

Arch Linux 64-bit, KDE Plasma 5
Inkscape 0.92pre1 15054 (GTK3)

I think the problem is not with the already implemented function for swap fill and stroke because it is acting as it meant to be: swaping the 2 colors from the swatch. And, if multiple objects are selected, the colors from the swatch will be the avarage color of the objects.
I looked up into the code in order to find something to change to adapt the function working with multiple objects but I realised it is acting properly for his purpose.

So I made my own function based on the ObjectSet data structure. I also added a verb definition for a shortcut.

I attached the solution.

Mc (mc...) on 2017-01-21
Changed in inkscape:
assignee: bbyak (buliabyak) → Alexandru Roman (alexandru.roman)

I made up some changes to the patch:
Removed the old swap function from src/ui/widget/selection-style.cpp as well the UI button for that function because the new one works for multiple objets.
Improved the new function with undo capability.

Another change to last version:
Keeps the UI button's functionality for "swap fill and stroke" but adapts it with the new function.

Mc (mc...) wrote :

Fix pushed to trunk r15428

Thanks !

Changed in inkscape:
milestone: none → 0.93
status: Confirmed → Fix Committed
Hachmann (marenhachmann) wrote :

Could you document the change here, @Alexandru Roman - so users will be able to know about them: http://wiki.inkscape.org/wiki/index.php/Release_notes/0.93 ?

(see http://wiki.inkscape.org/wiki/index.php/Release_notes/0.92 for previous version to compare).

Sure, I'll do my best!

I don't have permission to edit that page. I should post here the edited source of the page?

Hachmann (marenhachmann) wrote :

No, we can give you access. Which user name would you like?

alexandru.roman

Hachmann (marenhachmann) wrote :

I just noticed I don't have an email address to go with the user name...

I will set a preliminary password, and send it to you via launchpad message. Please change the password after login and add an email address.

Hachmann (marenhachmann) wrote :

Sent, please test if it worked.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers