7#include <QtGui/qtguiglobal.h>
8#include <QtCore/qprocessordetection.h>
18#if Q_BYTE_ORDER == Q_BIG_ENDIAN
43 return fromRgba64(quint64(red) << RedShift
44 | quint64(green) << GreenShift
45 | quint64(blue) << BlueShift
46 | quint64(alpha) << AlphaShift);
48 constexpr static QRgba64 fromRgba(quint8 red, quint8 green, quint8 blue, quint8 alpha)
50 QRgba64 rgb64 = fromRgba64(red, green, blue, alpha);
52 rgb64.rgba |= rgb64.rgba << 8;
58 return fromRgba(quint8(rgb >> 16), quint8(rgb >> 8), quint8(rgb), quint8(rgb >> 24));
63 return (rgba & alphaMask()) == alphaMask();
67 return (rgba & alphaMask()) == 0;
70 constexpr quint16 red()
const {
return quint16(rgba >> RedShift); }
71 constexpr quint16 green()
const {
return quint16(rgba >> GreenShift); }
72 constexpr quint16 blue()
const {
return quint16(rgba >> BlueShift); }
73 constexpr quint16 alpha()
const {
return quint16(rgba >> AlphaShift); }
74 void setRed(quint16 _red) { rgba = (rgba & ~(Q_UINT64_C(0xffff) << RedShift)) | (quint64(_red) << RedShift); }
75 void setGreen(quint16 _green) { rgba = (rgba & ~(Q_UINT64_C(0xffff) << GreenShift)) | (quint64(_green) << GreenShift); }
76 void setBlue(quint16 _blue) { rgba = (rgba & ~(Q_UINT64_C(0xffff) << BlueShift)) | (quint64(_blue) << BlueShift); }
77 void setAlpha(quint16 _alpha) { rgba = (rgba & ~(Q_UINT64_C(0xffff) << AlphaShift)) | (quint64(_alpha) << AlphaShift); }
85 quint64 br = rgba & Q_UINT64_C(0xffff0000ffff);
86 quint64 ag = (rgba >> 16) & Q_UINT64_C(0xffff0000ffff);
87 br += Q_UINT64_C(0x8000000080);
88 ag += Q_UINT64_C(0x8000000080);
89 br = (br - ((br >> 8) & Q_UINT64_C(0xffff0000ffff))) >> 8;
90 ag = (ag - ((ag >> 8) & Q_UINT64_C(0xffff0000ffff)));
91#if Q_BYTE_ORDER == Q_BIG_ENDIAN
92 return ((br << 24) & 0xff000000)
93 | ((ag >> 24) & 0xff0000)
94 | ((br >> 24) & 0xff00)
97 return ((ag >> 16) & 0xff000000)
98 | ((br << 16) & 0xff0000)
100 | ((br >> 32) & 0xff);
105 return ushort((red() & 0xf800) | ((green() >> 10) << 5) | (blue() >> 11));
113 return QRgba64::fromRgba64(0);
114 const quint64 a = alpha();
115 quint64 br = (rgba & Q_UINT64_C(0xffff0000ffff)) * a;
116 quint64 ag = ((rgba >> 16) & Q_UINT64_C(0xffff0000ffff)) * a;
117 br = (br + ((br >> 16) & Q_UINT64_C(0xffff0000ffff)) + Q_UINT64_C(0x800000008000));
118 ag = (ag + ((ag >> 16) & Q_UINT64_C(0xffff0000ffff)) + Q_UINT64_C(0x800000008000));
119#if Q_BYTE_ORDER == Q_BIG_ENDIAN
120 ag = ag & Q_UINT64_C(0xffff0000ffff0000);
121 br = (br >> 16) & Q_UINT64_C(0xffff00000000);
122 return fromRgba64(a | br | ag);
124 br = (br >> 16) & Q_UINT64_C(0xffff0000ffff);
125 ag = ag & Q_UINT64_C(0xffff0000);
126 return fromRgba64((a << 48) | br | ag);
132#if Q_PROCESSOR_WORDSIZE < 8
133 return unpremultiplied_32bit();
135 return unpremultiplied_64bit();
182 return QRgba64::fromRgba64(r, g, b, a);
187 return QRgba64::fromRgba64(c);
201{
return rgb.red8(); }
204{
return rgb.green8(); }
207{
return rgb.blue8(); }
210{
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
#define qCWarning(category,...)
static int read_pbm_int(QIODevice *d, bool *ok, int maxDigits=-1)
static bool write_pbm_image(QIODevice *out, const QImage &sourceImage, QByteArrayView sourceFormat)
static bool read_pbm_body(QIODevice *device, char type, int w, int h, int mcc, QImage *outImage)
static QRgb scale_pbm_color(quint16 mx, quint16 rv, quint16 gv, quint16 bv)
static bool read_pbm_header(QIODevice *device, char &type, int &w, int &h, int &mcc)
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)