/*
5 * Copyright (C) 2024 Authors
6 * Released under GNU GPL v2+, read the file
'COPYING' for more information.
8#ifndef SEEN_COLORS_COLOR_SET
9#define SEEN_COLORS_COLOR_SET
13#include <sigc++/signal.h>
17#include <sigc++/scoped_connection.h>
27using IdColors = std::vector<std::pair<std::string, Color>>;
32 ColorSet(std::shared_ptr<Space::AnySpace> space = {}, std::optional<bool> alpha = {});
37 IdColors::const_iterator
begin()
const {
return std::begin(
_colors); }
38 IdColors::const_iterator
end()
const {
return std::end(
_colors); }
63 std::optional<Color>
get()
const;
67 std::optional<Color>
get(std::string
const &
id)
const;
68 bool set(std::string
id,
Color const &color);
82 unsigned size()
const;
90 bool _set(std::string
id,
Color const &color);
IdColors::iterator begin()
Space::Components const & getComponents() const
Get a list of components for the color space set to this color set.
std::vector< double > getAll(Space::Component const &c) const
Get a list of all normalized values for this one component.
void grab()
Set this color to being grabbed for a continuous set of changes.
std::optional< bool > const _alpha_constraint
sigc::signal< void()> signal_grabbed
sigc::signal< void()> signal_released
IdColors::const_iterator end() const
sigc::signal< void()> signal_changed
void clear()
Reset the color set and remove all colors from it.
unsigned size() const
Return the number of items in the color set.
std::optional< Color > get() const
Get the color if there is only one color set with set(Color)
unsigned setAll(ColorSet const &other)
Set each of the colors from the other color set by id.
std::shared_ptr< Space::AnySpace > const getSpaceConstraint() const
void colors_changed()
Called when the colors change in some way.
void release()
Set the color as being released from continuous changes.
void colors_cleared()
Called when the list of colors changes (add or clear)
std::shared_ptr< Space::AnySpace > getBestSpace() const
Return the best color space from this collection of colors.
ColorSet(ColorSet const &obj)=delete
bool _set(std::string id, Color const &color)
IdColors::const_iterator begin() const
std::shared_ptr< Space::AnySpace > const _space_constraint
Color getAverage() const
Return the average color between this set of colors.
sigc::signal< void()> signal_cleared
bool isValid(const Space::Component &component) const
void setAverage(Space::Component const &c, double value)
Set the average value in this component by taking the average finding the delta and moving all colors...
bool isSame() const
Returns true if all of the colors are the same color.
std::optional< bool > const getAlphaConstraint() const
A set of useful color modifying functions which do not fit as generic methods on the color class itse...
std::vector< std::pair< std::string, Color > > IdColors