PyQt/Test/C++中修改PyQt对象/Cold/cold.cpp
2020-03-02 21:05:24 +08:00

19 lines
467 B
C++

#include "cold.h"
void cold(QImage &src, int delta)
{
int rows = src.height();
int cols = src.width();
for (int i = 0; i < rows; i++)
{
QRgb *line = (QRgb *)src.scanLine(i);
for (int j = 0; j < cols; j++)
{
int r = qRed(line[j]);
int g = qGreen(line[j]);
int b = qBlue(line[j]) + delta;
b = qBound(0, b, 255);
src.setPixel(j, i, qRgb(r, g, b));
}
}
}