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

List:       kde-commits
Subject:    KDE/kdegraphics/okular/generators/xps
From:       Pino Toscano <pino () kde ! org>
Date:       2008-06-27 21:02:37
Message-ID: 1214600557.646109.15385.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 825349 by pino:

read and set the spread style of gradients


 M  +16 -0     generator_xps.cpp  


--- trunk/KDE/kdegraphics/okular/generators/xps/generator_xps.cpp #825348:825349
@@ -631,6 +631,20 @@
     }
 }
 
+static void applySpreadStyleToQGradient( const QString &style, QGradient *qgrad )
+{
+    if ( style.isEmpty() )
+        return;
+
+    if ( style == QLatin1String( "Pad" ) ) {
+        qgrad->setSpread( QGradient::PadSpread );
+    } else if ( style == QLatin1String( "Reflect" ) ) {
+        qgrad->setSpread( QGradient::ReflectSpread );
+    } else if ( style == QLatin1String( "Repeat" ) ) {
+        qgrad->setSpread( QGradient::RepeatSpread );
+    }
+}
+
 XpsHandler::XpsHandler(XpsPage *page): m_page(page)
 {
     m_painter = NULL;
@@ -975,6 +989,7 @@
             QLinearGradient * qgrad = static_cast< QLinearGradient * >( gradients->data );
             qgrad->setStart( start );
             qgrad->setFinalStop( end );
+            applySpreadStyleToQGradient( node.attributes.value( "SpreadMethod" ), qgrad );
             node.data = new QBrush( *qgrad );
             delete qgrad;
         }
@@ -990,6 +1005,7 @@
             qgrad->setFocalPoint( origin );
             // TODO what in case of different radii?
             qgrad->setRadius( qMin( radiusX, radiusY ) );
+            applySpreadStyleToQGradient( node.attributes.value( "SpreadMethod" ), qgrad );
             node.data = new QBrush( *qgrad );
             delete qgrad;
         }
[prev in list] [next in list] [prev in thread] [next in thread] 

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