27 : QObject(parent), m_base(
base), m_base_image(
base.toImage()),
28 m_hue_to_replace(hue_to_replace)
44 if (
m_cache.count(color.rgba()) == 0) {
45 auto new_hue = color.hslHue();
49 for (
int x = 0; x < image.width(); ++x) {
50 for (
int y = 0; y < image.height(); ++y) {
51 auto pixel = image.pixelColor(x, y);
53 image.setPixelColor(x, y,
54 QColor::fromHsl(new_hue, pixel.hslSaturation(),
60 m_cache[color.rgba()] = QPixmap::fromImage(image);
std::map< QRgb, QPixmap > m_cache
const QPixmap * pixmap(const QColor &color) const
Returns a pixmap with some pixels changed to the target color.
colorizer(const QPixmap &base, int hue_to_replace, QObject *parent=nullptr)
Creates a colorizer that will replace every pixel of the given hue.
static void base(QVariant data1, QVariant data2)
Action "Build Base" for choice dialog.