13#include <QApplication>
14#include <QColorDialog>
35 const QSize &labelSize)
38 paintColor = initialColor;
80void ScreenWidget::createImage()
82 newImage = originalImage.
copy();
85 float cyanInk = (255 - paintColor.
red())/255.0;
86 float magentaInk = (255 - paintColor.
green())/255.0;
87 float yellowInk = (255 - paintColor.
blue())/255.0;
103 for (
int y = 0;
y < newImage.
height(); ++
y) {
104 for (
int x = 0;
x < newImage.
width(); ++
x) {
116 255 -
qMin(
int(amount * cyanInk), 255),
117 255 -
qMin(
int(amount * magentaInk), 255),
118 255 -
qMin(
int(amount * yellowInk), 255));
144 inverted = !inverted;
160 paintColor = newColor;
176 originalImage =
image;
static QColor getColor(const QColor &initial=Qt::white, QWidget *parent=nullptr, const QString &title=QString(), ColorDialogOptions options=ColorDialogOptions())
The QColor class provides colors based on RGB, HSV or CMYK values.
int red() const noexcept
Returns the red color component of this color.
int blue() const noexcept
Returns the blue color component of this color.
int green() const noexcept
Returns the green color component of this color.
bool isValid() const noexcept
Returns true if the color is valid; otherwise returns false.
The QFrame class is the base class of widgets that can have a frame.
void setFrameShape(Shape)
void setFrameShadow(Shadow)
The QGridLayout class lays out widgets in a grid.
void addWidget(QWidget *w)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setPixel(int x, int y, uint index_or_rgb)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QRgb pixel(int x, int y) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QImage copy(const QRect &rect=QRect()) const
Returns a sub-area of the image as a new image.
int width() const
Returns the width of the image.
int height() const
Returns the height of the image.
The QLabel widget provides a text or image display.
void setPixmap(const QPixmap &)
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
The QPalette class contains color groups for each widget state.
void setColor(ColorGroup cg, ColorRole cr, const QColor &color)
Sets the color in the specified color group, used for the given color role, to the specified solid co...
static QPixmap fromImage(const QImage &image, Qt::ImageConversionFlags flags=Qt::AutoColor)
Converts the given image to a pixmap using the specified flags to control the conversion.
\macro QT_RESTRICTED_CAST_FROM_ASCII
constexpr const T & qMin(const T &a, const T &b)
GLint GLint GLint GLint GLint x
[0]
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
QT_BEGIN_NAMESPACE typedef unsigned int QRgb
constexpr int qRed(QRgb rgb)
constexpr int qGreen(QRgb rgb)
constexpr int qBlue(QRgb rgb)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent