Bug 300665 - Sparks brush shows artefacts
Summary: Sparks brush shows artefacts
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Brush engines (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: LukasT
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-26 13:36 UTC by Sven Langkamp
Modified: 2013-07-16 11:00 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Screenshot showing artefacts (246.95 KB, image/png)
2012-05-26 13:37 UTC, Sven Langkamp
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sven Langkamp 2012-05-26 13:36:12 UTC
When painting with the sparks brush artefacts are visible

Reproducible: Always

Steps to Reproduce:
1. Paint with predefined sparks brush
Actual Results:  
Shows artefacts

Expected Results:  
No artefacts
Comment 1 Sven Langkamp 2012-05-26 13:37:38 UTC
Created attachment 71382 [details]
Screenshot showing artefacts
Comment 2 LukasT 2012-05-26 15:40:51 UTC
Ok, taking this one.

For me it even asserts: Q_ASSERT(srcDev->pixelSize() == d->pixelSize);
Comment 3 LukasT 2012-05-26 15:46:55 UTC
Ah, for me it asserts when painting in RGB 16-bit colorspace, that is different bug then.
Comment 4 Halla Rempt 2012-06-28 13:12:00 UTC
Aw... We don't have the sparks brush anymore! In fact, we don't have any colored gih brush anymore.
Comment 5 Halla Rempt 2012-06-28 13:24:35 UTC
Git commit 51c811e1f957570e7d1fd7d2f49e6a33b6654278 by Boudewijn Rempt.
Committed on 28/06/2012 at 15:23.
Pushed by rempt into branch 'master'.

Make sure the dab is converted to the paint device's colorspace

If we have an image brush, then we create an rgb8 dab. This dab needs
to be converted to the active paint device's colorspace before we can
paint with it.

(Long-standing bug, I guess nobody uses color image pipe brushes...)

M  +9    -1    krita/plugins/paintops/libbrush/kis_brush.cpp

http://commits.kde.org/calligra/51c811e1f957570e7d1fd7d2f49e6a33b6654278
Comment 6 Halla Rempt 2012-06-28 13:24:55 UTC
Git commit 69c18cae502fcea180bc3edc6c25de2e0c0f5211 by Boudewijn Rempt.
Committed on 28/06/2012 at 15:23.
Pushed by rempt into branch 'calligra/2.5'.

Make sure the dab is converted to the paint device's colorspace

If we have an image brush, then we create an rgb8 dab. This dab needs
to be converted to the active paint device's colorspace before we can
paint with it.

(Long-standing bug, I guess nobody uses color image pipe brushes...)

M  +9    -1    krita/plugins/paintops/libbrush/kis_brush.cpp

http://commits.kde.org/calligra/69c18cae502fcea180bc3edc6c25de2e0c0f5211
Comment 7 Halla Rempt 2012-06-28 13:25:57 UTC
Lukas, it's all yours now! No assert anymore :P
Comment 8 LukasT 2012-09-01 11:31:19 UTC
Thanks boud.

The bug happens only in Wash mode.
I have not seen artefactis in Build up mode.Hm..
Comment 9 LukasT 2012-09-01 13:33:40 UTC
Ok, so the problem is in composite operation "Alpha Darken"

Steps to reproduce:
1. Select all pixels, Del to delete to have transparent layer
2. Select Spark brush as brush and switch to Build Up mode
3. Change composite op to "Mix -> Alpha Darken", paint 
4. Observe the artefacts just like when you paint in wash mode

Not sure if this is the desired behaviour of the composite op. 
I continue with investigation.
Comment 10 Dmitry Kazakov 2013-07-16 11:00:56 UTC
Git commit b9d749eb4e7c6bbc00332c9d1c090c9a2293af74 by Dmitry Kazakov.
Committed on 16/07/2013 at 10:43.
Pushed by dkazakov into branch 'master'.

A significant refactoring in the Predefined Brush engine

This patch ports the predefined brush engine to the new capabilities
of Qt. It removes a huge chunk of hand-written code. Here is a short list
of changes:

1) All the operations are now performed on non-premultiplied RGB values.
   The use of premultiplication resulted in instability of the color,
   which caused artifacts on scaling and rotation of the brushes.

