Results 1 to 1 of 1

Thread: wet floor problem

  1. #1
    Join Date
    Jun 2011
    Posts
    56
    Thanks
    7
    Qt products
    Qt4

    Default Re: wet floor problem

    Why doesn't this code work? I'd like to create the wet floor effect with Qt and I am painting on a QWidget.

    Qt Code:
    1. painter.save();
    2.  
    3. reflectionGradient.setColorAt(.0f, QColor(0, 0, 0, 0));
    4. reflectionGradient.setColorAt(1.0f, QColor(0, 0, 0, 255));
    5.  
    6. reflectionGradient.setFinalStop(0, pixmap.height());
    7.  
    8. painter.setCompositionMode(QPainter::CompositionMode_DestinationIn);
    9.  
    10. painter.fillRect(pixmap.rect(), reflectionGradient);
    11.  
    12. painter.setCompositionMode(QPainter::CompositionMode_DestinationOver);
    13.  
    14. painter.drawPixmap(zero, pixmap);
    15.  
    16. painter.restore();
    To copy to clipboard, switch view to plain text mode 


    Added after 16 minutes:


    I think I have the answer:

    int QPaintDevice::depth () const

    returns 24, hence no destination alpha. Is it possible to force destination alpha to 32 somehow, or work around this limitation, without creating a temporary QPixmap or QImage.
    Last edited by ugluk; 20th February 2012 at 14:18.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.