111 double Scale = Intensity / 255.0;
114 uchar *IntensityCount =
new uchar[(Intensity + 1)];
122 memset(IntensityCount, 0, (Intensity + 1) *
sizeof(uchar));
124 int startx = X - Radius;
125 int starty = Y - Radius;
126 int width = (2 * Radius) + 1;
127 int height = (2 * Radius) + 1;
129 qreal middlePointAlpha = 1;
134 middlePointAlpha = cs->opacityF(middlePointIt.
oldRawData());
139 while (middlePointAlpha > 0 && srcIt.
nextPixel()) {
141 cs->normalisedChannelsValue(srcIt.
oldRawData(), channel);
152 if (IntensityCount[I] == 1) {
153 AverageChannels[I] = channel;
155 for (
int i = 0; i < channel.size(); i++) {
156 AverageChannels[I][i] += channel[i];
164 for (
int i = 0 ; i <= Intensity ; ++i) {
165 if (IntensityCount[i] > MaxInstance) {
167 MaxInstance = IntensityCount[i];
171 if (MaxInstance != 0) {
172 channel = AverageChannels[I];
173 for (
int i = 0; i < channel.size(); i++) {
174 channel[i] /= MaxInstance;
176 cs->fromNormalisedChannelsValue(dst, channel);
179 memset(dst, 0, cs->pixelSize());
184 delete [] IntensityCount;
185 delete [] AverageChannels;
void OilPaint(const KisPaintDeviceSP src, KisPaintDeviceSP dst, const QRect &applyRect, int BrushSize, int Smoothness, KoUpdater *progressUpdater) const