Shape center control point not visible on dark background
Migrated from https://bugs.launchpad.net/inkscape/+bug/1707919
Steps to reproduce:
- open Inkscape
- create a rectangle -> notice the small cross in the center. That's the shape center control point
- Change its fill to black
What happened?
The cross is black as well and now invisible.
What should have happened?
The control point should change its color so it's visible on dark backgrounds.
Inkscape Version and Operating System:
- Inkscape Version: 1.1-dev (c990a67, 2020-04-09)
- Operating System: Windows 10
- Operating System version: 10.0.18362
Migration info
The fill and stroke colors for shape control points are hardcoded in SPKnot::SPKnot(), and for the other control points the default values work fine, for the NORMAL status they are:
fill_color = 0xffffff00 stroke_color = 0x01000000
That is white fill with a basically black stroke.
AFAICS when the alpha channel is 0 Inkscape does not apply the XOR operator but uses the color as is (see src/display/sodipodi-ctrl.cpp::sp_ctrl_render()) however the combination from above still works fine on every background even without the XOR compositing because of the heavy contrast between the stroke and the fill color.
The problem with the center control points is that they are only drawn with the stroke color, so XOR blending is actually needed for them.
An hackish solution would be to call SPKnot::setStroke() for any entity_center->knot objects, like in the attached patch.
However this is not very elegant IMHO. A better alternative would be to be able to pass a set of colors for the different states to KnotHolderEntity::create() which currently only accepts a fill_color, but that would need some refactoring and I'd like advice from developers more familiar with the Inkscape codebase than I am.
Patch attached: 0001-Make-the-center-control-point-of-shapes-visible-on-d.patch