コード例 #1
0
QPixmap scalePixmap(const QPixmap &pixmap, int width, int height)
{
  if (pixmap.width()>100)
  {
    KPixmapIO io;
    QImage img(io.convertToImage(pixmap));
    return io.convertToPixmap(img.smoothScale(width,height));
  }

  QImage img(pixmap.convertToImage().smoothScale(width,height));
  QPixmap pix;
  pix.convertFromImage(img);

  return pix;
}
コード例 #2
0
void KRootPixmap::updateBackground(KSharedPixmap *spm)
{
    QPixmap pm = *spm;

    if(m_Fade > 1e-6)
    {
        KPixmapIO io;
        QImage img = io.convertToImage(pm);
        img = KImageEffect::fade(img, m_Fade, m_FadeColor);
        pm = io.convertToPixmap(img);
    }

    if(!m_bCustomPaint)
        m_pWidget->setBackgroundPixmap(pm);
    else
    {
        emit backgroundUpdated(pm);
    }
}