[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [krita/krita-testing-wolthera] libs/ui/widgets: Add anti-aliasing to the shapes.
From:       Wolthera van Hovell tot Westerflier <griffinvalley () gmail ! com>
Date:       2016-08-19 19:10:49
Message-ID: E1bapBp-0004qF-Gy () code ! kde ! org
[Download RAW message or body]

Git commit 0442f67e2c9435705ccc5a994af6a9984a0a496d by Wolthera van Hovell tot \
Westerflier. Committed on 19/08/2016 at 10:05.
Pushed by woltherav into branch 'krita-testing-wolthera'.

Add anti-aliasing to the shapes.

The jaggies were starting to annoy me.

Might make the pixmap into a image later just so we can have proper transparency.

M  +25   -3    libs/ui/widgets/kis_visual_color_selector.cpp

http://commits.kde.org/krita/0442f67e2c9435705ccc5a994af6a9984a0a496d

diff --git a/libs/ui/widgets/kis_visual_color_selector.cpp \
b/libs/ui/widgets/kis_visual_color_selector.cpp index 8fe323a..58bafeb 100644
--- a/libs/ui/widgets/kis_visual_color_selector.cpp
+++ b/libs/ui/widgets/kis_visual_color_selector.cpp
@@ -323,9 +323,9 @@ QPixmap KisVisualColorSelectorShape::getPixmap()
     if (m_d->pixmapsNeedUpdate == true) {
         m_d->pixmapsNeedUpdate = false;
         m_d->gradient = QPixmap(width(), height());
-        m_d->gradient.fill(Qt::black);
+        m_d->gradient.fill(Qt::transparent);
         QImage img(width(), height(), QImage::Format_RGB32);
-        img.fill(Qt::black);
+        img.fill(Qt::transparent);;
 
         for (int y = 0; y<img.height(); y++) {
             for (int x=0; x<img.width(); x++) {
@@ -989,7 +989,19 @@ void KisVisualEllipticalSelectorShape::drawCursor()
     QPainter painter;
     painter.begin(&fullSelector);
     painter.setRenderHint(QPainter::Antialiasing);
-    //QPainterPath path;
+
+    painter.save();
+    //painter.setCompositionMode(QPainter::CompositionMode_Clear);
+    QPen pen;
+    pen.setColor(this->palette().background().color());
+    pen.setWidth(5);
+    painter.setPen(pen);
+    painter.drawEllipse(this->geometry());
+    if (getDimensions()==KisVisualColorSelectorShape::onedimensional) {
+        painter.drawEllipse(QRect(this->geometry().top()+m_barWidth, \
this->geometry().left()+m_barWidth, this->geometry().width()-(m_barWidth*2), \
this->geometry().height()-(m_barWidth*2))); +    }
+    painter.restore();
+
     QBrush fill;
     fill.setStyle(Qt::SolidPattern);
 
@@ -1128,6 +1140,16 @@ void KisVisualTriangleSelectorShape::drawCursor()
     QPainter painter;
     painter.begin(&fullSelector);
     painter.setRenderHint(QPainter::Antialiasing);
+
+    painter.save();
+    //painter.setCompositionMode(QPainter::CompositionMode_Clear);
+    QPen pen;
+    pen.setColor(this->palette().background().color());
+    pen.setWidth(5);
+    painter.setPen(pen);
+    painter.drawPolygon(m_triangle);
+    painter.restore();
+
     //QPainterPath path;
     QBrush fill;
     fill.setStyle(Qt::SolidPattern);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic