ImageColors

Search for usage in LXR

#include <imagecolors.h>

Inheritance diagram for ImageColors:

Properties

QColor average
 
QColor background
 
QColor closestToBlack
 
QColor closestToWhite
 
QColor dominant
 
QColor dominantContrast
 
QColor fallbackAverage
 
QColor fallbackBackground
 
QColor fallbackDominant
 
QColor fallbackDominantContrasting
 
QColor fallbackForeground
 
QColor fallbackHighlight
 
QVariantList fallbackPalette
 
ColorUtils::Brightness fallbackPaletteBrightness
 
QColor foreground
 
QColor highlight
 
QVariantList palette
 
ColorUtils::Brightness paletteBrightness
 
QVariant source
 
- Properties inherited from QObject
 objectName
 

Signals

void fallbackAverageChanged ()
 
void fallbackBackgroundChanged ()
 
void fallbackDominantChanged ()
 
void fallbackDominantContrastingChanged ()
 
void fallbackForegroundChanged ()
 
void fallbackHighlightChanged ()
 
void fallbackPaletteBrightnessChanged ()
 
void fallbackPaletteChanged ()
 
void paletteChanged ()
 
void sourceChanged ()
 

Public Member Functions

 ImageColors (QObject *parent=nullptr)
 
QColor average () const
 
QColor background () const
 
QColor closestToBlack () const
 
QColor closestToWhite () const
 
QColor dominant () const
 
QColor dominantContrast () const
 
QColor foreground () const
 
QColor highlight () const
 
QVariantList palette () const
 
ColorUtils::Brightness paletteBrightness () const
 
void setSource (const QVariant &source)
 
void setSourceImage (const QImage &image)
 
void setSourceItem (QQuickItem *source)
 
QVariant source () const
 
QImage sourceImage () const
 
QQuickItemsourceItem () const
 
Q_INVOKABLE void update ()
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 

Additional Inherited Members

- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Public Attributes inherited from QObject
typedef QObjectList
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Detailed Description

Extracts the dominant colors from an element or an image and exports it to a color palette.

Definition at line 65 of file imagecolors.h.

Property Documentation

◆ average

QColor ImageColors::average
read

The average color of the source image.

Definition at line 108 of file imagecolors.h.

◆ background

QColor ImageColors::background
read

A color suitable for rendering a background behind the source image.

On dark items, this will be the color closest to black in the image if it's dark enough, or a dark gray otherwise. On light items, this will be the color closest to white in the image if it's light enough, or a bright gray otherwise.

Definition at line 155 of file imagecolors.h.

◆ closestToBlack

QColor ImageColors::closestToBlack
read

The darkest color of the source image.

Definition at line 165 of file imagecolors.h.

◆ closestToWhite

QColor ImageColors::closestToWhite
read

The lightest color of the source image.

Definition at line 160 of file imagecolors.h.

◆ dominant

QColor ImageColors::dominant
read

The dominant color of the source image.

The dominant color of the image is the color of the largest cluster in the image.

See also
https://en.wikipedia.org/wiki/K-means_clustering

Definition at line 118 of file imagecolors.h.

◆ dominantContrast

QColor ImageColors::dominantContrast
read

Suggested "contrasting" color to the dominant one.

It's the color in the palette nearest to the negative of the dominant

Definition at line 123 of file imagecolors.h.

◆ fallbackAverage

QColor ImageColors::fallbackAverage

The value to return when average is not available, e.g.

when ImageColors is still computing it or the source is invalid.

Definition at line 183 of file imagecolors.h.

◆ fallbackBackground

QColor ImageColors::fallbackBackground

The value to return when background is not available, e.g.

when ImageColors is still computing it or the source is invalid.

Definition at line 213 of file imagecolors.h.

◆ fallbackDominant

QColor ImageColors::fallbackDominant

The value to return when dominant is not available, e.g.

when ImageColors is still computing it or the source is invalid.

Definition at line 189 of file imagecolors.h.

◆ fallbackDominantContrasting

QColor ImageColors::fallbackDominantContrasting

The value to return when dominantContrasting is not available, e.g.

when ImageColors is still computing it or the source is invalid.

Definition at line 195 of file imagecolors.h.

◆ fallbackForeground

QColor ImageColors::fallbackForeground

The value to return when foreground is not available, e.g.

when ImageColors is still computing it or the source is invalid.

Definition at line 207 of file imagecolors.h.

◆ fallbackHighlight

QColor ImageColors::fallbackHighlight

The value to return when highlight is not available, e.g.

when ImageColors is still computing it or the source is invalid.

Definition at line 201 of file imagecolors.h.

◆ fallbackPalette

QVariantList ImageColors::fallbackPalette

The value to return when palette is not available, e.g.

when ImageColors is still computing it or the source is invalid.

Definition at line 171 of file imagecolors.h.

◆ fallbackPaletteBrightness

ColorUtils::Brightness ImageColors::fallbackPaletteBrightness

The value to return when paletteBrightness is not available, e.g.

when ImageColors is still computing it or the source is invalid.

Definition at line 177 of file imagecolors.h.

◆ foreground

QColor ImageColors::foreground
read

A color suitable for rendering text and other foreground over the source image.

On dark items, this will be the color closest to white in the image if it's light enough, or a bright gray otherwise. On light items, this will be the color closest to black in the image if it's dark enough, or a dark gray otherwise.

Definition at line 144 of file imagecolors.h.

◆ highlight

QColor ImageColors::highlight
read

An accent color extracted from the source image.

The accent color is the color cluster with the highest CIELAB chroma in the source image.

See also
https://en.wikipedia.org/wiki/Colorfulness#Chroma

Definition at line 133 of file imagecolors.h.

◆ palette

QVariantList ImageColors::palette
read

A list of colors and related information about then.

Each list item has the following properties:

  • color: The color of the list item.
  • ratio: How dominant the color is in the source image.
  • contrastingColor: The color from the source image that's closest to the inverse of color.

The list is sorted by ratio; the first element is the most dominant color in the source image and the last element is the least dominant color of the image.

Note
K-means clustering is used to extract these colors; see https://en.wikipedia.org/wiki/K-means_clustering.

Definition at line 95 of file imagecolors.h.

◆ paletteBrightness

ColorUtils::Brightness ImageColors::paletteBrightness
read

Information whether the palette is towards a light or dark color scheme, possible values are:

Definition at line 103 of file imagecolors.h.

◆ source

QVariant ImageColors::source
readwrite

The source from which colors should be extracted from.

source can be one of the following:

Note that an Item's color palette will only be extracted once unless you * call update(), regardless of how the item hanges.

Definition at line 79 of file imagecolors.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 6 2023 04:13:18 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.