Results 1 to 6 of 6

Thread: QPixmap::grabWidget and QWidget::render loose alpha

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2007
    Location
    Quebec, Canada
    Posts
    40
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPixmap::grabWidget and QWidget::render loose alpha

    Yeah it makes sense however it doesn't work. In fact if I only render the region of the parent widget that shows my widget, the transparency gets applied in the child widget but the alpha channel of the resulting pixmap is still full opaque.

    I wouldn't mind if the actual rendering was full opaque but would like to get my alpha channel good.

  2. #2
    Join Date
    Oct 2007
    Location
    Quebec, Canada
    Posts
    40
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPixmap::grabWidget and QWidget::render loose alpha

    Well ... I finally made it. It appears that (I still don't know why though) QPixmap can't do it but using a QImage with Format_ARGB32 format, the widget renders opaque but the alpha channel it returns is the right one.

  3. #3
    Join Date
    Jan 2007
    Posts
    177
    Thanks
    8
    Thanked 10 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPixmap::grabWidget and QWidget::render loose alpha

    hm... could you attach some code?
    i would like to test it here.

  4. #4
    Join Date
    Sep 2007
    Location
    Szczecin, Poland
    Posts
    153
    Thanks
    7
    Thanked 11 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPixmap::grabWidget and QWidget::render loose alpha

    hi,
    i think you just need no prepare a pixmap on which you are drawing widgets
    Qt Code:
    1. QPixmap pix;
    2. pix.fill(QColor(0,0,0,0));
    To copy to clipboard, switch view to plain text mode 
    If you are drawing items with transparency on something that is non transparent you'll see parts of old images contents on places where widgets are transparent so you need to draw them on transparent pixmap.
    Last edited by jpn; 13th March 2008 at 07:00. Reason: missing [code] tags
    See GrEEn (Graphics Effects Environment)
    http://sourceforge.net/project/platf...roup_id=232746
    a qt-based plugins oriented MDI image processing application(contains also qt plugins like styles & imageformats).

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.