148{
149 if (!angularDistribution.isValid() || !radialDistribution.isValid()) {
150 return;
151 }
152
154
156
157
165 }
166
170 }
172 }
173
174
175 qreal
x = info.
pos().x();
176 qreal
y = info.
pos().y();
178
182
183
185
186
190 }
191
192
193
194
197 }
198 else {
200 }
201
202 QHash<QString, QVariant> params;
203 qreal nx, ny;
204 int ix, iy;
205
206 qreal angle;
208 qreal rotationZ = 0.0;
209 qreal particleScale = 1.0;
210
211 bool shouldColor = true;
215 }
216
217 QTransform m;
218 m.reset();
221
223
224 angle = angularDistribution(randomSource) *
M_PI * 2;
225
226 length = radialDistribution(randomSource);
227
229
231
233
235 }
236
237
239
241 }
242
243
246 }
247 }
248
251
252
254
255
256 m.map(nx, ny, &nx, &ny);
257
258
259
260 if (shouldColor) {
263 }
264
265
268
269 const quint8 *colors[2];
271 colors[1] = bgColor.
data();
272
273 qint16 colorWeights[2];
274 int MAX_16BIT = 255;
276
277 colorWeights[0] =
static_cast<quint16
>(
blend * MAX_16BIT);
278 colorWeights[1] =
static_cast<quint16
>((1.0 -
blend) * MAX_16BIT);
280 }
281
290 }
291
296 }
297
299 shouldColor = false;
300 }
301
303 }
304
305 qreal jitteredWidth = qMax(1.0 * additionalScale, effectiveSize.width() * particleScale * additionalScale);
306 qreal jitteredHeight = qMax(1.0 * additionalScale, effectiveSize.height() * particleScale * additionalScale);
307
310
311 case 0:
312 {
313 if (effectiveSize.width() == effectiveSize.height()){
315 }
316 else {
318 }
319 break;
320 }
321
322 case 1:
323 {
325 break;
326 }
327
328 case 2: {
330 break;
331 }
332
333 case 3: {
334 ix = qRound(nx + x);
335 iy = qRound(ny + y);
338 break;
339 }
340 case 4: {
342
343 QTransform m;
345 m.scale(additionalScale, additionalScale);
346
348 m.scale(particleScale, particleScale);
349 }
354
356
357 for (
int y = rc.y();
y < rc.y() + rc.height();
y++) {
358 for (
int x = rc.x();
x < rc.x() + rc.width();
x++) {
361 }
362 }
363 }
364
365 ix = qRound(nx + x - rc.width() * 0.5);
366 iy = qRound(ny + y - rc.height() * 0.5);
369 break;
370 }
371 }
372 }
373
374 }
375 else {
376 KisDabShape shape(particleScale * additionalScale, 1.0, -rotationZ);
377 QPointF hotSpot =
m_brush->hotSpot(shape, info);
378 QPointF pos(nx + x, ny + y);
379 QPointF pt = pos - hotSpot;
380
381 qint32 ix;
382 qreal xFraction;
383 qint32 iy;
384 qreal yFraction;
385
388
390
391
394 shape, info, xFraction, yFraction);
395
400 }
401
402 }
403 else {
405 info, xFraction, yFraction);
406 }
408 }
411 }
412 }
413
414
415}
qreal length(const QPointF &vec)
virtual quint8 * rawData()=0
const KoColorSpace * colorSpace() const
quint32 pixelSize() const
const KoColorSpace * colorSpace() const
void convertFromQImage(const QImage &image, const KoColorProfile *profile, qint32 offsetX=0, qint32 offsetY=0)
KisRandomAccessorSP createRandomAccessorNG()
@ FillStyleForegroundColor
void setMaskImageSize(qint32 width, qint32 height)
void setOpacityF(qreal opacity)
void bitBlt(qint32 dstX, qint32 dstY, const KisPaintDeviceSP srcDev, qint32 srcX, qint32 srcY, qint32 srcWidth, qint32 srcHeight)
void setFillStyle(FillStyle fillStyle)
Set the current style with which to fill.
void setPaintColor(const KoColor &color)
void bltFixed(qint32 dstX, qint32 dstY, const KisFixedPaintDeviceSP srcDev, qint32 srcX, qint32 srcY, qint32 srcWidth, qint32 srcHeight)
virtual void moveTo(qint32 x, qint32 y)=0
qreal generateNormalized() const
virtual quint32 pixelSize() const =0
KoColorTransformation * createColorTransformation(const QString &id, const QHash< QString, QVariant > ¶meters) const
KoMixColorsOp * mixColorsOp
void setOpacity(quint8 alpha)
const KoColorSpace * colorSpace() const
return the current colorSpace
virtual void mixColors(const quint8 *const *colors, const qint16 *weights, int nColors, quint8 *dst, int weightSum=255) const =0
qreal deg2rad(quint16 deg) const
convert degrees to radians
const KisSprayShapeDynamicsOptionData * m_shapeDynamicsProperties
const KisSprayOpOptionData * m_sprayOpOptionData
KisPaintDeviceSP m_imageDevice
const KisSprayShapeOptionData * m_shapeProperties
KisFixedPaintDeviceSP m_fixedDab
void paintEllipse(KisPainter *painter, qreal x, qreal y, qreal a, qreal b, qreal angle)
qreal rotationAngle(KisRandomSourceSP randomSource)
rotation in radians according the settings (gauss distribution, uniform distribution or fixed angle)
void paintCircle(KisPainter *painter, qreal x, qreal y, qreal radius)
void paintRectangle(KisPainter *painter, qreal x, qreal y, qreal width, qreal height, qreal angle)
void paintParticle(KisRandomAccessorSP &writeAccessor, const KoColor &color, qreal rx, qreal ry)
Paints Wu Particle.
qreal rad2deg(qreal rad) const
convert radians to degrees
qreal linearInterpolation(qreal a, qreal b, qreal weight) const
mix a with b.b mix with weight and a with 1.0 - weight
const KisColorOptionData * m_colorProperties
T blend(T src, T srcAlpha, T dst, T dstAlpha, T cfValue)
static void splitCoordinate(qreal coordinate, qint32 *whole, qreal *fraction)
qreal followDrawingAngleWeight
QSize effectiveSize(int diameter, qreal scale) const