Results 1 to 4 of 4

Thread: multi pixmap transparency

  1. #1
    Join Date
    Aug 2006
    Posts
    14
    Thanks
    4
    Qt products
    Qt4

    Default multi pixmap transparency

    I am trying to make a shaped widget. The problem is that I have 3 different images. One scalesWidth when another pixmap gets moved by the mouse. I was trying to use this.
    I can't get it to work great for one pixmap, but I have been unable to combine the pixmaps to create a single image for masking the whole. any thoughts?

  2. #2
    Join Date
    Jan 2006
    Location
    Alingsås, Sweden
    Posts
    437
    Thanks
    3
    Thanked 39 Times in 39 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: multi pixmap transparency

    You should create a buffer bitmap that you paint the others onto, then use the buffer as a mask.

  3. #3
    Join Date
    Aug 2006
    Posts
    14
    Thanks
    4
    Qt products
    Qt4

    Default Re: multi pixmap transparency

    I am new to Qt/C++. Could you give me a push in the right direction for the buffered bitmap?

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: multi pixmap transparency

    QPixmap is a paint device like any other. You can construct an empty pixmap of appropriate size and then use QPainter to paint all three pixmaps on the constructed "buffer" pixmap.

    Qt Code:
    1. QPixmap buffer(width, height);
    2. // not sure, but you might need to fill the "buffer" with a transparent brush here
    3. // ..
    4. QPainter painter(&buffer);
    5. painter.drawPixmap(pixmap1);
    6. ..
    7. painter.drawPixmap(pixmap3);
    8. setMask(buffer.mask());
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

Similar Threads

  1. Invalid pixmap
    By munna in forum Newbie
    Replies: 2
    Last Post: 8th June 2006, 08:00
  2. Paint XP radio button to pixmap
    By Ben.Hines in forum Qt Programming
    Replies: 2
    Last Post: 26th April 2006, 21:15
  3. Changing pixmap in PixmapLabel
    By bullerwj in forum Qt Tools
    Replies: 1
    Last Post: 11th April 2006, 22:28
  4. How to paint a selection rectangle on a pixmap?
    By SkripT in forum Qt Programming
    Replies: 6
    Last Post: 8th January 2006, 19:52

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.