Skip to content

Add new Color Space management functionality

Martin Owens requested to merge apply-refactoring into add-new-colors-code

Sitting on top of the previous merge request, this refactoring commit changes all the existing code so it uses the new color modules.

Main movement of the previous color handling code:

  • Removal of color.cpp, which is now replaced by the class in colors/color.cpp
  • Removal of svg/svg-color.cpp, which is now replaced by colors/color.cpp for full color handling and colors/util.cpp for stand alone hex parsing.
  • Removal of color-rgba.h which is now replaced by colors/color.cpp and ui/utils.cpp for Gdk conversions
  • Moving of color/cmyk-conv.cpp into colors/spaces/cmyk.cpp and regularised into a color space class.
  • Moving of hsluv.cpp and oklab.cpp which are split and regularised into many colors/spaces/hsluv.cpp and ok*.cpp color space classes
  • Moving of color/color-conv.cpp into colors/utils.cpp for basic hex parsing and printing
  • Moving of color/cms-* into colors/cms/* with some of the code from object/colorprofile.cpp to restrict the use of lcms2 to just this directory and make the accessing of cms profiles and transforms predictable and less error prone.
  • Moving of profile-manager.cpp functionality colors/tracker.cpp rewritten to create the new icc color space objects.
  • Moving of ui/selected-color.cpp functionality to colors/selected.cpp rewritten to rebase on a color object with signals and alpha intent.
  • Removal of color/color-profile-cms-fns.h as all the cms encapsulation is already done above.
  • Removal of widgets/paintdef.cpp, which was a duplicate color structure, xml functionality moved to colors/xml-color.cpp
  • Removal of svg/svg-renderer.cpp color code, Gdk coversions moved to ui/utils and css code is now an Inkscape::Color object.
  • Removal of svg-color and oklab tests which are entirely replaced by colors/*tests
  • Refactor global-palettes.cpp to remove all custom rgb building and instead build Color objects directly.
  • Refactor color-icc-selector removing most of it's own code in favor of the cms and color space API
  • Use glade for color picker widgets and integrate into color space component information, creating a new color-page widget and removing scales widget
  • Rewrite of color-slider widget to use the same signaling and color generation as everything else. Removing much duplication.

Refactoring actions:

  • Refactor style color to remove SPColor and Href values, add a private Inkscape::Color and getter/setter functions.
  • Refactor style alpha so it can be used as a double transparently without conversion.
  • Refactor SP-Stop color to bundle opacity and simplify how color is used.
  • Refactor filter constructors to stop constructing their own rgb css color formats
  • Remove extract color functions from preferences and replace with getColor and setColor which take the new color object.
  • Remove use of SPColor from anywhere it's being used and replace with Inkscape::Color object
  • Remove SP_RGBA32_G_F and similar macros to construct colors, or convert them from preferences.
  • Remove custom checkerboard darken and use new color utils and cairo utils
  • Remove custom HSL tweaking code from selected-style
  • Remove SPIPaint::read function used in sp-stop, it was basically just a color parser
  • Add cairo color functions into display/cairo-utils.cpp which centralise conversion to RGBA; to make it easier to replace later.
  • Use colors/utils make_contrasted_color for finding consistant contrasting colors, replacing copy pasta calculations.
  • Removal of icc profile specific code in display/nr-filter-* code
  • Use Color Tracker object in document.cpp instead of the now deleted Profile Manager
  • Use Color utils hex parsing for Gtk/css handling in themes instead of sp_svg_write_color
  • Use Color in lpe color values, removing duplicated color parsing and printing.
  • Use Color for item highlight color and plug into various gtk widgets.
  • Use average color util in GrDrag instead of internal rgb calculation.
  • Drag and drop colors using new xml and mime type code in colors/dragndrop.cpp
  • Parse colors directly out of SP-Object attr code using parseAttr to make optional Color objects.
  • Convert SP Grid to use color objects instead of RGBA ints
  • Use color/cms framework instead of lcms2 directly in sp-image
  • Use getColor to handle opacity and color in gradients and mesh gradients
  • Use Color object in extensions param color.
  • Parse colors using new parsers in internal extensions.
  • Replace color average or blending with colors/utils average color methods
  • Use color module in swatches and palettes for parsing out any color needed
  • Use of HSL space inside color object instead of converting to and fro in color manipulation code
  • Use average_color_between for all color dividers such as gradient-dragging and desktop-style
  • Focus all uses of cairo context setting through display/cairo-utils.cpp color setting functions
  • Use a standard toColorRef function in emf/wmf extensions to convert colors.
  • Generate base64 from icc profiles found in pdf files using the cms object
  • Document properties to use the internal ColorProfile generator instead of it's own xml code
  • Convert tool and desktop prefs color from guint32 to optional Color objects for preference setting/getting
  • Use util Colors::lightness instead of SP_RGBA32_LUMINANCE
  • Move no_alpha from color-picker to selected color to better control what it's doing
  • Fix TODO issue with selected color not calling update when dragging had finished

Other things:

  • Add sp_repr_css_set_property_string to xml/repr.h to handle setting std::string
  • Add gtk adjustment functions to ui/util.cpp to replace color-scale specific code
  • Give SPIScale24 a setter and getter for double instead of requiring the use of SP_SCALE24_TO/FROM_FLOAT at every use.
  • Removed a useless _cmp method in document-properties

Merge request reports