Qt 4.8
Public Functions | Properties | Friends | List of all members
qrgb666 Class Reference

#include <qdrawhelper_p.h>

Public Functions

quint8 alpha () const
 
Q_STATIC_INLINE_FUNCTION quint8 alpha (quint8 a)
 
qrgb666 byte_mul (quint8 a) const
 
Q_STATIC_INLINE_FUNCTION bool hasAlpha ()
 
Q_STATIC_INLINE_FUNCTION quint8 ialpha (quint8 a)
 
 operator quint32 () const
 
bool operator!= (const qrgb666 &v) const
 
qrgb666 operator+ (qrgb666 v) const
 
bool operator== (const qrgb666 &v) const
 
 qrgb666 ()
 
 qrgb666 (quint32 v)
 
 qrgb666 (const qargb6666 &v)
 
quint32 rawValue () const
 
qrgb666 truncedAlpha ()
 

Properties

quint8 data [3]
 

Friends

class qargb6666
 

Detailed Description

Definition at line 1239 of file qdrawhelper_p.h.

Constructors and Destructors

◆ qrgb666() [1/3]

qrgb666::qrgb666 ( )
inline

Definition at line 1244 of file qdrawhelper_p.h.

1244 {}

◆ qrgb666() [2/3]

qrgb666::qrgb666 ( quint32  v)
inline

Definition at line 1272 of file qdrawhelper_p.h.

1273 {
1274  const uchar b = qBlue(v);
1275  const uchar g = qGreen(v);
1276  const uchar r = qRed(v);
1277  const uint p = (b >> 2) | ((g >> 2) << 6) | ((r >> 2) << 12);
1278  data[0] = qBlue(p);
1279  data[1] = qGreen(p);
1280  data[2] = qRed(p);
1281 }
Q_GUI_EXPORT_INLINE int qRed(QRgb rgb)
Definition: qrgb.h:57
unsigned char uchar
Definition: qglobal.h:994
unsigned int uint
Definition: qglobal.h:996
Q_GUI_EXPORT_INLINE int qBlue(QRgb rgb)
Definition: qrgb.h:63
quint8 data[3]
Q_GUI_EXPORT_INLINE int qGreen(QRgb rgb)
Definition: qrgb.h:60

◆ qrgb666() [3/3]

qrgb666::qrgb666 ( const qargb6666 v)
inline

Definition at line 1283 of file qdrawhelper_p.h.

1284 {
1285  data[0] = v.data[0];
1286  data[1] = v.data[1];
1287  data[2] = v.data[2] & 0x03;
1288 }
quint8 data[3]
quint8 data[3]

Functions

◆ alpha() [1/2]

quint8 qrgb666::alpha ( ) const
inline

Definition at line 1250 of file qdrawhelper_p.h.

1250 { return 0xff; }

◆ alpha() [2/2]

Q_STATIC_INLINE_FUNCTION quint8 qrgb666::alpha ( quint8  a)
inline

Definition at line 1252 of file qdrawhelper_p.h.

1252 { return (a + 1) >> 2; }
long ASN1_INTEGER_get ASN1_INTEGER * a

◆ byte_mul()

qrgb666 qrgb666::byte_mul ( quint8  a) const
inline

Definition at line 1310 of file qdrawhelper_p.h.

1311 {
1312  const quint32 x = (data[2] << 16) | (data[1] << 8) | data[0];
1313  const quint32 t = ((((x & 0x03f03f) * a) >> 6) & 0x03f03f) |
1314  ((((x & 0x000fc0) * a) >> 6) & 0x000fc0);
1315 
1316  qrgb666 r;
1317  r.data[0] = t & 0xff;
1318  r.data[1] = (t >> 8) & 0xff;
1319  r.data[2] = (t >> 16) & 0xff;
1320  return r;
1321 }
long ASN1_INTEGER_get ASN1_INTEGER * a
quint8 data[3]
unsigned int quint32
Definition: qglobal.h:938

◆ hasAlpha()

Q_STATIC_INLINE_FUNCTION bool qrgb666::hasAlpha ( )
inline

Definition at line 1242 of file qdrawhelper_p.h.

1242 { return false; }

◆ ialpha()

Q_STATIC_INLINE_FUNCTION quint8 qrgb666::ialpha ( quint8  a)
inline

Definition at line 1253 of file qdrawhelper_p.h.

1253 { return (255 - a + 1) >> 2; }
long ASN1_INTEGER_get ASN1_INTEGER * a

◆ operator quint32()

qrgb666::operator quint32 ( ) const
inline

Definition at line 1290 of file qdrawhelper_p.h.

1291 {
1292  const uchar r = (data[2] << 6) | ((data[1] & 0xf0) >> 2) | (data[2] & 0x3);
1293  const uchar g = (data[1] << 4) | ((data[0] & 0xc0) >> 4) | ((data[1] & 0x0f) >> 2);
1294  const uchar b = (data[0] << 2) | ((data[0] & 0x3f) >> 4);
1295  return qRgb(r, g, b);
1296 }
unsigned char uchar
Definition: qglobal.h:994
quint8 data[3]
Q_GUI_EXPORT_INLINE QRgb qRgb(int r, int g, int b)
Definition: qrgb.h:69

◆ operator!=()

bool qrgb666::operator!= ( const qrgb666 v) const
inline

Definition at line 1259 of file qdrawhelper_p.h.

1259 { return !(*this == v); }

◆ operator+()

qrgb666 qrgb666::operator+ ( qrgb666  v) const
inline

Definition at line 1298 of file qdrawhelper_p.h.

1299 {
1300  const quint32 x1 = (data[2] << 16) | (data[1] << 8) | data[0];
1301  const quint32 x2 = (v.data[2] << 16) | (v.data[1] << 8) | v.data[0];
1302  const quint32 t = x1 + x2;
1303  qrgb666 r;
1304  r.data[0] = t & 0xff;
1305  r.data[1] = (t >> 8) & 0xff;
1306  r.data[2] = (t >> 16) & 0xff;
1307  return r;
1308 }
quint8 data[3]
unsigned int quint32
Definition: qglobal.h:938

◆ operator==()

bool qrgb666::operator== ( const qrgb666 v) const
inline

Definition at line 1323 of file qdrawhelper_p.h.

1324 {
1325  return (data[0] == v.data[0] &&
1326  data[1] == v.data[1] &&
1327  data[2] == v.data[2]);
1328 }
quint8 data[3]

◆ rawValue()

quint32 qrgb666::rawValue ( ) const
inline

Definition at line 1261 of file qdrawhelper_p.h.

1262  {
1263  return (data[2] << 16) | (data[1] << 8) | data[0];
1264  }
quint8 data[3]

◆ truncedAlpha()

qrgb666 qrgb666::truncedAlpha ( )
inline

Definition at line 1251 of file qdrawhelper_p.h.

1251 { return *this; }

Friends and Related Functions

◆ qargb6666

friend class qargb6666
friend

Definition at line 1267 of file qdrawhelper_p.h.

Properties

◆ data

quint8 qrgb666::data[3]
private

Definition at line 1269 of file qdrawhelper_p.h.

Referenced by byte_mul(), operator+(), operator==(), and qargb6666::qargb6666().


The documentation for this class was generated from the following file: