| Summary: | Smoother rounded rectangle, antialiasing | ||
|---|---|---|---|
| Product: | [Applications] kolourpaint | Reporter: | Victor Varvaryuk <victor.varvariuc> |
| Component: | general | Assignee: | Glen Kaukola <gkaukola> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | gkaukola |
| Priority: | NOR | ||
| Version First Reported In: | Comes with KDE | ||
| Target Milestone: | --- | ||
| Platform: | Ubuntu | ||
| OS: | Linux | ||
| Latest Commit: | https://commits.kde.org/kolourpaint/4ac4fa0bebc4b73b0774b8fe5b3d561ce9686375 | Version Fixed/Implemented In: | |
| Sentry Crash Report: | |||
| Attachments: |
wrong right bottom corner
QPainter::drawRoundedRect() python and pyqt4 test Antialiasing setting |
||
It looks like you uploaded the wrong image Victor. Hey, it's the right image! Look at the red rounded rectangle around the button for settings of shadow effect. Sorry. My Mistake. Looks like a Qt problem to me. I made a simple little Qt app, the meat being: QRectF rect(10.0, 20.0, 80.0, 25.0); QPainter painter(this); painter.setPen(QPen(Qt::blue, 2)); painter.drawRoundedRect(rect, 15.0, 15.0, Qt::RelativeSize); And that gives me the same thing. Screen shot follows. Anyhow, I'll file a report with the Qt people and see what they have to say. Created attachment 60918 [details]
QPainter::drawRoundedRect()
Well, according to this: http://bugreports.qt.nokia.com/browse/QTBUG-6073 It's from drawing without antialiasing? I don't know if it's a bug or not, maybe i am missing something.
But the rounded rectangle is not rounded at all. See my attached Python and PyQt4 code.
Solutions:
1. Always use antialiasing.
and
2. painter.drawRoundedRect(rect, 15.0, 15.0, Qt::RelativeSize);
>When mode is Qt::RelativeSize, xRadius and yRadius are specified in percentage of half the rectangle's width and height respectively, and should be in the range 0.0 to 100.0.
So maybe use Qt::AbsoluteSize? It gives much nicer corners. Otherwise corners are distorted depending on the size of width/height.
Created attachment 60920 [details]
python and pyqt4 test
See four rounded rectangles with different parameters: antialiasing and round corners size
Created attachment 60922 [details]
Antialiasing setting
So what about adding antialiasing setting to lines, rounded rectangles, circles?
Or to all tools (would apply where appropriate?
Git commit 4ac4fa0bebc4b73b0774b8fe5b3d561ce9686375 by Martin Koller. Committed on 05/02/2017 at 19:14. Pushed by mkoller into branch 'master'. Add setting for anti-aliased drawing; lots of code cleanup The mentioned bug is about rounded rectangle and anti-aliased drawing. This patch fixes both: rounded-rectangles are now drawn with the same radius in x and y direction, which makes it look much better and avoids the mentioned problem in the bug report. An additional option in the settings menu allows now to define if the tools draw with anti-aliasing (default) or not. GUI: added a new option in the settings menu for anti-aliased drawing M +5 -0 environments/tools/kpToolEnvironment.cpp M +2 -0 environments/tools/kpToolEnvironment.h M +0 -81 imagelib/kpPainter.cpp M +0 -50 imagelib/kpPainter.h M +2 -1 kolourpaintui.rc M +1 -0 kpDefs.h M +4 -6 layers/selections/kpAbstractSelection.cpp M +5 -7 mainWindow/kpMainWindow.cpp M +1 -0 mainWindow/kpMainWindow.h M +20 -4 mainWindow/kpMainWindow_Settings.cpp M +5 -36 pixmapfx/kpPixmapFX.h M +8 -222 pixmapfx/kpPixmapFX_DrawShapes.cpp M +5 -6 tools/kpToolZoom.cpp M +26 -9 tools/polygonal/kpToolCurve.cpp M +6 -25 tools/polygonal/kpToolLine.cpp M +0 -1 tools/polygonal/kpToolLine.h M +37 -9 tools/polygonal/kpToolPolygon.cpp M +2 -7 tools/polygonal/kpToolPolygonalBase.cpp M +0 -8 tools/polygonal/kpToolPolygonalBase.h M +22 -13 tools/polygonal/kpToolPolyline.cpp M +1 -2 tools/polygonal/kpToolPolyline.h M +39 -4 tools/rectangular/kpToolEllipse.cpp M +5 -0 tools/rectangular/kpToolEllipse.h M +40 -5 tools/rectangular/kpToolRectangle.cpp M +5 -0 tools/rectangular/kpToolRectangle.h M +1 -5 tools/rectangular/kpToolRectangularBase.cpp M +1 -0 tools/rectangular/kpToolRectangularBase.h M +44 -5 tools/rectangular/kpToolRoundedRectangle.cpp M +5 -0 tools/rectangular/kpToolRoundedRectangle.h https://commits.kde.org/kolourpaint/4ac4fa0bebc4b73b0774b8fe5b3d561ce9686375 |
Created attachment 58620 [details] wrong right bottom corner Version: Comes with KDE (using KDE 4.6.1) OS: Linux Rounded rectangle tool draws a rectangle, whose right bottom corner is different than the other corners (see attachment). Also, it would very cool to have all the drawing tools (line, circle, rounded rectangles, etc.) to support anti-aliasing - have a check-box to enable/disable it either in settings or under line thickness box. Reproducible: Always OS: Linux (x86_64) release 2.6.35-28-generic Compiler: cc