2) Trilinear filtering of the brushes is now substituted with simple
   bilinear filtering from the nearest pyramid level.

   It turned out that trilinear filtering not only impacted the
   performance, but also introduced heavy aliasing artifacts on specific
   zoom levels.

3) After the patch the speed of the dab generation raised 3-5 times. Here
   are the values for 512px brush:
   Before patch:
      Scaling:   34 ms
      Rotation:  19 ms
   After patch:
      Scaling:   6 ms
      Rotation:  9 ms
Related: bug 320368, bug 319944, bug 320651
CCMAIL:kimageshop@kde.org

M  +1    -2    krita/plugins/paintops/libbrush/CMakeLists.txt
M  +0    -1    krita/plugins/paintops/libbrush/kis_abr_brush.cpp
M  +1    -1    krita/plugins/paintops/libbrush/kis_auto_brush.cpp
M  +70   -778  krita/plugins/paintops/libbrush/kis_brush.cpp
M  +3    -26   krita/plugins/paintops/libbrush/kis_brush.h
M  +2    -3    krita/plugins/paintops/libbrush/kis_gbr_brush.cpp
D  +0    -135  krita/plugins/paintops/libbrush/kis_qimage_mask.cpp
D  +0    -138  krita/plugins/paintops/libbrush/kis_qimage_mask.h
A  +196  -0    krita/plugins/paintops/libbrush/kis_qimage_pyramid.cpp     [License: GPL (v2+)]
A  +52   -0    krita/plugins/paintops/libbrush/kis_qimage_pyramid.h     [License: GPL (v2+)]
D  +0    -64   krita/plugins/paintops/libbrush/kis_scaled_brush.cpp
D  +0    -62   krita/plugins/paintops/libbrush/kis_scaled_brush.h
A  +-    --    krita/plugins/paintops/libbrush/tests/data/brush_masks/_brush_0_sc_0.871853_rot_3.55731_sub_0.137199.png
A  +-    --    krita/plugins/paintops/libbrush/tests/data/brush_masks/_brush_1_sc_0.861342_rot_3.45867_sub_0.20933.png
A  +-    --    krita/plugins/paintops/libbrush/tests/data/brush_masks/_brush_2_sc_1.80941_rot_4.97706_sub_0.113862.png
A  +-    --    krita/plugins/paintops/libbrush/tests/data/brush_masks/_brush_3_sc_0.46124_rot_4.18791_sub_0.167627.png
A  +-    --    krita/plugins/paintops/libbrush/tests/data/brush_masks/_brush_4_sc_0.963137_rot_2.82314_sub_0.444059.png
A  +-    --    krita/plugins/paintops/libbrush/tests/data/brush_masks/_brush_5_sc_0.592981_rot_0.439579_sub_0.45074.png
A  +-    --    krita/plugins/paintops/libbrush/tests/data/brush_masks/_brush_6_sc_1.86775_rot_3.12606_sub_0.365777.png
A  +-    --    krita/plugins/paintops/libbrush/tests/data/brush_masks/_brush_7_sc_1.13937_rot_3.47854_sub_0.458733.png
A  +-    --    krita/plugins/paintops/libbrush/tests/data/brush_masks/_brush_8_sc_1.53198_rot_3.68719_sub_0.410264.png
A  +-    --    krita/plugins/paintops/libbrush/tests/data/brush_masks/_brush_9_sc_1.46566_rot_2.88023_sub_0.474873.png
M  +-    --    krita/plugins/paintops/libbrush/tests/data/result_autobrush_3.png
M  +-    --    krita/plugins/paintops/libbrush/tests/data/result_autobrush_4.png
A  +-    --    krita/plugins/paintops/libbrush/tests/data/testing_brush_512_bars.gbr
M  +24   -28   krita/plugins/paintops/libbrush/tests/kis_auto_brush_test.cpp
M  +91   -17   krita/plugins/paintops/libbrush/tests/kis_brush_test.cpp
M  +7    -2    krita/plugins/paintops/libbrush/tests/kis_brush_test.h
M  +5    -4    krita/plugins/paintops/libbrush/tests/kis_imagepipe_brush_test.cpp

http://commits.kde.org/calligra/b9d749eb4e7c6bbc00332c9d1c090c9a2293af74