24 int stepX = img.width() / density;
25 int stepY = img.height() / density;
27 if (!(stepX && stepY)) {
28 return QColor::fromRgb(0);
36 for (
int x = stepX - 1; x < img.width(); x += stepX) {
37 for (
int y = stepY - 1; y < img.height(); y += stepY) {
38 int pixel = img.pixel(x, y);
39 A += (pixel & 0xFF000000) >> 24;
40 R += (pixel & 0x00FF0000) >> 16;
41 G += (pixel & 0x0000FF00) >> 8;
42 B += pixel & 0x000000FF;
46 int count = density * density;
47 return QColor::fromRgba(((A / count) << 24) |