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

List:       kde-commits
Subject:    kdenonbeta/kpainter
From:       Tomasz Grobelny <grotk () poczta ! onet ! pl>
Date:       2003-08-08 20:18:05
[Download RAW message or body]

CVS commit by grobelny: 

- add support for colored text


  M +8 -2      kpainter/libartpaintdevice.cc   1.54
  M +8 -3      kpaintertest/kpaintertestview.cc   1.77


--- kdenonbeta/kpainter/kpainter/libartpaintdevice.cc  #1.53:1.54
@@ -989,4 +989,5 @@ void LibartPaintDevice::handleRenderPath
 void LibartPaintDevice::handleSetFillColor(KPainter *, QPDevCmdParam2 *kparam)
 {
+        renderChars();
         KColor *color = kparam->cvalue;
         color->setTargetColorModel(RGB);
@@ -1179,4 +1180,9 @@ void LibartPaintDevice::renderChars()
                 int ii=0;
                 int bi=-1;
+                double alpha=double(255-qAlpha(m_gstate->fillColor().rgb()))/255;
+                double c[3];
+                c[0]=double(255-qRed(m_gstate->fillColor().rgb()))/255*alpha;
+                c[1]=double(255-qGreen(m_gstate->fillColor().rgb()))/255*alpha;
+                c[2]=double(255-qBlue(m_gstate->fillColor().rgb()))/255*alpha;
                 for(int i=0;i<bmp.rows;i++)
                 {
@@ -1193,5 +1199,5 @@ void LibartPaintDevice::renderChars()
                                         continue;
                                 for(int ti=ii;ti<ii+3;ti++)
-                                        m_buffer[ti]=QMAX(m_buffer[ti]-b[bi], 0);
+                                        \
m_buffer[ti]=QMAX(m_buffer[ti]-b[bi]*c[ti-ii], 0);  ii+=4;
                         }

--- kdenonbeta/kpainter/kpaintertest/kpaintertestview.cc  #1.76:1.77
@@ -109,4 +109,7 @@ void KPainterTestView::paintEvent(QPaint
         kp.drawText(10, 390, "dashes");
 /*
+        kp.save();
+        RGBAColor c1 (1,0,0,0.9);
+        kp.setFillColor(&c1);
         KFont bigfont("Times New Roman", 72);
         kp.setFont(bigfont);
@@ -115,5 +118,6 @@ void KPainterTestView::paintEvent(QPaint
         kp.setFont(smallfont);
         kp.drawText(5, 100, "And this is very very long text written with very small \
                font to compare font metrics by KWord and KPainter");
-*///hmm... there are some diffrences
+        kp.restore();
+//*///hmm... there are some diffrences
                 doRoundedRectTest(kp);
                 doPolylineTest(kp);
@@ -287,4 +291,5 @@ void KPainterTestView::doCTMTest(KPainte
 void KPainterTestView::doOpacityTest(KPainter &painter)
 {
+        painter.save();
         RGBAColor c1 (1,0,0,.3);
         RGBAColor c2 (0,.7,0,.6);
@@ -298,5 +303,5 @@ void KPainterTestView::doOpacityTest(KPa
         painter.setFillColor (&c2);
         painter.fillRect(10, 190, 100, 100);
-//      painter.end();
+        painter.restore();
 }
 


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

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