Results 1 to 2 of 2

Thread: Black colour instead of transparent during image composition

  1. #1
    Join Date
    Oct 2010
    Posts
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Black colour instead of transparent during image composition

    I can't understand why when m_backgoundTransparency is 255 area which supposed to be transparent becomes black. As I Alpha is 255 means totally transparent?

    Qt Code:
    1. QPixmap tempPixmap(m_backroundPixmap->size());
    2.  
    3. tempPixmap.fill(Qt::transparent);
    4. QPainter p(&tempPixmap);
    5.  
    6. p.setCompositionMode(QPainter::CompositionMode_Source);
    7. p.drawPixmap(0,0,*m_backroundPixmap);
    8. p.setCompositionMode(QPainter::CompositionMode_DestinationIn);
    9. p.fillRect(tempPixmap.rect(),QColor(0,0,0,m_backgoundTransparency));
    10. p.end();
    11. /* */
    12. *m_backroundPixmap = tempPixmap;
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Black colour instead of transparent during image composition

    Quote Originally Posted by AsAndrew View Post
    As I Alpha is 255 means totally transparent?
    No, for full transparency alpha must be 0.

Similar Threads

  1. QPushButton: Outline white text in black on transparent background
    By Tito in forum Qt for Embedded and Mobile
    Replies: 3
    Last Post: 20th July 2011, 07:16
  2. Replies: 0
    Last Post: 25th August 2010, 17:39
  3. Image conversion black and white
    By offline in forum Qt Programming
    Replies: 1
    Last Post: 25th March 2010, 01:21
  4. Converting to transparent Image
    By navi1084 in forum Qt Programming
    Replies: 5
    Last Post: 28th August 2009, 13:25
  5. Create Transparent PNG Image
    By hvitual in forum Qt Programming
    Replies: 1
    Last Post: 2nd August 2009, 14:35

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.