8#include <QtGui/qtguiglobal.h>
10#include <QtCore/qhashfunctions.h>
11#include <QtCore/qprocessordetection.h>
21#if Q_BYTE_ORDER == Q_BIG_ENDIAN
46 return fromRgba64(quint64(red) << RedShift
47 | quint64(green) << GreenShift
48 | quint64(blue) << BlueShift
49 | quint64(alpha) << AlphaShift);
51 constexpr static QRgba64 fromRgba(quint8 red, quint8 green, quint8 blue, quint8 alpha)
53 QRgba64 rgb64 = fromRgba64(red, green, blue, alpha);
55 rgb64.rgba |= rgb64.rgba << 8;
61 return fromRgba(quint8(rgb >> 16), quint8(rgb >> 8), quint8(rgb), quint8(rgb >> 24));
66 return (rgba & alphaMask()) == alphaMask();
70 return (rgba & alphaMask()) == 0;
73 constexpr quint16 red()
const {
return quint16(rgba >> RedShift); }
74 constexpr quint16 green()
const {
return quint16(rgba >> GreenShift); }
75 constexpr quint16 blue()
const {
return quint16(rgba >> BlueShift); }
76 constexpr quint16 alpha()
const {
return quint16(rgba >> AlphaShift); }
77 void setRed(quint16 _red) { rgba = (rgba & ~(Q_UINT64_C(0xffff) << RedShift)) | (quint64(_red) << RedShift); }
78 void setGreen(quint16 _green) { rgba = (rgba & ~(Q_UINT64_C(0xffff) << GreenShift)) | (quint64(_green) << GreenShift); }
79 void setBlue(quint16 _blue) { rgba = (rgba & ~(Q_UINT64_C(0xffff) << BlueShift)) | (quint64(_blue) << BlueShift); }
80 void setAlpha(quint16 _alpha) { rgba = (rgba & ~(Q_UINT64_C(0xffff) << AlphaShift)) | (quint64(_alpha) << AlphaShift); }
88 quint64 br = rgba & Q_UINT64_C(0xffff0000ffff);
89 quint64 ag = (rgba >> 16) & Q_UINT64_C(0xffff0000ffff);
90 br += Q_UINT64_C(0x8000000080);
91 ag += Q_UINT64_C(0x8000000080);
92 br = (br - ((br >> 8) & Q_UINT64_C(0xffff0000ffff))) >> 8;
93 ag = (ag - ((ag >> 8) & Q_UINT64_C(0xffff0000ffff)));
94#if Q_BYTE_ORDER == Q_BIG_ENDIAN
95 return ((br << 24) & 0xff000000)
96 | ((ag >> 24) & 0xff0000)
97 | ((br >> 24) & 0xff00)
100 return ((ag >> 16) & 0xff000000)
101 | ((br << 16) & 0xff0000)
103 | ((br >> 32) & 0xff);
108 return ushort((red() & 0xf800) | ((green() >> 10) << 5) | (blue() >> 11));
116 return QRgba64::fromRgba64(0);
117 const quint64 a = alpha();
118 quint64 br = (rgba & Q_UINT64_C(0xffff0000ffff)) * a;
119 quint64 ag = ((rgba >> 16) & Q_UINT64_C(0xffff0000ffff)) * a;
120 br = (br + ((br >> 16) & Q_UINT64_C(0xffff0000ffff)) + Q_UINT64_C(0x800000008000));
121 ag = (ag + ((ag >> 16) & Q_UINT64_C(0xffff0000ffff)) + Q_UINT64_C(0x800000008000));
122#if Q_BYTE_ORDER == Q_BIG_ENDIAN
123 ag = ag & Q_UINT64_C(0xffff0000ffff0000);
124 br = (br >> 16) & Q_UINT64_C(0xffff00000000);
125 return fromRgba64(a | br | ag);
127 br = (br >> 16) & Q_UINT64_C(0xffff0000ffff);
128 ag = ag & Q_UINT64_C(0xffff0000);
129 return fromRgba64((a << 48) | br | ag);
135#if Q_PROCESSOR_WORDSIZE < 8
136 return unpremultiplied_32bit();
138 return unpremultiplied_64bit();
188 return QRgba64::fromRgba64(r, g, b, a);
193 return QRgba64::fromRgba64(c);
207{
return rgb.red8(); }
210{
return rgb.green8(); }
213{
return rgb.blue8(); }
216{
return rgb.alpha8(); }
constexpr ushort toRgb16() const
static constexpr QRgba64 fromRgba64(quint16 red, quint16 green, quint16 blue, quint16 alpha)
constexpr quint16 red() const
constexpr quint8 blue8() const
constexpr quint16 alpha() const
constexpr QRgba64 unpremultiplied() const
constexpr quint16 green() const
constexpr quint16 blue() const
static constexpr QRgba64 fromRgba64(quint64 c)
void setAlpha(quint16 _alpha)
constexpr uint toArgb32() const
static constexpr QRgba64 fromRgba(quint8 red, quint8 green, quint8 blue, quint8 alpha)
constexpr quint8 red8() const
constexpr bool isOpaque() const
constexpr quint8 green8() const
constexpr quint8 alpha8() const
void setGreen(quint16 _green)
void setBlue(quint16 _blue)
static constexpr QRgba64 fromArgb32(uint rgb)
void setRed(quint16 _red)
constexpr bool isTransparent() const
constexpr QRgba64 premultiplied() const
Combined button and popup list for selecting options.
#define qCWarning(category,...)
static bool write_pbm_image(QIODevice *out, const QImage &sourceImage, QByteArrayView sourceFormat)
static bool read_pbm_header(QIODevice *device, char &type, int &w, int &h, quint16 &mcc)
static quint16 read_pbm_int(QIODevice *d, bool *ok, int maxDigits=-1)
static bool read_pbm_body(QIODevice *device, char type, int w, int h, quint16 mcc, QImage *outImage)
static QRgb scale_pbm_color(quint16 mx, quint16 rv, quint16 gv, quint16 bv)
static QT_BEGIN_NAMESPACE void discard_pbm_line(QIODevice *d)
constexpr uint qBlue(QRgba64 rgb)
constexpr QRgba64 qRgba64(quint64 c)
constexpr QRgba64 qUnpremultiply(QRgba64 c)
constexpr QRgba64 qRgba64(quint16 r, quint16 g, quint16 b, quint16 a)
constexpr uint qAlpha(QRgba64 rgb)
constexpr QRgba64 qPremultiply(QRgba64 c)
constexpr uint qRed(QRgba64 rgb)
constexpr uint qGreen(QRgba64 rgb)
Q_DECLARE_TYPEINFO(QRgba64, Q_PRIMITIVE_TYPE)