Bug 477164 - Preview outline of the brush tip is using opaque pixels to center
Summary: Preview outline of the brush tip is using opaque pixels to center
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Usability (other bugs)
Version First Reported In: 5.2.1
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-17 22:00 UTC by paleh
Modified: 2025-09-16 10:54 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Example of a brush tip and drawing a straight line with it (70.27 KB, image/png)
2023-11-17 22:00 UTC, paleh
Details

Note You need to log in before you can comment on or make changes to this bug.
Description paleh 2023-11-17 22:00:50 UTC
Created attachment 163253 [details]
Example of a brush tip and drawing a straight line with it

STEPS TO REPRODUCE
1. Create a brush tip such that the center of the bounding box containing all its opaque pixels is clearly different from the geometric center of the brush tip's image. Use this brush tip on a simple brush such as Basic-2 Opacity.
2. Activate preview outline in general->cursor->brush outline shape
(3. Activate any cursor in general->cursor->brush cursor icon for better visibility.)
4. Make the brush sufficiently big to see the details of the outline and draw.

OBSERVED RESULT
The preview of the brush tip is drawn around the center of the set of opaque pixels of the brush tip. Meanwhile, as we draw, individual dabs are (correctly) placed around the center of the full brush tip's image. Thus the preview outline is inconsistent with the dabs.

EXPECTED RESULT
The preview outline should be centered around the center of the full brush tip's image.

SOFTWARE/OS VERSIONS
Linux: Ubuntu 22.04
Qt Version: 5.15.7
Appimage
ADDITIONAL INFORMATION
Comment 1 Dmitry Kazakov 2025-09-16 10:30:47 UTC
Git commit 036427c473a8243ea96f61200c54de8f180380e7 by Dmitry Kazakov, on behalf of Jeff Witthuhn.
Committed on 16/09/2025 at 10:30.
Pushed by dkazakov into branch 'master'.

Fix brush preview outlines being aligned based on incorrect bounding box.

The root cause of this bug is that the class `KisOptimizedBrushOutline` 
does not keep track of the original 'center' of the brush. It instead 
uses the center of the non-transparent pixels in the brush.

The patch just stores the bounds explicitly in `KisOptimizedBrushOutline`
to resolve this issue

M  +1    -1    libs/brush/kis_brush.cpp
M  +9    -3    libs/image/brushengine/KisOptimizedBrushOutline.cpp
M  +4    -2    libs/image/brushengine/KisOptimizedBrushOutline.h

https://invent.kde.org/graphics/krita/-/commit/036427c473a8243ea96f61200c54de8f180380e7
Comment 2 Dmitry Kazakov 2025-09-16 10:31:06 UTC
Git commit 5cdf332b1d44100c5e36d8ba33f4b17a43db8f38 by Dmitry Kazakov.
Committed on 16/09/2025 at 10:31.
Pushed by dkazakov into branch 'krita/5.2'.

Fix brush preview outlines being aligned based on incorrect bounding box.

The root cause of this bug is that the class `KisOptimizedBrushOutline` 
does not keep track of the original 'center' of the brush. It instead 
uses the center of the non-transparent pixels in the brush.

The patch just stores the bounds explicitly in `KisOptimizedBrushOutline`
to resolve this issue


(cherry picked from commit 036427c473a8243ea96f61200c54de8f180380e7)

46c4af7c Save bounding box of outline for image-based brushes
32b73b36 Fix formatting and add missing include
7ddbc7ab Use const reference for new constructor argument
b980bc3c BUG:477164 Update for review comments

Co-authored-by: Jeff Witthuhn <jlwitthuhn@gmail.com>

M  +1    -1    libs/brush/kis_brush.cpp
M  +9    -3    libs/image/brushengine/KisOptimizedBrushOutline.cpp
M  +4    -2    libs/image/brushengine/KisOptimizedBrushOutline.h

https://invent.kde.org/graphics/krita/-/commit/5cdf332b1d44100c5e36d8ba33f4b17a43db8f38
Comment 3 Dmitry Kazakov 2025-09-16 10:54:59 UTC
Git commit 28d8437cdd6379ba3a83ebfb5a36d8345c12ef45 by Dmitry Kazakov.
Committed on 16/09/2025 at 10:54.
Pushed by dkazakov into branch 'release/5.2.13'.

Fix brush preview outlines being aligned based on incorrect bounding box.

The root cause of this bug is that the class `KisOptimizedBrushOutline` 
does not keep track of the original 'center' of the brush. It instead 
uses the center of the non-transparent pixels in the brush.

The patch just stores the bounds explicitly in `KisOptimizedBrushOutline`
to resolve this issue


(cherry picked from commit 036427c473a8243ea96f61200c54de8f180380e7)

46c4af7c Save bounding box of outline for image-based brushes
32b73b36 Fix formatting and add missing include
7ddbc7ab Use const reference for new constructor argument
b980bc3c BUG:477164 Update for review comments

Co-authored-by: Jeff Witthuhn <jlwitthuhn@gmail.com>

M  +1    -1    libs/brush/kis_brush.cpp
M  +9    -3    libs/image/brushengine/KisOptimizedBrushOutline.cpp
M  +4    -2    libs/image/brushengine/KisOptimizedBrushOutline.h

https://invent.kde.org/graphics/krita/-/commit/28d8437cdd6379ba3a83ebfb5a36d8345c12ef45