This commit is contained in:
Andrei Yankovich 2020-05-16 18:25:37 +03:00
parent 49c2e8f830
commit 4a3f591ca7

View File

@ -32,15 +32,15 @@ QColor ColorPicker::pick(const QImage &img, int density) const {
A += (pixel & 0xFF000000) >> 24; A += (pixel & 0xFF000000) >> 24;
R += (pixel & 0x00FF0000) >> 16; R += (pixel & 0x00FF0000) >> 16;
G += (pixel & 0x0000FF00) >> 8; G += (pixel & 0x0000FF00) >> 8;
B += pixel & 0x000000FF; B += pixel & 0x000000FF;
} }
} }
int count = density * 2; int count = density * density;
return QColor::fromRgba(((A / count) << 24) | return QColor::fromRgba(((A / count) << 24) |
((R / count) << 16) | ((R / count) << 16) |
((G / count) << 8) | ((G / count) << 8) |
B / count); B / count);
} }
QColor ColorPicker::pick(const QString &img) const { QColor ColorPicker::pick(const QString &img) const {