9 const quint32 colorChannelsMask = 0x00FFFFFF;
10 const float redLum = 0.2125f;
11 const float greenLum = 0.7154f;
12 const float blueLum = 0.0721f;
13 const float normCoeff = 1.0f / 255.0f;
15 const QRgb *mP =
reinterpret_cast<const QRgb*
>(maskPixels);
16 QRgb *sP =
reinterpret_cast<QRgb*
>(pixels);
18 for (
int i = 0; i < nPixels; i++) {
19 const QRgb mask = *mP;
20 const QRgb shape = *sP;
22 const float maskValue = qAlpha(mask) * (redLum * qRed(mask) + greenLum * qGreen(mask) + blueLum * qBlue(mask)) * normCoeff;
26 *sP = (alpha << 24) | (shape & colorChannelsMask);